From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Alexander Graf <graf@amazon.com>,
Yuan Yao <yaoyuan0329os@gmail.com>
Subject: Re: [PATCH 3/4] KVM: VMX: Macrofy the MSR bitmap getters and setters
Date: Wed, 17 Mar 2021 09:39:12 -0700 [thread overview]
Message-ID: <YFIwsP9gF19MyCm7@google.com> (raw)
In-Reply-To: <f4934b3e-4d5f-a242-e14f-ad5841079349@redhat.com>
On Wed, Mar 17, 2021, Paolo Bonzini wrote:
> On 16/03/21 19:44, Sean Christopherson wrote:
> > + return (ret)true; \
>
> I'm not sure if (void)true is amazing or disgusting, but anyway...
Definitely both.
> > +BUILD_VMX_MSR_BITMAP_HELPER(bool, test, read)
> > +BUILD_VMX_MSR_BITMAP_HELPER(bool, test, write)
> > +BUILD_VMX_MSR_BITMAP_HELPER(void, clear, read, __)
> > +BUILD_VMX_MSR_BITMAP_HELPER(void, clear, write, __)
> > +BUILD_VMX_MSR_BITMAP_HELPER(void, set, read, __)
> > +BUILD_VMX_MSR_BITMAP_HELPER(void, set, write, __)
>
> ... I guess we have an armed truce where you let me do my bit manipulation
> magic and I let you do your macro magic.
Ha, mutually assured destruction.
> Still, I think gluing the variadic arguments with ## is a bit too much.
Heh, I don't disagree at all. Honestly, I was surprised it worked, and couldn't
resist throwing it in because it's so absurd.
> This would be slightly less mysterious:
>
> +BUILD_VMX_MSR_BITMAP_HELPER(bool, vmx_test_msr_bitmap_, read, test_bit)
> +BUILD_VMX_MSR_BITMAP_HELPER(bool, vmx_test_msr_bitmap_, write, test_bit)
> +BUILD_VMX_MSR_BITMAP_HELPER(void, vmx_clear_msr_bitmap_, read, __clear_bit)
> +BUILD_VMX_MSR_BITMAP_HELPER(void, vmx_clear_msr_bitmap_, write,
> __clear_bit)
> +BUILD_VMX_MSR_BITMAP_HELPER(void, vmx_set_msr_bitmap_, read, __set_bit)
> +BUILD_VMX_MSR_BITMAP_HELPER(void, vmx_set_msr_bitmap_, write, __set_bit)
>
> And I also wonder if we really need to expand all six functions one at a
> time. You could remove the third argument and VMX_MSR_BITMAP_BASE_*, at the
> cost of expanding the inline functions' body twice in
> BUILD_VMX_MSR_BITMAP_HELPER.
I'll play around with the macros to see if I can make them less obnoxious. I
found it easier to differentiate between the read/write offset and the high/low
offset by building them one at a time. I'll see if I can find a compromise.
next prev parent reply other threads:[~2021-03-17 16:40 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-16 18:44 [PATCH 0/4] KVM: x86: MSR filtering and related fixes Sean Christopherson
2021-03-16 18:44 ` [PATCH 1/4] KVM: x86: Protect userspace MSR filter with SRCU, and set atomically-ish Sean Christopherson
2021-03-17 13:15 ` Paolo Bonzini
2021-03-17 19:29 ` Alexander Graf
2021-03-16 18:44 ` [PATCH 2/4] KVM: nVMX: Handle dynamic MSR intercept toggling Sean Christopherson
2021-03-17 13:17 ` Paolo Bonzini
2021-03-17 16:50 ` Sean Christopherson
2021-03-17 17:22 ` Paolo Bonzini
2021-03-17 17:24 ` Sean Christopherson
2021-03-17 20:04 ` Sean Christopherson
2021-03-16 18:44 ` [PATCH 3/4] KVM: VMX: Macrofy the MSR bitmap getters and setters Sean Christopherson
2021-03-17 13:15 ` Paolo Bonzini
2021-03-17 16:39 ` Sean Christopherson [this message]
2021-03-16 18:44 ` [PATCH 4/4] KVM: nVMX: Clean up x2APIC MSR handling for L2 Sean Christopherson
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=YFIwsP9gF19MyCm7@google.com \
--to=seanjc@google.com \
--cc=graf@amazon.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--cc=yaoyuan0329os@gmail.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