kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Tom Lendacky <thomas.lendacky@amd.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	x86@kernel.org, Paolo Bonzini <pbonzini@redhat.com>,
	Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH] KVM: SVM: Fix build error when using -Werror=unused-but-set-variable
Date: Mon, 2 Oct 2023 12:01:11 -0700	[thread overview]
Message-ID: <ZRsTd9FEIvgERrte@google.com> (raw)
In-Reply-To: <0da9874b6e9fcbaaa5edeb345d7e2a7c859fc818.1696271334.git.thomas.lendacky@amd.com>

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>

  reply	other threads:[~2023-10-02 19:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2023-10-12 15:09 ` Paolo Bonzini

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=ZRsTd9FEIvgERrte@google.com \
    --to=seanjc@google.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=x86@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).