[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] qemu will core dump with "-smp 254, sockets=2,
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH] qemu will core dump with "-smp 254, sockets=2, cores=3, threads=2" |
Date: |
Mon, 16 Dec 2013 07:43:47 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 |
On 12/14/2013 10:21 AM, lijun wrote:
> Hi all,
> As qemu core dump cause by "sockets=2,cores=3,threads=2", so add
> this patch to check whether cores and threads is a power of 2.
> +/**
> + * This function will return whether @num is power of 2.
> + *
> + * Returns: 1 indicate @num is power of 2, 0 indicate @num is not.
> + */
> +static int is_2_power(int num)
> +{
> + if (num < 0 || num > 256)
> + return 1;
> +
> + return !(num & (num - 1));
> +}
Please don't reinvent qemu-common.h's is_power_of_2. Furthermore, your
function is more than just a power-of-2 check, it is also a range check.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH] qemu will core dump with "-smp 254, sockets=2, cores=3, threads=2", lijun, 2013/12/12
- Re: [Qemu-devel] [PATCH] qemu will core dump with "-smp 254, sockets=2, cores=3, threads=2", lijun, 2013/12/14
- Re: [Qemu-devel] [PATCH] qemu will core dump with "-smp 254, sockets=2, cores=3, threads=2", Eduardo Habkost, 2013/12/16