From: Eric Blake <eblake@redhat.com>
To: Bharata B Rao <bharata@linux.vnet.ibm.com>, qemu-devel@nongnu.org
Cc: aik@ozlabs.ru, stewart@linux.vnet.ibm.com, agraf@suse.de
Subject: Re: [Qemu-devel] [PATCH v1] ppc: Force CPU threads count to be a power of 2.
Date: Tue, 04 Mar 2014 21:13:38 -0700 [thread overview]
Message-ID: <5316A472.6030402@redhat.com> (raw)
In-Reply-To: <1393990609-12361-1-git-send-email-bharata@linux.vnet.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 706 bytes --]
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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2014-03-05 4:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-05 3:36 [Qemu-devel] [PATCH v1] ppc: Force CPU threads count to be a power of 2 Bharata B Rao
2014-03-05 4:13 ` Eric Blake [this message]
2014-03-05 6:39 ` Bharata B Rao
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=5316A472.6030402@redhat.com \
--to=eblake@redhat.com \
--cc=agraf@suse.de \
--cc=aik@ozlabs.ru \
--cc=bharata@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=stewart@linux.vnet.ibm.com \
/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.