qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v1] ppc: Force CPU threads count to be a power o


From: Bharata B Rao
Subject: Re: [Qemu-devel] [PATCH v1] ppc: Force CPU threads count to be a power of 2.
Date: Wed, 5 Mar 2014 12:09:19 +0530
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Mar 04, 2014 at 09:13:38PM -0700, Eric Blake wrote:
> On 03/04/2014 08:36 PM, Bharata B Rao wrote:
> > PowerPC kernel expects the number of SMT threads in a core to be a power
> > of 2. Since QEMU doesn't enforce this, it leads to an early guest kernel
> > crash if invalid threads count is specified.
> > 
> > Prevent this crash and make it a graceful exit from QEMU itself by
> > validating the user supplied threads count.
> > 
> 
> >  
> > +#include <math.h>
> 
> >      }
> > +    threads_shift = log2(smp_threads);
> 
> Overkill.  qemu-common.h gives you is_power_of_2() that uses just
> integer math rather than dragging in floating-point overhead of libm.

Nice. Using is_power_of_2() in v2.

Regards,
Bharata.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]