[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090409153715.f77bfbd4.akpm@linux-foundation.org>
Date: Thu, 9 Apr 2009 15:37:15 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: steiner@....com
Cc: linux-kernel@...r.kernel.org
Subject: Re: [patch 12/13] GRU - update gru kernel self tests
On Mon, 06 Apr 2009 11:08:21 -0500
steiner@....com wrote:
> From: Jack Steiner <steiner@....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;
> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists