Andre Przywara
2011-Feb-04 14:01 UTC
[Xen-devel] [PATCH] xl: fix broken xl vcpu-list output
Hi,
# xl vcpu-list
hangs on my big box. The issue is an endless loop, where the algorithm
for printing the CPU affinity in a condensed way looks for a set bit in
a zero-byte:
for (i = 0; !(pcpumap & 1); ++i, pcpumap >>= 1)
Looking at the code I found that it is entirely broken if more than 8
CPUs are used. Beside that endless loop issue the output is totally
bogus except for the "any CPU" case, which is handled explicitly
earlier.
I tried to fix it, but the whole approach does not work if the outer
loops actually iterates (executing more than once).
I could not copy the Linux version of that algorithm due to licensing
incompatibilities and the Python version is not easily converted to C,
so I coded my own version from scratch. It is a bit verbose since it
iterates over bits instead of bytes, but more cleaner and survived some
unit-testing. I didn''t spend much time in optimizing it, though.
I put it in a separate function as I plan to use it later for printing
cpupool affinity in a similar way (a post 4.1.0 patch living in one of
my branches).
If you have a better implementation available, I can push it through my
automated unit test easily.
Please review and apply to Xen 4.1.0-rc.
Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Regards,
Andre.
--
Andre Przywara
AMD-Operating System Research Center (OSRC), Dresden, Germany
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
Stefano Stabellini
2011-Feb-04 15:16 UTC
Re: [Xen-devel] [PATCH] xl: fix broken xl vcpu-list output
On Fri, 4 Feb 2011, Andre Przywara wrote:> Hi, > > # xl vcpu-list > hangs on my big box. The issue is an endless loop, where the algorithm > for printing the CPU affinity in a condensed way looks for a set bit in > a zero-byte: > for (i = 0; !(pcpumap & 1); ++i, pcpumap >>= 1) > Looking at the code I found that it is entirely broken if more than 8 > CPUs are used. Beside that endless loop issue the output is totally > bogus except for the "any CPU" case, which is handled explicitly earlier. > I tried to fix it, but the whole approach does not work if the outer > loops actually iterates (executing more than once). > I could not copy the Linux version of that algorithm due to licensing > incompatibilities and the Python version is not easily converted to C, > so I coded my own version from scratch. It is a bit verbose since it > iterates over bits instead of bytes, but more cleaner and survived some > unit-testing. I didn''t spend much time in optimizing it, though. > I put it in a separate function as I plan to use it later for printing > cpupool affinity in a similar way (a post 4.1.0 patch living in one of > my branches). > > If you have a better implementation available, I can push it through my > automated unit test easily. > > Please review and apply to Xen 4.1.0-rc. > > Signed-off-by: Andre Przywara <andre.przywara@amd.com>Thank you very much for fixing this, also I like the implementation! Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2011-Feb-04 17:33 UTC
Re: [Xen-devel] [PATCH] xl: fix broken xl vcpu-list output
Stefano Stabellini writes ("Re: [Xen-devel] [PATCH] xl: fix broken xl
vcpu-list output"):> On Fri, 4 Feb 2011, Andre Przywara wrote:
> > Signed-off-by: Andre Przywara <andre.przywara@amd.com>
>
> Thank you very much for fixing this, also I like the implementation!
Indeed, well spotted and thanks. Applied.
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel