lkml.org 
[lkml]   [2009]   [Apr]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [patch 12/13] GRU - update gru kernel self tests
    On Mon, 06 Apr 2009 11:08:21 -0500
    steiner@sgi.com wrote:

    > From: Jack Steiner <steiner@sgi.com>
    >
    > Change the kernel self tests that can be optionally executed on
    > GRU initialization. This is primarily for testing.
    >
    > Eliminate the BUG statements on failure and return bad status.
    > Add ioctl interface to execute the tests on demand.
    >
    > ...
    >
    > +static int quicktest2(unsigned long arg)
    > +{
    > + static struct completion cmp;
    > + static int inited;
    > + unsigned long han;
    > + int blade_id = 0;
    > + int numcb = 4;
    > + int ret = 0;
    > + unsigned long *buf;
    > + void *cb0, *cb;
    > + int i, k, istatus, bytes;
    > +
    > + bytes = numcb * 4 * 8;
    > + buf = kmalloc(bytes, GFP_KERNEL);
    > + if (!buf)
    > + return -ENOMEM;
    > +
    > + ret = -EBUSY;
    > + if (!inited)
    > + init_completion(&cmp);

    This could have been done at compile time?

    > + inited = 1;
    > + han = gru_reserve_async_resources(blade_id, numcb, 0, &cmp);
    > + if (!han)
    > + goto done;
    > +
    > + gru_lock_async_resource(han, &cb0, NULL);
    > + memset(buf, 0xee, bytes);
    > + for (i = 0; i < numcb; i++)
    > + gru_vset(cb0 + i * GRU_HANDLE_STRIDE, uv_gpa(&buf[i * 4]), 0,
    > + XTYPE_DW, 4, 1, IMA_INTERRUPT);
    > +
    > + ret = 0;
    > + for (k = 0; k < numcb; k++) {
    > + gru_wait_async_cbr(han);
    > + for (i = 0; i < numcb; i++) {
    > + cb = cb0 + i * GRU_HANDLE_STRIDE;
    > + istatus = gru_check_status(cb);
    > + if (istatus == CBS_ACTIVE)
    > + continue;
    > + if (istatus == CBS_EXCEPTION)
    > + ret = -EFAULT;
    > + else if (buf[i] || buf[i + 1] || buf[i + 2] ||
    > + buf[i + 3])
    > + ret = -EIO;
    > + }
    > + }
    > + BUG_ON(cmp.done);
    > +
    > + gru_unlock_async_resource(han);
    > + gru_release_async_resources(han);
    > +done:
    > + kfree(buf);
    > + return ret;
    > +}



    \
     
     \ /
      Last update: 2009-04-10 00:43    [W:2.129 / U:0.516 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site