From: Konrad Rzeszutek Wilk Date: Mon, 15 Feb 2016 20:47:28 +0000 (-0500) Subject: tmem: Include name in the pool descriptions. Fix check on 32-bit builds. X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=c9c809af0c3ced171efde5a662f32020cd0dc0e4;p=xentesttools%2Fbootstrap.git tmem: Include name in the pool descriptions. Fix check on 32-bit builds. Which is the check for incorrect values in the tmem pages. Signed-off-by: Konrad Rzeszutek Wilk --- diff --git a/root_image/drivers/tmem_test/tmem_test.c b/root_image/drivers/tmem_test/tmem_test.c index a162afd..336c712 100644 --- a/root_image/drivers/tmem_test/tmem_test.c +++ b/root_image/drivers/tmem_test/tmem_test.c @@ -38,6 +38,7 @@ struct _arg { int rc; struct tmem_oid oid; struct tmem_pool_uuid uuid; + const char *name; }; @@ -134,7 +135,8 @@ static int thread(void *_arg) pr_warn("No arguments passed in thread!\n"); return -EINVAL; } - pr_info("pool=%d, flags=%d, uuid=%lx:%lx\n", arg->pool, arg->flags, + pr_info("pool=%d[%s], flags=0x%x, uuid=%lx:%lx\n", arg->pool, + arg->name, arg->flags, (unsigned long)arg->uuid.lo, (unsigned long)arg->uuid.hi); arg->rc = 0; do { @@ -163,7 +165,8 @@ again: rc = xen_tmem_put_page(arg->pool, oid[i], 0, pfn); if (rc != 1) { - pr_warn("pool=%d i=%d PUT PFN=0x%lx, rc=%d!\n", arg->pool,i, pfn, rc); + pr_warn("pool=%d[%s] i=%d PUT PFN=0x%lx, rc=%d!\n", + arg->pool, arg->name, i, pfn, rc); if (rc == -EFROZEN || rc == -ENOMEM) { set_current_state(TASK_INTERRUPTIBLE); schedule_timeout_interruptible(HZ); @@ -186,7 +189,8 @@ again: rc = xen_tmem_get_page(arg->pool, oid[i], 0, pfn); if (rc != 1) { - pr_warn("pool=%d i=%d GET PFN=0x%lx, rc=%d!\n", arg->pool, i, pfn, rc); + pr_warn("pool=%d[%s] i=%d GET PFN=0x%lx, rc=%d!\n", + arg->pool, arg->name, i, pfn, rc); arg->rc = rc; break; } @@ -194,11 +198,16 @@ again: unsigned long v; for (v = 0; v < PAGE_SIZE / sizeof(*addr); v += sizeof(*addr)) { +#ifdef CONFIG_X86_32 + if (addr[v] != 0xc2c2c2c2) { +#else if (addr[v] != 0xc2c2c2c2c2c2c2c2) { - print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, addr, PAGE_SIZE); - pr_warn("pool=%d i=%d UUID=%lx:%lx failed! Have: [0x%lx]\n", arg->pool, i, +#endif + pr_warn("pool=%d[%s] i=%d UUID=%lx:%lx failed! Have: [0x%lx]\n", + arg->pool, arg->name, i, (unsigned long)arg->uuid.lo, (unsigned long)arg->uuid.hi, addr[v]); + print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, addr, PAGE_SIZE); BUG(); } } @@ -231,28 +240,32 @@ static int __init tmem_test_init(void) a[i].flags = TMEM_POOL_PERSIST; a[i].pool = -1; a[i].oid.oid[0] = 0x1000+i; + a[i].name = "Persistent"; if (shared) { i++; a[i].uuid.lo = 0xdeadbeef; - a[i].uuid.hi = 0; + a[i].uuid.hi = 1; a[i].flags = TMEM_POOL_SHARED; a[i].pool = -1; a[i].oid.oid[0] = 0x1000+i; - + a[i].name = "Shared ephemeral"; i++; a[i].uuid.lo = 0xdeadbeef; a[i].uuid.hi = 0; a[i].flags = TMEM_POOL_SHARED; a[i].pool = -1; a[i].oid.oid[0] = 0x1000+i; + a[i].name = "Shared ephemeral"; } else { i++; a[i].oid.oid[0] = 0; a[i].pool = -1; + a[i].name = "Unknown"; i++; a[i].oid.oid[0] = 0; a[i].pool = -1; + a[i].name = "Unknown"; } i++; a[i].uuid.lo = 0xbad; @@ -260,6 +273,7 @@ static int __init tmem_test_init(void) a[i].flags = 0; a[i].pool = -1; a[i].oid.oid[0] = 0x1000+i; + a[i].name = "Ephemeral"; for (i = 0; i < MAX_THREADS; i++) { a[i].rc = 0; @@ -268,8 +282,9 @@ static int __init tmem_test_init(void) rc = xen_tmem_new_pool(a[i].uuid, a[i].flags, PAGE_SIZE); if (rc < 0) { - pr_warn("%d UUID=%lx:%lx flags=0x%x failed with rc=%d\n", - i, (unsigned long)a[i].uuid.lo, (unsigned long)a[i].uuid.hi, a[i].flags, rc); + pr_warn("%s UUID=%lx:%lx flags=0x%x failed with rc=%d\n", + a[i].name, (unsigned long)a[i].uuid.lo, + (unsigned long)a[i].uuid.hi, a[i].flags, rc); rc = -EINVAL; goto exit; }