Xen-devel Digest, Vol 85, Issue 212
to subscribe
Quoted 482 lines
Send Xen-devel mailing list submissions to
[email protected]To subscribe or unsubscribe via the World Wide Web, visit
http://lists.xen.org/cgi-bin/mailman/listinfo/xen-devel
or, via email, send a message with subject or body 'help' to
[email protected]You can reach the person managing the list at
[email protected]When replying, please edit your Subject line so it is more specific than "Re: Contents of Xen-devel digest..."
Today's Topics:
1. Re: xl: expose
max_cpu_idfromxl info(Zhigang Wang)
2. Re: libxl and unsigned types (George Dunlap)
3. [PATCH]tools/blktap: reorderMEMSHR_DIRto fix CFLAGS (Olaf Hering)
4. Re: [PATCH] xen/blkback: Squash the discard support for 'file' and 'phy' type. (Konrad Rzeszutek Wilk)
5. Re: libxl and unsigned types (Jan Beulich)----------------------------------------------------------------------
Message: 1
Date: Wed, 14 Mar 2012 11:48:10 -0400
From: Zhigang Wang <[email protected]>
To: Andrew Cooper <[email protected]>
Cc: "[email protected]" <[email protected]>,
Ian Jackson <[email protected]>
Subject: Re: [Xen-devel] xl: exposemax_cpu_idfromxl info
Message-ID: <[email protected]>
Content-Type: text/plain; charset="iso-8859-1"Quoted 32 lines · Andrew Cooper
Quoted 24 lines · Zhigang Wang
Quoted 23 lines · Andrew Cooper
This will allow userspace to reason with the total number of CPUs, not just the current number of online CPUs.
-- Andrew Cooper - Dom0 Kernel Engineer, Citrix XenServer T: +44 (0)1223 225 900, http://www.citrix.com
xl-info-max_cpu_id.patch
# HG changeset patch
# Parent5d20d2f6ffed0a49f030f04a8870f1926babbcbf
xl: displaymax_cpu_idsfor xl infoExpose "
max_cpu_id" in stdout fromxl infoSigned-off-by Andrew Cooper <[email protected]>diff -r
5d20d2f6ffedtools/libxl/xl_cmdimpl.ctools/libxl/xl_cmdimpl.c +0
-0@@ -3734,6 +3734,7 @@ static void output_physinfo(void) }Quoted 6 lines
tools/libxl/xl_cmdimpl.c static void output_physinfo(void) · line 3737
Quoted 2 lines
tools/libxl/xl_cmdimpl.c +1
-0printf ("nr_cpus : %d\n" , info.nr_cpus); +printf ("max_cpu_id : %d\n" , info.max_cpu_id);Is this true:
nr_cpus=max_cpu_id+ 1 ?Zhigang
Quoted 8 lines
if and only if all cpus are online.
nr_cpusis set tonr_online_cpus()in the hypercall, whilemax_cpu_idis set to nr_cpu_ids-1.
nr_cpusis liable to change during runtime, whilemax_cpu_idis not.~Andrew
If this is the case, I think
nr_cpusis a bit confusing. Can we make it always representing the number of physical cpus (from hypervisor's viewpoint, not dom0)?Zhigang
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
tools/libxl/xl_cmdimpl.c +0
-0printf ("nr_nodes : %d\n" , info.nr_nodes);printf ("cores_per_socket : %d\n" , info.cores_per_socket);printf ("threads_per_core : %d\n" , info.threads_per_core);Quoted 9 lines
Quoted 5 lines
Quoted 4 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-develSignature · 2 lines
Andrew Cooper - Dom0 Kernel Engineer, Citrix XenServer T: +44 (0)1223 225 900, http://www.citrix.com-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xen.org/archives/html/xen-devel/attachments/20120314/ca02e86a/attachment.html>------------------------------
Message: 2
Date: Wed, 14 Mar 2012 16:02:24 +0000
From: George Dunlap <[email protected]>
To: Ian Jackson <[email protected]>
Cc: Ian Campbell <[email protected]>, Jan Beulich
<[email protected]>, xen-devel <[email protected]>
Subject: Re: [Xen-devel] libxl and unsigned types
Message-ID:
<CAFLBxZarXcgXbyAu4gjQpdpsBkH7gS37mg0hhWJ0wgBn18288g@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1Quoted 30 lines · Ian Jackson
Jan Beulich writes ("Re: [Xen-devel] [PATCH] libxl: don't accept negative disk or partition indexes"):
Quoted 3 lines
I would call this surprising only if you think purely mathematically (which you shouldn't when programming in any language that uses finite width data types).
I think this is a coding style question. ?It isn't addressed in
CODING_STYLEand the current code is (as ever) inconsistent, but we should make a specific decision and stick to it for new changes at least.Quoted 3 lines
Instead I find it rather natural to actively use those properties that you call surprising, and in particular to use unsigned types for variables that can't (or shouldn't) have negative values
The problem is that the cannot-be-negative property doesn't just apply to the type (eg, count) in question. ?It also propagates to values derived from it by arithmetic. ?Attempts, for example, to calculate remaining space, or differences of any kind, go badly wrong.
I think the correct approach is to use signed types and, at appropriately points, explicitly limit incoming values to small enough subsets of their types that arithmetic overflow cannot occur anywhere.
Quoted 3 lines
(not the least because this tends to produce better code, as no sign-extension is necessary when using such variables e.g. as array indexes).
This is not a consideration in libxl because libxl doesn't contain hot paths.
Quoted 6 lines
Quoted 2 lines
? Plus I'd be curious where you would see fit
for unsigned types (or whether you consider them evil altogether).They are useful for bitfields, values whose abstract types are circular orders, and the like. ?Not things which are supposed to model a subset of the mathematical integers.
FWIW, overall ijc's proposal seems sensible to me.
-George
------------------------------
Message: 3
Date: Wed, 14 Mar 2012 17:03:03 +0100
From: Olaf Hering <[email protected]>
To: [email protected]
Subject: [Xen-devel] [PATCH]tools/blktap: reorderMEMSHR_DIRto fix
CFLAGS
Message-ID: <[email protected]>
Content-Type: text/plain; charset="us-ascii"# HG changeset patch
# User Olaf Hering <[email protected]>
# Date 1331740943 -3600
# Node ID43d9bd95f981259776cb6e3ea7fd7c536fa89135# Parent773d0367087212c43faf8cdcc21cf443b1ea0046tools/blktap: reorderMEMSHR_DIRto fix CFLAGSIn blktap2
MEMSHR_DIRis used before it is set. This removes the required -D_GNU_SOURCE from CFLAGS, its used as option for -I Fix this by moving memshr related flags to the place where its actually used.
The failure is a missingO_DIRECTdefine.Signed-off-by Olaf Hering <[email protected]>diff -r
773d03670872-r43d9bd95f981tools/blktap/drivers/Makefiletools/blktap/drivers/Makefile +0
-0@@ -3,14 +3,12 @@ include $(XEN_ROOT)/tools/Rules.mkIBIN = blktapctrl tapdisk
QCOW_UTIL= img2qcow qcow2raw qcow-create
-MEMSHR_DIR = ../../memshrCFLAGS += -Werror CFLAGS += -Wno-unused CFLAGS += -I../lib CFLAGS += $(CFLAGS_libxenctrl) CFLAGS += $(CFLAGS_libxenstore)-CFLAGS += -I $(MEMSHR_DIR)
CFLAGS += -D_GNU_SOURCEifeq ($CONFIG_GCRYPT,y)
tools/blktap/drivers/Makefile +0
-0@@ -23,7 +21,9 @@ endifMEMSHRLIBS :=
ifeq ($(CONFIG_Linux), y)
+MEMSHR_DIR = ../../memshr
CFLAGS += -DMEMSHR
+CFLAGS += -I $(MEMSHR_DIR)
MEMSHRLIBS += $(MEMSHR_DIR)/libmemshr.a
endifdiff -r
773d03670872-r43d9bd95f981tools/blktap2/drivers/Makefiletools/blktap2/drivers/Makefile +0
-0@@ -14,7 +14,6 @@ CFLAGS += -Wno-unusedCFLAGS += -fno-strict-aliasing CFLAGS += -I$(BLKTAP_ROOT)/include -I$(BLKTAP_ROOT)/drivers CFLAGS += $(CFLAGS_libxenctrl)-CFLAGS += -I $(MEMSHR_DIR)
CFLAGS += -D_GNU_SOURCE
CFLAGS += -DUSE_NFS_LOCKStools/blktap2/drivers/Makefile +0
-0@@ -38,11 +37,11 @@ elsetapdisk2 tapdisk-stream tapdisk-diff $(QCOW_UTIL): AIOLIBS := -laio endif
tools/blktap2/drivers/Makefile +0
-2-MEMSHR_DIR = $(XEN_ROOT)/tools/memshr -MEMSHRLIBS :=
ifeq ($(CONFIG_Linux),__fixme__)
+MEMSHR_DIR = $(XEN_ROOT)/tools/memshr
CFLAGS += -DMEMSHR
+CFLAGS += -I $(MEMSHR_DIR)
MEMSHRLIBS += -L$(XEN_ROOT)/tools/libxc -lxenctrl $(MEMSHR_DIR)/libmemshr.a endif------------------------------
Message: 4
Date: Wed, 14 Mar 2012 12:03:27 -0400
From: Konrad Rzeszutek Wilk <[email protected]>
To: Jan Beulich <[email protected]>
Cc: [email protected], Li Dongyang <[email protected]>,
[email protected], [email protected]
Subject: Re: [Xen-devel] [PATCH] xen/blkback: Squash the discard
support for 'file' and 'phy' type.
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-asciiQuoted 17 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · Konrad Rzeszutek Wilk
The only reason for the distinction was for the special case of 'file' (which is assumed to be loopback device), was to reach inside the loopback device, find the underlaying file, and call fallocate on it. Fortunately "xen-blkback: convert hole punching to discard request on loop devices" removes that use-case and we now based the discard support based on
blk_queue_discard(q)and extract all appropriate parameters from the 'structrequest_queue'.Quoted 3 lines
CC Li Dongyang <[email protected]>CC Jan Beulich <[email protected]>Signed-off-by Konrad Rzeszutek Wilk <[email protected]>Acked-by Jan Beulich <[email protected]>(with a few minor remarks below)
Quoted 11 lines
drivers/block/xen-blkback/blkback.c static int dispatch_discard_io(struct xen_blkif *blkif, · line 422
Quoted 8 lines
drivers/block/xen-blkback/blkback.c +1
-1@@ -419,21 +419,17 @@ static int dispatch_discard_io(struct xen_blkif *blkif,int err =0 ;int status =BLKIF_RSP_OKAY ;struct block_device *bdev = blkif->vbd.bdev; - +unsigned long secure =0 ;Mind keeping the blank line and dropping the pointless initializer (which future gcc is likely going to be warning about)?
<nods>
Quoted 45 lines
Quoted 45 lines
drivers/block/xen-blkback/blkback.c +7
-11blkif->st_ds_req++;xen_blkif_get (blkif); -if (blkif->blk_backend_type ==BLKIF_BACKEND_PHY || - blkif->blk_backend_type ==BLKIF_BACKEND_FILE ) { -unsigned long secure = (blkif->vbd.discard_secure && - (req->u.discard.flag &BLKIF_DISCARD_SECURE )) ? -BLKDEV_DISCARD_SECURE :0 ; - err =blkdev_issue_discard (bdev, - req->u.discard.sector_number, - req->u.discard.nr_sectors, -GFP_KERNEL , secure); - }else - err = -EOPNOTSUPP ; + secure = (blkif->vbd.discard_secure && + (req->u.discard.flag &BLKIF_DISCARD_SECURE )) ? +BLKDEV_DISCARD_SECURE :0 ; + + err =blkdev_issue_discard (bdev, req->u.discard.sector_number, + req->u.discard.nr_sectors, +GFP_KERNEL , secure);if (err == -EOPNOTSUPP ) {pr_debug (DRV_PFX "discard op failed, not supported\n" );drivers/block/xen-blkback/xenbus.c +7
-5@@ -393,52 +393,37 @@ int xen_blkbk_discard(struct xenbus_transaction xbt, struct backend_info *be)char *type;int err;int state =0 ; +struct block_device *bdev = be->blkif->vbd.bdev; +struct request_queue *q =bdev_get_queue (bdev); - type =xenbus_read (XBT_NIL , dev->nodename,"type" ,NULL ); -if (!IS_ERR (type)) { -if (strncmp (type,"file" ,4 ) ==0 ) { - state =1 ; - blkif->blk_backend_type =BLKIF_BACKEND_FILE ; +if (blk_queue_discard (q)) { + err =xenbus_printf (xbt, dev->nodename, +"discard-granularity" ,"%u" , + q->limits.discard_granularity); +if (err) {Quoted 8 lines
drivers/block/xen-blkback/xenbus.c int xen_blkbk_discard(struct xenbus_transaction xbt, · line 407
Quoted 3 lines
drivers/block/xen-blkback/xenbus.c +3
-0+xenbus_dev_fatal (dev, err, +"writing discard-granularity" ); + goto kfree;Unrelated to the patch here, but failure to write any sort of extension data shouldn't be considered fatal - the backend can well work without these, and it should be left to the frontend to decide whether it wants to live without the unavailable extensions.
<nods>. Let me whip up another patch that removes these 'fatal' cases and is based on this one.
Quoted 54 lines
Jan
Quoted 51 lines
drivers/block/xen-blkback/xenbus.c +16
-32+ } + err =xenbus_printf (xbt, dev->nodename, +"discard-alignment" ,"%u" , + q->limits.discard_alignment); +if (err) { +xenbus_dev_fatal (dev, err, +"writing discard-alignment" ); + goto kfree; } -if (strncmp (type,"phy" ,3 ) ==0 ) { -struct block_device *bdev = be->blkif->vbd.bdev; -struct request_queue *q =bdev_get_queue (bdev); -if (blk_queue_discard (q)) { - err =xenbus_printf (xbt, dev->nodename, -"discard-granularity" ,"%u" , - q->limits.discard_granularity); -if (err) { -xenbus_dev_fatal (dev, err, -"writing discard-granularity" ); - goto kfree; - } - err =xenbus_printf (xbt, dev->nodename, -"discard-alignment" ,"%u" , - q->limits.discard_alignment); -if (err) { -xenbus_dev_fatal (dev, err, -"writing discard-alignment" ); - goto kfree; - } - state =1 ; - blkif->blk_backend_type =BLKIF_BACKEND_PHY ; - } -/* Optional. */ - err =xenbus_printf (xbt, dev->nodename, -"discard-secure" ,"%d" , - blkif->vbd.discard_secure); -if (err) { -xenbus_dev_fatal (dev, err, + state =1 ; +/* Optional. */ + err =xenbus_printf (xbt, dev->nodename, +"discard-secure" ,"%d" , + blkif->vbd.discard_secure); +if (err) { +xenbus_dev_fatal (dev, err,"writting discard-secure" ); - goto kfree; - } + goto kfree; } - }else {Quoted 9 lines
Quoted 8 lines
drivers/block/xen-blkback/xenbus.c +0
-4- err =PTR_ERR (type); -xenbus_dev_fatal (dev, err,"reading type" ); - goto out; } - err =xenbus_printf (xbt, dev->nodename,"feature-discard" ,"%d" , state);if (err)
------------------------------
Message: 5
Date: Wed, 14 Mar 2012 16:14:10 +0000
From: "Jan Beulich" <[email protected]>
To: "George Dunlap" <[email protected]>, "Ian Jackson"
<[email protected]>
Cc: Ian Campbell <[email protected]>, xen-devel
<[email protected]>
Subject: Re: [Xen-devel] libxl and unsigned types
Message-ID: <[email protected]>
Content-Type: text/plain; charset=US-ASCIIQuoted 34 lines
Quoted 1 line
Quoted 1 line · George Dunlap
Quoted 1 line · Ian Jackson
Jan Beulich writes ("Re: [Xen-devel] [PATCH] libxl: don't accept negative
disk or partition indexes"):
Quoted 29 lines
Quoted 3 lines
I would call this surprising only if you think purely mathematically (which you shouldn't when programming in any language that uses finite width data types).
I think this is a coding style question. It isn't addressed in
CODING_STYLEand the current code is (as ever) inconsistent, but we should make a specific decision and stick to it for new changes at least.Quoted 3 lines
Instead I find it rather natural to actively use those properties that you call surprising, and in particular to use unsigned types for variables that can't (or shouldn't) have negative values
The problem is that the cannot-be-negative property doesn't just apply to the type (eg, count) in question. It also propagates to values derived from it by arithmetic. Attempts, for example, to calculate remaining space, or differences of any kind, go badly wrong.
I think the correct approach is to use signed types and, at appropriately points, explicitly limit incoming values to small enough subsets of their types that arithmetic overflow cannot occur anywhere.
Quoted 3 lines
(not the least because this tends to produce better code, as no sign-extension is necessary when using such variables e.g. as array indexes).
This is not a consideration in libxl because libxl doesn't contain hot paths.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Plus I'd be curious where you would see fit
for unsigned types (or whether you consider them evil altogether).They are useful for bitfields, values whose abstract types are circular orders, and the like. Not things which are supposed to model a subset of the mathematical integers.
FWIW, overall ijc's proposal seems sensible to me.
I hadn't seen one, and the mail archive doesn't show one either. Or did you mean IanJ's reply above (in which case I continue to be of a different opinion, and hope I won't be forbidden to use unsigned types namely in hypervisor code - if on the tools side maintainers decide to do so I guess I'll have to try to cope with that)? Or is ijc not equivalent to IanC?
Jan
------------------------------
Quoted 8 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-develEnd of Xen-devel Digest, Vol 85, Issue 212
******************************************
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel