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.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to