From: Eric Blake <eblake@redhat.com>
To: lijun <junmuzi@gmail.com>, qemu-devel@nongnu.org
Cc: aliguori@amazon.com
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 [thread overview]
Message-ID: <52AF11A3.6060402@redhat.com> (raw)
In-Reply-To: <52AC939E.9060706@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 747 bytes --]
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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 621 bytes --]
next prev parent reply other threads:[~2013-12-16 14:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-12 18:10 [Qemu-devel] [PATCH] qemu will core dump with "-smp 254, sockets=2, cores=3, threads=2" lijun
2013-12-14 17:21 ` lijun
2013-12-14 19:10 ` Peter Maydell
2013-12-16 14:43 ` Eric Blake [this message]
2013-12-16 16:55 ` Eduardo Habkost
-- strict thread matches above, loose matches on Subject: below --
2013-12-16 6:18 jun muzi
2013-12-16 7:54 jun muzi
2013-12-16 16:53 ` Eduardo Habkost
2013-12-17 15:16 [Qemu-devel] [PATCH] qemu will core dump with "-smp 254, , " lijun
2013-12-17 15:51 ` Eduardo Habkost
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52AF11A3.6060402@redhat.com \
--to=eblake@redhat.com \
--cc=aliguori@amazon.com \
--cc=junmuzi@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.