From: "Raslan, KarimAllah" <karahmed@amazon.de>
To: "mark.rutland@arm.com" <mark.rutland@arm.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"rkrcmar@redhat.com" <rkrcmar@redhat.com>,
"pbonzini@redhat.com" <pbonzini@redhat.com>
Subject: Re: [PATCH] KVM: Switch 'requests' to be 64-bit (explicitly)
Date: Tue, 10 Jul 2018 09:37:46 +0000 [thread overview]
Message-ID: <1531215466.10099.28.camel@amazon.de> (raw)
In-Reply-To: <20180705135139.orifhe4mag7p6zj3@lakrids.cambridge.arm.com>
On Thu, 2018-07-05 at 14:51 +0100, Mark Rutland wrote:
> On Sun, Apr 15, 2018 at 12:26:44AM +0200, KarimAllah Ahmed wrote:
> >
> > Switch 'requests' to be explicitly 64-bit and update BUILD_BUG_ON check to
> > use the size of "requests" instead of the hard-coded '32'.
> >
> > That gives us a bit more room again for arch-specific requests as we
> > already ran out of space for x86 due to the hard-coded check.
> >
> > Cc: Paolo Bonzini <pbonzini@redhat.com>
> > Cc: Radim Krčmář <rkrcmar@redhat.com>
> > Cc: kvm@vger.kernel.org
> > Cc: linux-kernel@vger.kernel.org
> > Signed-off-by: KarimAllah Ahmed <karahmed@amazon.de>
> > ---
> > include/linux/kvm_host.h | 10 +++++-----
> > 1 file changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> > index 6930c63..fe4f46b 100644
> > --- a/include/linux/kvm_host.h
> > +++ b/include/linux/kvm_host.h
> > @@ -129,7 +129,7 @@ static inline bool is_error_page(struct page *page)
> > #define KVM_REQUEST_ARCH_BASE 8
> >
> > #define KVM_ARCH_REQ_FLAGS(nr, flags) ({ \
> > - BUILD_BUG_ON((unsigned)(nr) >= 32 - KVM_REQUEST_ARCH_BASE); \
> > + BUILD_BUG_ON((unsigned)(nr) >= (sizeof(((struct kvm_vcpu *)0)->requests) * 8) - KVM_REQUEST_ARCH_BASE); \
> > (unsigned)(((nr) + KVM_REQUEST_ARCH_BASE) | (flags)); \
> > })
> > #define KVM_ARCH_REQ(nr) KVM_ARCH_REQ_FLAGS(nr, 0)
> > @@ -223,7 +223,7 @@ struct kvm_vcpu {
> > int vcpu_id;
> > int srcu_idx;
> > int mode;
> > - unsigned long requests;
> > + u64 requests;
>
> The usual thing to do for bitmaps is something like:
>
> #define KVM_REQUEST_NR (KVM_REQUEST_ARCH_BASE + KVM_REQUEST_ARCH_NR)
>
> unsigned long requests[BITS_TO_LONGS(NR_KVM_REQUESTS)];
>
> >
> > unsigned long guest_debug;
> >
> > int pre_pcpu;
> > @@ -1122,7 +1122,7 @@ static inline void kvm_make_request(int req, struct kvm_vcpu *vcpu)
> > * caller. Paired with the smp_mb__after_atomic in kvm_check_request.
> > */
> > smp_wmb();
> > - set_bit(req & KVM_REQUEST_MASK, &vcpu->requests);
> > + set_bit(req & KVM_REQUEST_MASK, (void *)&vcpu->requests);
>
> ... which wouldn't require a void cast to make the bit API functions
> happy (as these expect a pointer to the first unsigned long in the
> bitmap).
Ah, right! Good point.
Paolo,
Would you prefer to switch "requests" to a bitmap and
update kvm_request_pending to handle this?
>
> Thanks,
> Mark.
>
Amazon Development Center Germany GmbH
Berlin - Dresden - Aachen
main office: Krausenstr. 38, 10117 Berlin
Geschaeftsfuehrer: Dr. Ralf Herbrich, Christian Schlaeger
Ust-ID: DE289237879
Eingetragen am Amtsgericht Charlottenburg HRB 149173 B
prev parent reply other threads:[~2018-07-10 9:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-14 22:26 [PATCH] KVM: Switch 'requests' to be 64-bit (explicitly) KarimAllah Ahmed
2018-04-15 13:12 ` Raslan, KarimAllah
2018-04-16 16:26 ` Jim Mattson
2018-04-16 16:28 ` Paolo Bonzini
2018-05-22 15:42 ` Raslan, KarimAllah
2018-05-22 15:47 ` Paolo Bonzini
2018-07-05 12:22 ` Raslan, KarimAllah
2018-07-05 12:41 ` Paolo Bonzini
2018-07-05 13:51 ` Mark Rutland
2018-07-10 9:37 ` Raslan, KarimAllah [this message]
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=1531215466.10099.28.camel@amazon.de \
--to=karahmed@amazon.de \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox