Ryan Harper
2005-Nov-08 23:21 UTC
[Xen-devel] [PATCH 1/2][RESEND] xend: fix vcpu related items
Resending, rediffed against changeset: 7701:abbe3df33774 This patch fixes a number of vcpu related issues. 1. xm vcpu-list now shows info for all vcpus by using info[''max_vcpu_id'']+1 as end of the range to query vcpu_info. 2. Add new vcpu fields, online_vcpus, max_vcpu_id to XendDomainInfo.sxpr() 3. Remove filter_cpump() which isn''t needed now that the per vcpu cpumap field is correct. 4. Update xm/main.py to use online_vcpus as the number vcpus to display in list. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 ryanh@us.ibm.com diffstat output: xend/XendDomainInfo.py | 15 +++++++-------- xm/main.py | 14 +++++++------- 2 files changed, 14 insertions(+), 15 deletions(-) Signed-off-by: Ryan Harper <ryanh@us.ibm.com> --- # HG changeset patch # User rharper@localhost.localdomain # Node ID 8780650bc95865aeea69f89511ce9b1be9dad82c # Parent 7b01938105f9090d46e6e27e0a8d218d4c0be93c fixup_vcpu_related_items. diff -r 7b01938105f9 -r 8780650bc958 tools/python/xen/xend/XendDomainInfo.py --- a/tools/python/xen/xend/XendDomainInfo.py Tue Nov 8 22:36:34 2005 +++ b/tools/python/xen/xend/XendDomainInfo.py Tue Nov 8 22:37:05 2005 @@ -428,8 +428,10 @@ defaultInfo(''cpu'', lambda: None) defaultInfo(''cpu_weight'', lambda: 1.0) defaultInfo(''vcpus'', lambda: int(1)) + defaultInfo(''online_vcpus'', lambda: self.info[''vcpus'']) self.info[''vcpus''] = int(self.info[''vcpus'']) + defaultInfo(''max_vcpu_id'', lambda: self.info[''vcpus'']-1) defaultInfo(''vcpu_avail'', lambda: (1 << self.info[''vcpus'']) - 1) defaultInfo(''bootloader'', lambda: None) @@ -975,6 +977,7 @@ if self.infoIsSet(''cpu_time''): sxpr.append([''cpu_time'', self.info[''cpu_time'']/1e9]) sxpr.append([''vcpus'', self.info[''vcpus'']]) + sxpr.append([''online_vcpus'', self.info[''online_vcpus'']]) if self.infoIsSet(''start_time''): up_time = time.time() - self.info[''start_time''] @@ -991,16 +994,13 @@ def getVCPUInfo(self): try: - def filter_cpumap(map, max): - return filter(lambda x: x >= 0, map[0:max]) - # We include the domain name and ID, to help xm. sxpr = [''domain'', [''domid'', self.domid], [''name'', self.info[''name'']], - [''vcpu_count'', self.info[''vcpus'']]] - - for i in range(0, self.info[''vcpus'']): + [''vcpu_count'', self.info[''online_vcpus'']]] + + for i in range(0, self.info[''max_vcpu_id'']+1): info = xc.vcpu_getinfo(self.domid, i) sxpr.append([''vcpu'', @@ -1010,8 +1010,7 @@ [''running'', info[''running'']], [''cpu_time'', info[''cpu_time''] / 1e9], [''cpu'', info[''cpu'']], - [''cpumap'', filter_cpumap(info[''cpumap''], - self.info[''vcpus''])]]) + [''cpumap'', info[''cpumap'']]]) return sxpr diff -r 7b01938105f9 -r 8780650bc958 tools/python/xen/xm/main.py --- a/tools/python/xen/xm/main.py Tue Nov 8 22:36:34 2005 +++ b/tools/python/xen/xm/main.py Tue Nov 8 22:37:05 2005 @@ -260,13 +260,13 @@ return t(sxp.child_value(info, n, d)) return { - ''dom'' : get_info(''domid'', int, -1), - ''name'' : get_info(''name'', str, ''??''), - ''mem'' : get_info(''memory'', int, 0), - ''vcpus'' : get_info(''vcpus'', int, 0), - ''state'' : get_info(''state'', str, ''??''), - ''cpu_time'' : get_info(''cpu_time'', float, 0), - ''ssidref'' : get_info(''ssidref'', int, 0), + ''dom'' : get_info(''domid'', int, -1), + ''name'' : get_info(''name'', str, ''??''), + ''mem'' : get_info(''memory'', int, 0), + ''vcpus'' : get_info(''online_vcpus'', int, 0), + ''state'' : get_info(''state'', str, ''??''), + ''cpu_time'' : get_info(''cpu_time'', float, 0), + ''ssidref'' : get_info(''ssidref'', int, 0), } _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ewan Mellor
2005-Nov-09 14:22 UTC
Re: [Xen-devel] [PATCH 1/2][RESEND] xend: fix vcpu related items
On Tue, Nov 08, 2005 at 05:21:32PM -0600, Ryan Harper wrote:> Resending, rediffed against changeset: 7701:abbe3df33774Thanks for your resends, Ryan. Your two patches are in my tree at the moment, and I''m testing them. There are now so many fields with "cpu" in the name that I was looking over it wondering if there were a few we could lose now. Perhaps we could review them on the list. I count vcpus the number of virtual CPUs this domain is configured to use. vcpu_avail VCPU availability bitmap vcpu_count same as vcpus, just in the getVCPUInfo sxpr cpumap VCPU-to-CPU bitmap list cpu configuration pinning VCPU 0 to the specified physical CPU max_vcpu_id online_vcpus as well as the obvious cpu_time cpu_weight So could you explain the semantics of max_vcpu_id and online_vcpus, compared with vcpus and vcpu_avail in particular? I''m afraid I''ve lost track. Ewan. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ryan Harper
2005-Nov-09 16:21 UTC
Re: [Xen-devel] [PATCH 1/2][RESEND] xend: fix vcpu related items
* Ewan Mellor <ewan@xensource.com> [2005-11-09 08:23]:> On Tue, Nov 08, 2005 at 05:21:32PM -0600, Ryan Harper wrote: > > > Resending, rediffed against changeset: 7701:abbe3df33774 > > Thanks for your resends, Ryan. Your two patches are in my tree at the moment, > and I''m testing them.Great!> > There are now so many fields with "cpu" in the name that I was looking over it > wondering if there were a few we could lose now. Perhaps we could review them > on the list.Yeah, as I was wading through this I was thinking the same thing.> > I count > > vcpus the number of virtual CPUs this domain is configured to use. > vcpu_avail VCPU availability bitmap > vcpu_count same as vcpus, just in the getVCPUInfo sxpr > cpumap VCPU-to-CPU bitmap list > cpu configuration pinning VCPU 0 to the specified physical CPU > max_vcpu_id > online_vcpus > > as well as the obvious > > cpu_time > cpu_weight > > So could you explain the semantics of max_vcpu_id and online_vcpus, compared > with vcpus and vcpu_avail in particular? I''m afraid I''ve lost track.''max_vcpu_id'' is the highest id of a vcpu that has been created/initialized. So, for instance, after booting dom0 SMP on a 4 way, the hypervisor''s domain builder creates one VCPU for each physical cpu leaving max_vcpu_id=3. ''online_vcpus'' is a count of the number of vcpus that can be scheduled in a domain (they are runnable, that is VCPUF_down is not set, which happens when we disable/unplug vcpus). ''vcpus'' is the value parsed from a domain''s config file, ie, the number of vcpus you want your domain to have. ''vcpu_avail'' is a bitmap (probably should convert it to a list since we have been tossing the C-ism out) indicating which vcpus are available (runnable, enabled, etc.). Currently, vcpu_avail is derived from ''vcpus'', (vcpu_avail = (1 << vcpus) - 1) and assumes that all possible vcpus are available. In some cases, we don''t have a configuration file which would have the ''vcpus'' element (dom0 is one such example). Such domains are usually running prior to starting xend in which case the info dict returned from xc_domain_getinfo contains the run-time variables ''online_vcpus'' and ''max_vcpu_id''. We can use those values to calculate vcpu_avail. Actually, rather that using max_vcpu_id+1 to calculate vcpu_avail for running domains as I did in my patch we should build it with a loop check each vcpu if it is up or not: for v in range(0,info[''max_vcpu_id'']+1): vinfo = xc.vcpu_getinfo(domid,v) if vinfo[''online'']: vcpu_avail |= 1 << v One of the difficulties we have is that is is not always clear in the code where we want configuration information (ie, how many vcpus did you want your domain to have) or runtime info (which vcpus in this domain are online right now). I think vcpu_count is just one of those cases, one could want access to either type but we only have one method and if you are not aware of what that means, then we are possibly introducing bugs. Personally I''d like to see a separate dict for config and runtime info config = parseConfig(c) # only filled with values from config file info = dom_get(domid) # current runtime info as returned from HV Possibly too late in the game for this sort of rework. -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 ryanh@us.ibm.com _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ryan Harper
2005-Nov-14 18:59 UTC
Re: [Xen-devel] [PATCH 1/2][RESEND] xend: fix vcpu related items
* Ewan Mellor <ewan@xensource.com> [2005-11-09 08:24]:> On Tue, Nov 08, 2005 at 05:21:32PM -0600, Ryan Harper wrote: > > > Resending, rediffed against changeset: 7701:abbe3df33774 > > Thanks for your resends, Ryan. Your two patches are in my tree at the moment, > and I''m testing them.Are these patches still pending? Anything I can do to help test? -- Ryan Harper Software Engineer; Linux Technology Center IBM Corp., Austin, Tx (512) 838-9253 T/L: 678-9253 ryanh@us.ibm.com _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ewan Mellor
2005-Nov-15 16:31 UTC
Re: [Xen-devel] [PATCH 1/2][RESEND] xend: fix vcpu related items
On Tue, Nov 08, 2005 at 05:21:32PM -0600, Ryan Harper wrote:> Resending, rediffed against changeset: 7701:abbe3df33774 > > This patch fixes a number of vcpu related issues. > > 1. xm vcpu-list now shows info for all vcpus by using > info[''max_vcpu_id'']+1 as end of the range to query > vcpu_info. > 2. Add new vcpu fields, online_vcpus, max_vcpu_id to > XendDomainInfo.sxpr() > 3. Remove filter_cpump() which isn''t needed now that > the per vcpu cpumap field is correct. > 4. Update xm/main.py to use online_vcpus as the number > vcpus to display in list.Applied. Ewan. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ewan Mellor
2005-Nov-15 16:32 UTC
Re: [Xen-devel] [PATCH 1/2][RESEND] xend: fix vcpu related items
On Mon, Nov 14, 2005 at 12:59:09PM -0600, Ryan Harper wrote:> * Ewan Mellor <ewan@xensource.com> [2005-11-09 08:24]: > > On Tue, Nov 08, 2005 at 05:21:32PM -0600, Ryan Harper wrote: > > > > > Resending, rediffed against changeset: 7701:abbe3df33774 > > > > Thanks for your resends, Ryan. Your two patches are in my tree at the moment, > > and I''m testing them. > > Are these patches still pending? Anything I can do to help test?I''ve put them in now. As we''ve discussed, I think that this code could still do with some cleaning up, but for now, your patches are in, and we can worry about clean-up later. Thanks for your work, Ewan. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel