2023-03-15 19:11:36

by Sean Christopherson

[permalink] [raw]
Subject: [PATCH 0/2] KVM: x86: Fix kvm/queue breakage on clang

Fix clang build errors for patches sitting kvm/queue. Ideally, these
fixes will be squashed before the buggy commits make their way to kvm/next.
If you do fixup kvm/queue, the VMX commit also has a bad SOB chain; Jim
either needs to be listed as the author or his SOB needs to be deleted.

Sean Christopherson (2):
KVM: VMX: Drop unprotected-by-braces variable declaration in
case-statement
KVM: SVM: Drop unprotected-by-braces variable declaration in
case-statement

arch/x86/kvm/svm/svm.c | 5 ++---
arch/x86/kvm/vmx/vmx.c | 4 +---
2 files changed, 3 insertions(+), 6 deletions(-)


base-commit: 95b9779c1758f03cf494e8550d6249a40089ed1c
--
2.40.0.rc2.332.ga46443480c-goog



2023-03-15 19:11:39

by Sean Christopherson

[permalink] [raw]
Subject: [PATCH 1/2] KVM: VMX: Drop unprotected-by-braces variable declaration in case-statement

Remove the intermediate "guest_flush_l1d" boolean to fix a build error on
clang due to the variable being declared inside a case-statement without
curly braces to create a proper code block.

Fixes: c7ed946b95cb ("kvm: vmx: Add IA32_FLUSH_CMD guest support")
Reported-by: kernel test robot <[email protected]>
Link: https://lore.kernel.org/oe-kbuild-all/[email protected]
Cc: Emanuele Giuseppe Esposito <[email protected]>
Signed-off-by: Sean Christopherson <[email protected]>
---
arch/x86/kvm/vmx/vmx.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index c63f6c786eb1..d7bf14abdba1 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -2325,10 +2325,8 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
X86_FEATURE_IBPB);
break;
case MSR_IA32_FLUSH_CMD:
- bool guest_flush_l1d = guest_cpuid_has(vcpu,
- X86_FEATURE_FLUSH_L1D);
ret = vmx_set_msr_ia32_cmd(vcpu, msr_info,
- guest_flush_l1d,
+ guest_cpuid_has(vcpu, X86_FEATURE_FLUSH_L1D),
L1D_FLUSH,
X86_FEATURE_FLUSH_L1D);
break;
--
2.40.0.rc2.332.ga46443480c-goog


2023-03-15 19:11:42

by Sean Christopherson

[permalink] [raw]
Subject: [PATCH 2/2] KVM: SVM: Drop unprotected-by-braces variable declaration in case-statement

Remove the intermediate "guest_flush_l1d" boolean to fix a build error on
clang due to the variable being declared inside a case-statement without
curly braces to create a proper code block.

Fixes: cfc1f129df06 ("kvm: svm: Add IA32_FLUSH_CMD guest support")
Cc: Emanuele Giuseppe Esposito <[email protected]>
Signed-off-by: Sean Christopherson <[email protected]>
---
arch/x86/kvm/svm/svm.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index 2780254d4362..70183d2271b5 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -2970,9 +2970,8 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr)
PRED_CMD_IBPB, X86_FEATURE_IBPB);
break;
case MSR_IA32_FLUSH_CMD:
- bool guest_flush_l1d = guest_cpuid_has(vcpu,
- X86_FEATURE_FLUSH_L1D);
- r = svm_set_msr_ia32_cmd(vcpu, msr, guest_flush_l1d,
+ r = svm_set_msr_ia32_cmd(vcpu, msr,
+ guest_cpuid_has(vcpu, X86_FEATURE_FLUSH_L1D),
L1D_FLUSH, X86_FEATURE_FLUSH_L1D);
break;
case MSR_AMD64_VIRT_SPEC_CTRL:
--
2.40.0.rc2.332.ga46443480c-goog


Subject: Re: [PATCH 0/2] KVM: x86: Fix kvm/queue breakage on clang



Am 15/03/2023 um 20:11 schrieb Sean Christopherson:
> Fix clang build errors for patches sitting kvm/queue. Ideally, these
> fixes will be squashed before the buggy commits make their way to kvm/next.
> If you do fixup kvm/queue, the VMX commit also has a bad SOB chain; Jim
> either needs to be listed as the author or his SOB needs to be deleted.
>
> Sean Christopherson (2):
> KVM: VMX: Drop unprotected-by-braces variable declaration in
> case-statement
> KVM: SVM: Drop unprotected-by-braces variable declaration in
> case-statement
>
> arch/x86/kvm/svm/svm.c | 5 ++---
> arch/x86/kvm/vmx/vmx.c | 4 +---
> 2 files changed, 3 insertions(+), 6 deletions(-)
>
>
> base-commit: 95b9779c1758f03cf494e8550d6249a40089ed1c

Note to self: compile patches also with clang, since gcc didn't complain
about missing brackets in a switch case.

Reviewed-by: Emanuele Giuseppe Esposito <[email protected]>


2023-03-16 14:27:22

by Paolo Bonzini

[permalink] [raw]
Subject: Re: [PATCH 0/2] KVM: x86: Fix kvm/queue breakage on clang

On 3/15/23 20:11, Sean Christopherson wrote:
> Fix clang build errors for patches sitting kvm/queue. Ideally, these
> fixes will be squashed before the buggy commits make their way to kvm/next.
> If you do fixup kvm/queue, the VMX commit also has a bad SOB chain; Jim
> either needs to be listed as the author or his SOB needs to be deleted.

I added it as Co-developed-by and squashed the patches.

Paolo