From: Paolo Bonzini <pbonzini@redhat.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: KVM <kvm@vger.kernel.org>,
linux-s390 <linux-s390@vger.kernel.org>,
Cornelia Huck <cornelia.huck@de.ibm.com>,
Jens Freimann <jfrei@linux.vnet.ibm.com>
Subject: Re: [PULL 2/4] KVM: s390: fix calculation of idle_mask array size
Date: Tue, 25 Mar 2014 14:55:38 +0100 [thread overview]
Message-ID: <53318ADA.2080008@redhat.com> (raw)
In-Reply-To: <1395754523-43697-3-git-send-email-borntraeger@de.ibm.com>
Il 25/03/2014 14:35, Christian Borntraeger ha scritto:
> From: Jens Freimann <jfrei@linux.vnet.ibm.com>
>
> We need BITS_TO_LONGS, not sizeof(long) to calculate
> the correct size.
>
> idle_mask is a bitmask, each bit representing the state
> of a cpu. The desired outcome is an array of unsigned long
> fields that can fit KVM_MAX_VCPUS bits. We should not use
> sizeof(long) which returnes the size in bytes, but BITS_TO_LONGS
>
> Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
> ---
> arch/s390/include/asm/kvm_host.h | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
> index 734d302..c36cd35 100644
> --- a/arch/s390/include/asm/kvm_host.h
> +++ b/arch/s390/include/asm/kvm_host.h
> @@ -213,8 +213,7 @@ struct kvm_s390_float_interrupt {
> struct list_head list;
> atomic_t active;
> int next_rr_cpu;
> - unsigned long idle_mask[(KVM_MAX_VCPUS + sizeof(long) - 1)
> - / sizeof(long)];
> + unsigned long idle_mask[BITS_TO_LONGS(KVM_MAX_VCPUS)];
> unsigned int irq_count;
> };
>
>
Perhaps you can also use DECLARE_BITMAP, since you use
find_first_bit/set_bit/clear_bit on idle_mask.
Paolo
next prev parent reply other threads:[~2014-03-25 13:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-25 13:35 [PULL 0/4] KVM: s390: last fixes for next merge window Christian Borntraeger
2014-03-25 13:35 ` [PULL 1/4] KVM: s390: randomize sca address Christian Borntraeger
2014-03-25 13:53 ` Paolo Bonzini
2014-03-25 14:04 ` Christian Borntraeger
2014-03-25 13:35 ` [PULL 2/4] KVM: s390: fix calculation of idle_mask array size Christian Borntraeger
2014-03-25 13:55 ` Paolo Bonzini [this message]
2014-03-25 13:35 ` [PULL 3/4] KVM: s390: Fix possible memory leak in SIGP functions Christian Borntraeger
2014-03-25 14:02 ` Paolo Bonzini
2014-03-25 14:39 ` Christian Borntraeger
2014-03-25 14:43 ` Paolo Bonzini
2014-03-25 13:35 ` [PULL 4/4] KVM: s390: clear local interrupts at cpu initial reset Christian Borntraeger
2014-03-25 13:56 ` Paolo Bonzini
2014-03-25 14:18 ` Christian Borntraeger
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=53318ADA.2080008@redhat.com \
--to=pbonzini@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=jfrei@linux.vnet.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox