Messages in this thread | | | From | Paolo Bonzini <> | Subject | Re: [PATCH 3/4] KVM: VMX: Macrofy the MSR bitmap getters and setters | Date | Wed, 17 Mar 2021 14:15:07 +0100 |
| |
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...
> +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.
Still, I think gluing the variadic arguments with ## is a bit too much. 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.
Thanks,
Paolo
| |