* [PATCH] qemu-xen: fix cpu hotplug @ 2010-09-02 13:17 Stefano Stabellini 2010-09-02 17:30 ` Ian Jackson 0 siblings, 1 reply; 9+ messages in thread From: Stefano Stabellini @ 2010-09-02 13:17 UTC (permalink / raw) To: xen-devel qemu-xen: fix cpu hotplug The current xenstore watch path for a vcpu-set event is wrong and is also wrong the code to parse it. This patch fixes both of them: a xenstore vcpu hotplug command is of the following form: path: /local/domain/DOMID/cpu/VCPU_NUMBER/availability values: "online" or "offline" Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> diff --git a/xenstore.c b/xenstore.c index 6d24613..2c325ad 100644 --- a/xenstore.c +++ b/xenstore.c @@ -680,9 +680,12 @@ void xenstore_parse_domain_config(int hvm_domid) } /* Set a watch for vcpu-set */ - if (pasprintf(&buf, "/local/domain/%u/cpu", domid) != -1) { - xs_watch(xsh, buf, "vcpu-set"); - fprintf(logfile, "Watching %s\n", buf); + for (i = 0; i < vcpus; i++) { + if (pasprintf(&buf, "/local/domain/%u/cpu/%u/availability", + domid, i) != -1) { + xs_watch(xsh, buf, "vcpu-set"); + fprintf(logfile, "Watching %s\n", buf); + } } /* no need for ifdef CONFIG_STUBDOM, since in the qemu case @@ -970,15 +973,14 @@ void xenstore_record_dm_state(const char *state) static void xenstore_process_vcpu_set_event(char **vec) { char *act = NULL; - char *vcpustr, *node = vec[XS_WATCH_PATH]; - unsigned int vcpu, len; + char *node = vec[XS_WATCH_PATH]; + unsigned int vcpu, len, domid; - vcpustr = strstr(node, "cpu/"); - if (!vcpustr) { - fprintf(stderr, "vcpu-set: watch node error.\n"); + if (sscanf(node, "/local/domain/%u/cpu/%u/availability", + &domid, &vcpu) <= 0) { + fprintf(stderr, "vcpu-set: watch node error, path=%s\n", node); return; } - sscanf(vcpustr, "cpu/%u", &vcpu); act = xs_read(xsh, XBT_NULL, node, &len); if (!act) { ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] qemu-xen: fix cpu hotplug 2010-09-02 13:17 [PATCH] qemu-xen: fix cpu hotplug Stefano Stabellini @ 2010-09-02 17:30 ` Ian Jackson 2010-09-03 6:28 ` Liu, Jinsong 0 siblings, 1 reply; 9+ messages in thread From: Ian Jackson @ 2010-09-02 17:30 UTC (permalink / raw) To: Stefano Stabellini; +Cc: Liu, Jinsong, xen-devel, Li, Xin, Jiang, Yunhong Stefano Stabellini writes ("[Xen-devel] [PATCH] qemu-xen: fix cpu hotplug"): > qemu-xen: fix cpu hotplug > > The current xenstore watch path for a vcpu-set event is wrong and is > also wrong the code to parse it. This patch fixes both of them: Thanks. So it seems you're saying it's completely broken in xen-unstable. I have CC'd a bunch of Intel folks who were doing some other work on cpu hotplug. They were dealing with a race when multiple CPUs were added at once. So I think there must be some confusion. Perhaps xl and xend have different ideas about what the xenstore syntax is for these operations ? Jinsong Liu et al: would you care to comment ? Particularly about this: > A xenstore vcpu hotplug command is of the following form: > path: /local/domain/DOMID/cpu/VCPU_NUMBER/availability > values: "online" or "offline" That doesn't seem to match up with what's in xend, which seems to write "cpu_avail" in the vm tree. Thanks, Ian. ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH] qemu-xen: fix cpu hotplug 2010-09-02 17:30 ` Ian Jackson @ 2010-09-03 6:28 ` Liu, Jinsong 2010-09-03 7:34 ` Christoph Egger 2010-09-03 17:27 ` Ian Jackson 0 siblings, 2 replies; 9+ messages in thread From: Liu, Jinsong @ 2010-09-03 6:28 UTC (permalink / raw) To: Ian Jackson, Stefano Stabellini Cc: xen-devel@lists.xensource.com, Li, Xin, Jiang, Yunhong [-- Attachment #1: Type: text/plain, Size: 2063 bytes --] Ian Jackson wrote: > Stefano Stabellini writes ("[Xen-devel] [PATCH] qemu-xen: fix cpu > hotplug"): >> qemu-xen: fix cpu hotplug >> >> The current xenstore watch path for a vcpu-set event is wrong and is >> also wrong the code to parse it. This patch fixes both of them: > > Thanks. So it seems you're saying it's completely broken in > xen-unstable. Stabellini, I read your attached patch, it's OK. In fact, we firstly implemented xenstore watch by same scheme of your patch, watching each cpu node status: /local/domain/xx/cpu/yy/availability=offline (online) However, we finally didn't use this scheme. We watch 'common' node instead: /local/domain/xx/cpu in this way, only 1 watch point need. Considering vcpu number may become more and more in the future (say, more than 128), it's more simple and reasonable. (Watches can be set at points in the hierarchy and an individual watch will be triggered when anything at or below that point in the hierachy changes) > > I have CC'd a bunch of Intel folks who were doing some other > work on cpu hotplug. They were dealing with a race when multiple CPUs > were added at once. > > So I think there must be some confusion. Perhaps xl and xend have > different ideas about what the xenstore syntax is for these > operations ? > > Jinsong Liu et al: would you care to comment ? Particularly about > this: > >> A xenstore vcpu hotplug command is of the following form: >> path: /local/domain/DOMID/cpu/VCPU_NUMBER/availability >> values: "online" or "offline" Yes, I think there must be some confusion. Currently 'xm vcpu-set' command works fine with both PV and HVM vcpu hotplug. Stabellini/Jackson, would your please tell me what xl recently happened for vcpu hotplug? is there any different ideas xl and xend about xenstore syntax? (Each time 'xm vcpu-set' executed, xend will write all xenstore cpu node status) > > That doesn't seem to match up with what's in xend, which seems to > write "cpu_avail" in the vm tree. > > Thanks, > Ian. [-- Attachment #2: Type: message/rfc822, Size: 6144 bytes --] From: Stefano Stabellini <stefano.stabellini@eu.citrix.com> To: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com> Subject: [Xen-devel] [PATCH] qemu-xen: fix cpu hotplug Date: Thu, 2 Sep 2010 21:17:20 +0800 Message-ID: <alpine.DEB.2.00.1009021416500.2714@kaball-desktop> qemu-xen: fix cpu hotplug The current xenstore watch path for a vcpu-set event is wrong and is also wrong the code to parse it. This patch fixes both of them: a xenstore vcpu hotplug command is of the following form: path: /local/domain/DOMID/cpu/VCPU_NUMBER/availability values: "online" or "offline" Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> diff --git a/xenstore.c b/xenstore.c index 6d24613..2c325ad 100644 --- a/xenstore.c +++ b/xenstore.c @@ -680,9 +680,12 @@ void xenstore_parse_domain_config(int hvm_domid) } /* Set a watch for vcpu-set */ - if (pasprintf(&buf, "/local/domain/%u/cpu", domid) != -1) { - xs_watch(xsh, buf, "vcpu-set"); - fprintf(logfile, "Watching %s\n", buf); + for (i = 0; i < vcpus; i++) { + if (pasprintf(&buf, "/local/domain/%u/cpu/%u/availability", + domid, i) != -1) { + xs_watch(xsh, buf, "vcpu-set"); + fprintf(logfile, "Watching %s\n", buf); + } } /* no need for ifdef CONFIG_STUBDOM, since in the qemu case @@ -970,15 +973,14 @@ void xenstore_record_dm_state(const char *state) static void xenstore_process_vcpu_set_event(char **vec) { char *act = NULL; - char *vcpustr, *node = vec[XS_WATCH_PATH]; - unsigned int vcpu, len; + char *node = vec[XS_WATCH_PATH]; + unsigned int vcpu, len, domid; - vcpustr = strstr(node, "cpu/"); - if (!vcpustr) { - fprintf(stderr, "vcpu-set: watch node error.\n"); + if (sscanf(node, "/local/domain/%u/cpu/%u/availability", + &domid, &vcpu) <= 0) { + fprintf(stderr, "vcpu-set: watch node error, path=%s\n", node); return; } - sscanf(vcpustr, "cpu/%u", &vcpu); act = xs_read(xsh, XBT_NULL, node, &len); if (!act) { _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel [-- Attachment #3: Type: text/plain, Size: 138 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] qemu-xen: fix cpu hotplug 2010-09-03 6:28 ` Liu, Jinsong @ 2010-09-03 7:34 ` Christoph Egger 2010-09-03 7:47 ` Liu, Jinsong 2010-09-03 17:27 ` Ian Jackson 1 sibling, 1 reply; 9+ messages in thread From: Christoph Egger @ 2010-09-03 7:34 UTC (permalink / raw) To: xen-devel Cc: Liu, Jinsong, Jiang, Yunhong, Ian Jackson, Li, Xin, Stefano Stabellini On Friday 03 September 2010 08:28:53 Liu, Jinsong wrote: > Ian Jackson wrote: > > Stefano Stabellini writes ("[Xen-devel] [PATCH] qemu-xen: fix cpu > > > > hotplug"): > >> qemu-xen: fix cpu hotplug > >> > >> The current xenstore watch path for a vcpu-set event is wrong and is > >> also wrong the code to parse it. This patch fixes both of them: > > > > Thanks. So it seems you're saying it's completely broken in > > xen-unstable. > > Stabellini, I read your attached patch, it's OK. > In fact, we firstly implemented xenstore watch by same scheme of your > patch, watching each cpu node status: > /local/domain/xx/cpu/yy/availability=offline (online) > > However, we finally didn't use this scheme. We watch 'common' node instead: > /local/domain/xx/cpu > in this way, only 1 watch point need. > Considering vcpu number may become more and more in the future (say, more > than 128), it's more simple and reasonable. (Watches can be set at points > in the hierarchy and an individual watch will be triggered when anything at > or below that point in the hierachy changes) Does this scheme allow to say how many cores per cpu exist ? When you run a Windows guest with a license for one cpu socket, then you can use 4 cores. But if one cpu is equal to one socket, then you can't use SMP for the Windows guest. Christoph > > > I have CC'd a bunch of Intel folks who were doing some other > > work on cpu hotplug. They were dealing with a race when multiple CPUs > > were added at once. > > > > So I think there must be some confusion. Perhaps xl and xend have > > different ideas about what the xenstore syntax is for these > > operations ? > > > > Jinsong Liu et al: would you care to comment ? Particularly about > > > > this: > >> A xenstore vcpu hotplug command is of the following form: > >> path: /local/domain/DOMID/cpu/VCPU_NUMBER/availability > >> values: "online" or "offline" > > Yes, I think there must be some confusion. > Currently 'xm vcpu-set' command works fine with both PV and HVM vcpu > hotplug. > > Stabellini/Jackson, would your please tell me what xl recently happened for > vcpu hotplug? is there any different ideas xl and xend about xenstore > syntax? > (Each time 'xm vcpu-set' executed, xend will write all xenstore cpu node > status) > > > That doesn't seem to match up with what's in xend, which seems to > > write "cpu_avail" in the vm tree. > > > > Thanks, > > Ian. -- ---to satisfy European Law for business letters: Advanced Micro Devices GmbH Einsteinring 24, 85609 Dornach b. Muenchen Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen Registergericht Muenchen, HRB Nr. 43632 ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH] qemu-xen: fix cpu hotplug 2010-09-03 7:34 ` Christoph Egger @ 2010-09-03 7:47 ` Liu, Jinsong 2010-09-03 10:10 ` Stefano Stabellini 0 siblings, 1 reply; 9+ messages in thread From: Liu, Jinsong @ 2010-09-03 7:47 UTC (permalink / raw) To: Christoph Egger, xen-devel@lists.xensource.com Cc: Jiang, Yunhong, Ian Jackson, Li, Xin, Stefano Stabellini Christoph Egger wrote: > On Friday 03 September 2010 08:28:53 Liu, Jinsong wrote: >> Ian Jackson wrote: >>> Stefano Stabellini writes ("[Xen-devel] [PATCH] qemu-xen: fix cpu >>> >>> hotplug"): >>>> qemu-xen: fix cpu hotplug >>>> >>>> The current xenstore watch path for a vcpu-set event is wrong and >>>> is also wrong the code to parse it. This patch fixes both of them: >>> >>> Thanks. So it seems you're saying it's completely broken in >>> xen-unstable. >> >> Stabellini, I read your attached patch, it's OK. >> In fact, we firstly implemented xenstore watch by same scheme of your >> patch, watching each cpu node status: >> /local/domain/xx/cpu/yy/availability=offline (online) >> >> However, we finally didn't use this scheme. We watch 'common' node >> instead: /local/domain/xx/cpu in this way, only 1 watch point need. >> Considering vcpu number may become more and more in the future (say, >> more than 128), it's more simple and reasonable. (Watches can be set >> at points in the hierarchy and an individual watch will be triggered >> when anything at or below that point in the hierachy changes) > > Does this scheme allow to say how many cores per cpu exist ? > > When you run a Windows guest with a license for one cpu socket, > then you can use 4 cores. But if one cpu is equal to one socket, > then you can't use SMP for the Windows guest. > > Christoph > Seems this is another story? Jinsong > >> >>> I have CC'd a bunch of Intel folks who were doing some other >>> work on cpu hotplug. They were dealing with a race when multiple >>> CPUs were added at once. >>> >>> So I think there must be some confusion. Perhaps xl and xend have >>> different ideas about what the xenstore syntax is for these >>> operations ? >>> >>> Jinsong Liu et al: would you care to comment ? Particularly about >>> >>> this: >>>> A xenstore vcpu hotplug command is of the following form: >>>> path: /local/domain/DOMID/cpu/VCPU_NUMBER/availability >>>> values: "online" or "offline" >> >> Yes, I think there must be some confusion. >> Currently 'xm vcpu-set' command works fine with both PV and HVM vcpu >> hotplug. >> >> Stabellini/Jackson, would your please tell me what xl recently >> happened for vcpu hotplug? is there any different ideas xl and xend >> about xenstore syntax? (Each time 'xm vcpu-set' executed, xend will >> write all xenstore cpu node status) >> >>> That doesn't seem to match up with what's in xend, which seems to >>> write "cpu_avail" in the vm tree. >>> >>> Thanks, >>> Ian. ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH] qemu-xen: fix cpu hotplug 2010-09-03 7:47 ` Liu, Jinsong @ 2010-09-03 10:10 ` Stefano Stabellini 0 siblings, 0 replies; 9+ messages in thread From: Stefano Stabellini @ 2010-09-03 10:10 UTC (permalink / raw) To: Liu, Jinsong Cc: Christoph Egger, xen-devel@lists.xensource.com, Stefano Stabellini, Jiang, Yunhong, Ian Jackson, Li, Xin On Fri, 3 Sep 2010, Liu, Jinsong wrote: > Christoph Egger wrote: > > On Friday 03 September 2010 08:28:53 Liu, Jinsong wrote: > >> Ian Jackson wrote: > >>> Stefano Stabellini writes ("[Xen-devel] [PATCH] qemu-xen: fix cpu > >>> > >>> hotplug"): > >>>> qemu-xen: fix cpu hotplug > >>>> > >>>> The current xenstore watch path for a vcpu-set event is wrong and > >>>> is also wrong the code to parse it. This patch fixes both of them: > >>> > >>> Thanks. So it seems you're saying it's completely broken in > >>> xen-unstable. > >> > >> Stabellini, I read your attached patch, it's OK. > >> In fact, we firstly implemented xenstore watch by same scheme of your > >> patch, watching each cpu node status: > >> /local/domain/xx/cpu/yy/availability=offline (online) > >> > >> However, we finally didn't use this scheme. We watch 'common' node > >> instead: /local/domain/xx/cpu in this way, only 1 watch point need. > >> Considering vcpu number may become more and more in the future (say, > >> more than 128), it's more simple and reasonable. (Watches can be set > >> at points in the hierarchy and an individual watch will be triggered > >> when anything at or below that point in the hierachy changes) > > > > Does this scheme allow to say how many cores per cpu exist ? > > > > When you run a Windows guest with a license for one cpu socket, > > then you can use 4 cores. But if one cpu is equal to one socket, > > then you can't use SMP for the Windows guest. > > > > Christoph > > > > Seems this is another story? > Yes, the scheme we are talking about regards the communication of vcpu online and offline to qemu and nothing else. ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH] qemu-xen: fix cpu hotplug 2010-09-03 6:28 ` Liu, Jinsong 2010-09-03 7:34 ` Christoph Egger @ 2010-09-03 17:27 ` Ian Jackson 2010-09-03 18:52 ` Liu, Jinsong 1 sibling, 1 reply; 9+ messages in thread From: Ian Jackson @ 2010-09-03 17:27 UTC (permalink / raw) To: Liu, Jinsong Cc: Jiang, Yunhong, xen-devel@lists.xensource.com, Li, Xin, Stefano Stabellini Liu, Jinsong writes ("RE: [Xen-devel] [PATCH] qemu-xen: fix cpu hotplug"): > Stabellini, I read your attached patch, it's OK. So we should apply Stefano's patch ? I'm not sure I'm convinced. > In fact, we firstly implemented xenstore watch by same scheme of > your patch, watching each cpu node status: > /local/domain/xx/cpu/yy/availability=offline (online) > > However, we finally didn't use this scheme. We watch 'common' node > instead: /local/domain/xx/cpu in this way, only 1 watch point need. > Considering vcpu number may become more and more in the future (say, > more than 128), it's more simple and reasonable. (Watches can be > set at points in the hierarchy and an individual watch will be > triggered when anything at or below that point in the hierachy > changes) Here you seem to be saying that the scheme that you implemented (in xend, I take it) is not the same as the one in Stefano's patch. > Yes, I think there must be some confusion. > Currently 'xm vcpu-set' command works fine with both PV and HVM vcpu hotplug. Right, good. > Stabellini/Jackson, would your please tell me what xl recently > happened for vcpu hotplug? Well, we accepted patches to try to implement "xl vcpu-set" to make it work like "xm vcpu-set" but they are apparently wrong. > is there any different ideas xl and xend about xenstore syntax? xl should use the same syntax in xenstore as xend currently does. If xm (and therefore xend) and qemu currently work properly then changing qemu will break xend. Instead, libxl should be changed to use the same scheme as xend. > (Each time 'xm vcpu-set' executed, xend will write all xenstore cpu > node status) Right. Thanks, Ian. ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH] qemu-xen: fix cpu hotplug 2010-09-03 17:27 ` Ian Jackson @ 2010-09-03 18:52 ` Liu, Jinsong 2010-09-06 11:00 ` Stefano Stabellini 0 siblings, 1 reply; 9+ messages in thread From: Liu, Jinsong @ 2010-09-03 18:52 UTC (permalink / raw) To: Ian Jackson Cc: Jiang, Yunhong, xen-devel@lists.xensource.com, Li, Xin, Stefano Stabellini Ian, I have discussed with Stefano about current xl/xend situation: 1). current issue seems casued by xl side; 2). we don't need apply Stefano's patch, at least now; Stefano, you will check xl side, right? Thanks, Jinsong Ian Jackson wrote: > Liu, Jinsong writes ("RE: [Xen-devel] [PATCH] qemu-xen: fix cpu > hotplug"): >> Stabellini, I read your attached patch, it's OK. > > So we should apply Stefano's patch ? I'm not sure I'm convinced. > >> In fact, we firstly implemented xenstore watch by same scheme of >> your patch, watching each cpu node status: >> /local/domain/xx/cpu/yy/availability=offline (online) >> >> However, we finally didn't use this scheme. We watch 'common' node >> instead: /local/domain/xx/cpu in this way, only 1 watch point need. >> Considering vcpu number may become more and more in the future (say, >> more than 128), it's more simple and reasonable. (Watches can be >> set at points in the hierarchy and an individual watch will be >> triggered when anything at or below that point in the hierachy >> changes) > > Here you seem to be saying that the scheme that you implemented (in > xend, I take it) is not the same as the one in Stefano's patch. > >> Yes, I think there must be some confusion. >> Currently 'xm vcpu-set' command works fine with both PV and HVM vcpu >> hotplug. > > Right, good. > >> Stabellini/Jackson, would your please tell me what xl recently >> happened for vcpu hotplug? > > Well, we accepted patches to try to implement "xl vcpu-set" to make it > work like "xm vcpu-set" but they are apparently wrong. > >> is there any different ideas xl and xend about xenstore syntax? > > xl should use the same syntax in xenstore as xend currently does. If > xm (and therefore xend) and qemu currently work properly then changing > qemu will break xend. Instead, libxl should be changed to use the > same scheme as xend. > >> (Each time 'xm vcpu-set' executed, xend will write all xenstore cpu >> node status) > > Right. > > Thanks, > Ian. ^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [PATCH] qemu-xen: fix cpu hotplug 2010-09-03 18:52 ` Liu, Jinsong @ 2010-09-06 11:00 ` Stefano Stabellini 0 siblings, 0 replies; 9+ messages in thread From: Stefano Stabellini @ 2010-09-06 11:00 UTC (permalink / raw) To: Liu, Jinsong Cc: Jiang, Yunhong, xen-devel@lists.xensource.com, Ian Jackson, Li, Xin, Stefano Stabellini On Fri, 3 Sep 2010, Liu, Jinsong wrote: > Ian, > > I have discussed with Stefano about current xl/xend situation: > 1). current issue seems casued by xl side; > 2). we don't need apply Stefano's patch, at least now; > > Stefano, you will check xl side, right? > Yes. However I tried to reproduce the issue again but it seems to be gone now, maybe it was an error with my setup. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-09-06 11:00 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-09-02 13:17 [PATCH] qemu-xen: fix cpu hotplug Stefano Stabellini 2010-09-02 17:30 ` Ian Jackson 2010-09-03 6:28 ` Liu, Jinsong 2010-09-03 7:34 ` Christoph Egger 2010-09-03 7:47 ` Liu, Jinsong 2010-09-03 10:10 ` Stefano Stabellini 2010-09-03 17:27 ` Ian Jackson 2010-09-03 18:52 ` Liu, Jinsong 2010-09-06 11:00 ` Stefano Stabellini
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.