The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Like Xu <like.xu.linux@gmail.com>
Cc: Joerg Roedel <joro@8bytes.org>,
	Kim Phillips <kim.phillips@amd.com>,
	Jim Mattson <jmattson@google.com>,
	Maxim Levitsky <mlevitsk@redhat.com>,
	Sean Christopherson <seanjc@google.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] KVM: x86/pmu: Fix reserved bits for AMD PerfEvtSeln register
Date: Thu, 18 Nov 2021 15:43:25 +0100	[thread overview]
Message-ID: <350b8c9b-c672-d6e2-a7a9-bf7c01699a8e@redhat.com> (raw)
In-Reply-To: <20211118130320.95997-1-likexu@tencent.com>

On 11/18/21 14:03, Like Xu wrote:
> From: Like Xu <likexu@tencent.com>
> 
> If we run the following perf command in an AMD Milan guest:
> 
>    perf stat \
>    -e cpu/event=0x1d0/ \
>    -e cpu/event=0x1c7/ \
>    -e cpu/umask=0x1f,event=0x18e/ \
>    -e cpu/umask=0x7,event=0x18e/ \
>    -e cpu/umask=0x18,event=0x18e/ \
>    ./workload
> 
> dmesg will report a #GP warning from an unchecked MSR access
> error on MSR_F15H_PERF_CTLx.
> 
> This is because according to APM (Revision: 4.03) Figure 13-7,
> the bits [35:32] of AMD PerfEvtSeln register is a part of the
> event select encoding, which extends the EVENT_SELECT field
> from 8 bits to 12 bits.
> 
> Opportunistically update pmu->reserved_bits for reserved bit 19.
> 
> Reported-by: Jim Mattson <jmattson@google.com>
> Fixes: ca724305a2b0 ("KVM: x86/vPMU: Implement AMD vPMU code for KVM")
> Signed-off-by: Like Xu <likexu@tencent.com>
> ---
>   arch/x86/kvm/svm/pmu.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/svm/pmu.c b/arch/x86/kvm/svm/pmu.c
> index 871c426ec389..b4095dfeeee6 100644
> --- a/arch/x86/kvm/svm/pmu.c
> +++ b/arch/x86/kvm/svm/pmu.c
> @@ -281,7 +281,7 @@ static void amd_pmu_refresh(struct kvm_vcpu *vcpu)
>   		pmu->nr_arch_gp_counters = AMD64_NUM_COUNTERS;
>   
>   	pmu->counter_bitmask[KVM_PMC_GP] = ((u64)1 << 48) - 1;
> -	pmu->reserved_bits = 0xffffffff00200000ull;
> +	pmu->reserved_bits = 0xfffffff000280000ull;
>   	pmu->version = 1;
>   	/* not applicable to AMD; but clean them to prevent any fall out */
>   	pmu->counter_bitmask[KVM_PMC_FIXED] = 0;
> 

Queued, thanks.


  parent reply	other threads:[~2021-11-18 14:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-18 13:03 [PATCH] KVM: x86/pmu: Fix reserved bits for AMD PerfEvtSeln register Like Xu
2021-11-18 13:23 ` Paolo Bonzini
2021-11-18 14:43 ` Paolo Bonzini [this message]
2022-02-12  8:39 ` Jim Mattson
2022-02-16  7:47   ` Like Xu
2022-02-25 22:26     ` Jim Mattson

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=350b8c9b-c672-d6e2-a7a9-bf7c01699a8e@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kim.phillips@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=like.xu.linux@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mlevitsk@redhat.com \
    --cc=seanjc@google.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.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