* [PATCH] KVM: SVM: Fix build error when using -Werror=unused-but-set-variable
@ 2023-10-02 18:28 Tom Lendacky
2023-10-02 19:01 ` Sean Christopherson
2023-10-12 15:09 ` Paolo Bonzini
0 siblings, 2 replies; 3+ messages in thread
From: Tom Lendacky @ 2023-10-02 18:28 UTC (permalink / raw)
To: kvm, linux-kernel, x86
Cc: Paolo Bonzini, Sean Christopherson, Borislav Petkov, Dave Hansen,
Ingo Molnar, Thomas Gleixner
Commit 916e3e5f26ab ("KVM: SVM: Do not use user return MSR support for
virtualized TSC_AUX") introduced a local variable used for the rdmsr()
function for the high 32-bits of the MSR value. This variable is not used
after being set and triggers a warning or error, when treating warnings
as errors, when the unused-but-set-variable flag is set. Mark this
variable as __maybe_unused to fix this.
Fixes: 916e3e5f26ab ("KVM: SVM: Do not use user return MSR support for virtualized TSC_AUX")
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
arch/x86/kvm/svm/svm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index 9507df93f410..4c917c74a4d3 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -691,7 +691,7 @@ static int svm_hardware_enable(void)
*/
if (boot_cpu_has(X86_FEATURE_V_TSC_AUX)) {
struct sev_es_save_area *hostsa;
- u32 msr_hi;
+ u32 __maybe_unused msr_hi;
hostsa = (struct sev_es_save_area *)(page_address(sd->save_area) + 0x400);
--
2.41.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] KVM: SVM: Fix build error when using -Werror=unused-but-set-variable
2023-10-02 18:28 [PATCH] KVM: SVM: Fix build error when using -Werror=unused-but-set-variable Tom Lendacky
@ 2023-10-02 19:01 ` Sean Christopherson
2023-10-12 15:09 ` Paolo Bonzini
1 sibling, 0 replies; 3+ messages in thread
From: Sean Christopherson @ 2023-10-02 19:01 UTC (permalink / raw)
To: Tom Lendacky
Cc: kvm, linux-kernel, x86, Paolo Bonzini, Borislav Petkov,
Dave Hansen, Ingo Molnar, Thomas Gleixner
On Mon, Oct 02, 2023, Tom Lendacky wrote:
> Commit 916e3e5f26ab ("KVM: SVM: Do not use user return MSR support for
> virtualized TSC_AUX") introduced a local variable used for the rdmsr()
> function for the high 32-bits of the MSR value. This variable is not used
> after being set and triggers a warning or error, when treating warnings
> as errors, when the unused-but-set-variable flag is set. Mark this
> variable as __maybe_unused to fix this.
>
> Fixes: 916e3e5f26ab ("KVM: SVM: Do not use user return MSR support for virtualized TSC_AUX")
> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
> ---
> arch/x86/kvm/svm/svm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index 9507df93f410..4c917c74a4d3 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -691,7 +691,7 @@ static int svm_hardware_enable(void)
> */
> if (boot_cpu_has(X86_FEATURE_V_TSC_AUX)) {
> struct sev_es_save_area *hostsa;
> - u32 msr_hi;
> + u32 __maybe_unused msr_hi;
Argh, the abomination that is rdmsrl() strikes again :-/ We really should be able
to do:
hostsa->tsc_aux = (u32)rdmsrl(MSR_TSC_AUX);
I don't see a better quick fix than __maybe_unused though.
Reviewed-by: Sean Christopherson <seanjc@google.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] KVM: SVM: Fix build error when using -Werror=unused-but-set-variable
2023-10-02 18:28 [PATCH] KVM: SVM: Fix build error when using -Werror=unused-but-set-variable Tom Lendacky
2023-10-02 19:01 ` Sean Christopherson
@ 2023-10-12 15:09 ` Paolo Bonzini
1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2023-10-12 15:09 UTC (permalink / raw)
To: Tom Lendacky
Cc: kvm, linux-kernel, x86, Sean Christopherson, Borislav Petkov,
Dave Hansen, Ingo Molnar, Thomas Gleixner
Queued, thanks.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-10-12 15:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-02 18:28 [PATCH] KVM: SVM: Fix build error when using -Werror=unused-but-set-variable Tom Lendacky
2023-10-02 19:01 ` Sean Christopherson
2023-10-12 15:09 ` Paolo Bonzini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).