Daniel Stekloff
2005-Oct-14 22:39 UTC
[Xen-devel] [PATCH] Bug #327 xentop/libxenstat vcpu fix
xentop will error when getting vcpu information if there are disabled vcpus for a domain at the end of the vcpu list. xentop merely goes through the num_vcpus list and calls DOM0_GETVCPUCONTEXT, it doesn''t check if the requested vcpu is disabled or enabled. DOM0_GETVCPUCONTEXT returns the next enabled vcpu in the list or an error if it doesn''t find one. xentop will then error. This is just a quick fix to check the vcpu_to_cpu[] map before requesting vcpu info. Signed-off-by: Daniel Stekloff <dsteklof@us.ibm.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2005-Oct-15 07:44 UTC
Re: [Xen-devel] [PATCH] Bug #327 xentop/libxenstat vcpu fix
On 14 Oct 2005, at 23:39, Daniel Stekloff wrote:> xentop will error when getting vcpu information if there are disabled > vcpus for a domain at the end of the vcpu list. xentop merely goes > through the num_vcpus list and calls DOM0_GETVCPUCONTEXT, it doesn''t > check if the requested vcpu is disabled or enabled. DOM0_GETVCPUCONTEXT > returns the next enabled vcpu in the list or an error if it doesn''t > find > one. xentop will then error. > > This is just a quick fix to check the vcpu_to_cpu[] map before > requesting vcpu info.GETVCPUCONTEXT no longer returns the next valid vcpu. It just fails if the specified vcpu is not currently online. Also, GETDOMAININFO no longer returns vcpu_to_cpu or cpumap arrays. I moved those into a new GETVCPUINFO call. I think you can use a simpler algorithm for finding all online VCPUs anyway. The tools will always try to ensure that VCPUs 0 to info.n_vcpu-1 are online, so you could just iterate over that. If you are worried about discontiguous online maps, just iterate over 0-(MAX_VIRT_CPUS-1) and silently drop the GETVCPUINFO failures (errno==ESRCH). -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Daniel Stekloff
2005-Oct-16 00:11 UTC
Re: [Xen-devel] [PATCH] Bug #327 xentop/libxenstat vcpu fix
On Saturday 15 October 2005 00:44, Keir Fraser wrote:> On 14 Oct 2005, at 23:39, Daniel Stekloff wrote: > > xentop will error when getting vcpu information if there are disabled > > vcpus for a domain at the end of the vcpu list. xentop merely goes > > through the num_vcpus list and calls DOM0_GETVCPUCONTEXT, it doesn''t > > check if the requested vcpu is disabled or enabled. DOM0_GETVCPUCONTEXT > > returns the next enabled vcpu in the list or an error if it doesn''t > > find > > one. xentop will then error. > > > > This is just a quick fix to check the vcpu_to_cpu[] map before > > requesting vcpu info. > > GETVCPUCONTEXT no longer returns the next valid vcpu. It just fails if > the specified vcpu is not currently online. Also, GETDOMAININFO no > longer returns vcpu_to_cpu or cpumap arrays. I moved those into a new > GETVCPUINFO call. > > I think you can use a simpler algorithm for finding all online VCPUs > anyway. The tools will always try to ensure that VCPUs 0 to > info.n_vcpu-1 are online, so you could just iterate over that. If you > are worried about discontiguous online maps, just iterate over > 0-(MAX_VIRT_CPUS-1) and silently drop the GETVCPUINFO failures > (errno==ESRCH).Ok.. so xm top/xentop is no longer broken - provided you don''t care about out of order vcpus. xm vcpu-list is broken. xm vcpu-enable will only enable vcpus in order. I can''t, for instance, enable vcpu 3 if vcpu 2 isn''t enabled. xm vcpu-enable silently fails. So stupid question: Do we no longer have or care about dicontiguous online maps? Or, do the tools just need to catch up with your changes? I''m curious because xentop just takes the number of vcpus from domaininfo and calls GETVCPUCONTEXT starting with 0 and going until num-1. I just tried this on a 4 vcpu dom. I disabled vcpus 1 and 2, leaving 0 and 3 active. xentop worked fine but reported those vcpus as 0 and 1. GETVCPUCONTEXT returned the as 0 and 1. Is this the way you want it to work? If so, I''ll close the bug. Thanks, Dan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2005-Oct-16 08:38 UTC
Re: [Xen-devel] [PATCH] Bug #327 xentop/libxenstat vcpu fix
On 16 Oct 2005, at 01:11, Daniel Stekloff wrote:> Ok.. so xm top/xentop is no longer broken - provided you don''t care > about out > of order vcpus.This doesn''t make sense..... see below.> xm vcpu-list is broken.Yes, Ewan is working on a fix for this.> xm vcpu-enable will only enable vcpus in order. I can''t, for > instance, enable > vcpu 3 if vcpu 2 isn''t enabled. xm vcpu-enable silently fails.This is currently supposed to work. It looks as though the ''xm vcpu-enable/disable'' commands are still not 100% robust. :-( Longer term, allowing an admin to take down specific vcpus probably isn''t all that useful, so we may simplify the xm interface.> Do we no longer have or care about dicontiguous online maps? Or, do > the tools > just need to catch up with your changes?Although we don''t care about exposing them via vcpu-enable/disable, I think we ought to handle them. A user logged into domU can still take down non-contiguous VCPUs, even if that functionality isn''t exported via the xm interface.> I''m curious because xentop just takes the number of vcpus from > domaininfo and > calls GETVCPUCONTEXT starting with 0 and going until num-1. I just > tried this > on a 4 vcpu dom. I disabled vcpus 1 and 2, leaving 0 and 3 active. > xentop > worked fine but reported those vcpus as 0 and 1. GETVCPUCONTEXT > returned the > as 0 and 1. Is this the way you want it to work?That is definitely not how GETVCPUCONTEXT works. It won''t renumber vcpus under your feet -- if you ask for vcpu3 then it is vcpu3''s information that you will get. One thing to bear in mind: GETVCPUCONTEXT will return info even about vcpus that are not currently online. To check for online status you need to use GETVCPUINFO and check the online field that is returned. Perhaps you iterated from 0 to info.n_vcpu-1? The count from GETDOMAININFO only counts online vcpus, but doesn;t tell you which vcpus are online. We could also add a count ''max_vcpu'' or easier: just iterate 0 to MAX_VIRT_CPU-1. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Daniel Stekloff
2005-Oct-16 17:01 UTC
Re: [Xen-devel] [PATCH] Bug #327 xentop/libxenstat vcpu fix
On Sunday 16 October 2005 01:38, Keir Fraser wrote:> On 16 Oct 2005, at 01:11, Daniel Stekloff wrote: > > Ok.. so xm top/xentop is no longer broken - provided you don''t care > > about out > > of order vcpus. > > This doesn''t make sense..... see below. > > > xm vcpu-list is broken. > > Yes, Ewan is working on a fix for this. > > > xm vcpu-enable will only enable vcpus in order. I can''t, for > > instance, enable > > vcpu 3 if vcpu 2 isn''t enabled. xm vcpu-enable silently fails. > > This is currently supposed to work. It looks as though the ''xm > vcpu-enable/disable'' commands are still not 100% robust. :-( Longer > term, allowing an admin to take down specific vcpus probably isn''t all > that useful, so we may simplify the xm interface. > > > Do we no longer have or care about dicontiguous online maps? Or, do > > the tools > > just need to catch up with your changes? > > Although we don''t care about exposing them via vcpu-enable/disable, I > think we ought to handle them. A user logged into domU can still take > down non-contiguous VCPUs, even if that functionality isn''t exported > via the xm interface. > > > I''m curious because xentop just takes the number of vcpus from > > domaininfo and > > calls GETVCPUCONTEXT starting with 0 and going until num-1. I just > > tried this > > on a 4 vcpu dom. I disabled vcpus 1 and 2, leaving 0 and 3 active. > > xentop > > worked fine but reported those vcpus as 0 and 1. GETVCPUCONTEXT > > returned the > > as 0 and 1. Is this the way you want it to work? > > That is definitely not how GETVCPUCONTEXT works. It won''t renumber > vcpus under your feet -- if you ask for vcpu3 then it is vcpu3''s > information that you will get. > > One thing to bear in mind: GETVCPUCONTEXT will return info even about > vcpus that are not currently online. To check for online status you > need to use GETVCPUINFO and check the online field that is returned. > > Perhaps you iterated from 0 to info.n_vcpu-1? The count from > GETDOMAININFO only counts online vcpus, but doesn;t tell you which > vcpus are online. We could also add a count ''max_vcpu'' or easier: just > iterate 0 to MAX_VIRT_CPU-1. >Sorry, I should have looked at the changes more closely, I didn''t realize: 1) getdomaininfo returns number of active cpus 2) getvcpucontext will now return info about vpcus that aren''t active. I can certainly change xentop to iterate over a domain''s vcpus bounded by MAX_VIRT_CPU and number of active vcpus, calling getvcpuinfo along the way. It had been using the info.n_vcpu as a bound. Just as a suggestion, it might be nicer for tools to know max_vcpus rather than having to iterate over the entire possible list when they want to know how many (enabled and disabled) vcpus a domain has. Say, if someone wanted to know how may vcpus have been configured rather than checking the config file. It also may be more efficient - less GETVCPUINFO calls. Thanks for your help. Dan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel