From: Like Xu <like.xu.linux@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Jim Mattson <jmattson@google.com>,
sandipan.das@amd.com, Sean Christopherson <seanjc@google.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Joerg Roedel <joro@8bytes.org>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] KVM: x86/svm/pmu: Drop 'enum index' for more counters scalability
Date: Fri, 20 May 2022 22:32:06 +0800 [thread overview]
Message-ID: <e7b67a64-d5d4-b251-f414-f4e1ae08e199@gmail.com> (raw)
In-Reply-To: <20220510115718.93335-3-likexu@tencent.com>
The third patch is buggy, please ignore it.
I will post a new version. Sorry for the noise.
On 10/5/2022 7:57 pm, Like Xu wrote:
> From: Like Xu<likexu@tencent.com>
>
> If the number of AMD gp counters continues to grow, the code will
> be very clumsy and the switch-case design of inline get_gp_pmc_amd()
> will also bloat the kernel text size.
>
> The target code is taught to manage two groups of MSRs, each
> representing a different version of the AMD PMU counter MSRs.
> The MSR addresses of each group are contiguous, with no holes,
> and there is no intersection between two sets of addresses,
> but they are discrete in functionality by design like this:
>
> [Group A : All counter MSRs are tightly bound to all event select MSRs ]
>
> MSR_K7_EVNTSEL0 0xc0010000
> MSR_K7_EVNTSELi 0xc0010000 + i
> ...
> MSR_K7_EVNTSEL3 0xc0010003
> MSR_K7_PERFCTR0 0xc0010004
> MSR_K7_PERFCTRi 0xc0010004 + i
> ...
> MSR_K7_PERFCTR3 0xc0010007
>
> [Group B : The counter MSRs are interleaved with the event select MSRs ]
>
> MSR_F15H_PERF_CTL0 0xc0010200
> MSR_F15H_PERF_CTR0 (0xc0010200 + 1)
> ...
> MSR_F15H_PERF_CTLi (0xc0010200 + 2 * i)
> MSR_F15H_PERF_CTRi (0xc0010200 + 2 * i + 1)
> ...
> MSR_F15H_PERF_CTL5 (0xc0010200 + 2 * 5)
> MSR_F15H_PERF_CTR5 (0xc0010200 + 2 * 5 + 1)
>
> Rewrite get_gp_pmc_amd() in this way: first determine which group of
> registers is accessed by the pass-in 'msr' address, then determine
> which msr 'base' is referenced by 'type', applying different address
> scaling ratios separately, and finally get the pmc_idx.
>
> If the 'base' does not match its 'type', it continues to remain invalid.
>
> Signed-off-by: Like Xu<likexu@tencent.com>
prev parent reply other threads:[~2022-05-20 14:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-10 11:57 [PATCH 1/3] KVM: x86/pmu: Add fast-path check for per-vm vPMU disablility Like Xu
2022-05-10 11:57 ` [PATCH 2/3] KVM: x86/svm/pmu: Direct access pmu->gp_counter[] to implement amd_*_to_pmc() Like Xu
2022-05-20 14:45 ` [PATCH v2 " Like Xu
2022-05-10 11:57 ` [PATCH 3/3] KVM: x86/svm/pmu: Drop 'enum index' for more counters scalability Like Xu
2022-05-20 14:32 ` Like Xu [this message]
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=e7b67a64-d5d4-b251-f414-f4e1ae08e199@gmail.com \
--to=like.xu.linux@gmail.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=sandipan.das@amd.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
all inboxes | Powered by JetHome®