From: Sean Christopherson <seanjc@google.com>
To: Jinrong Liang <ljr.kernel@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, Like Xu <likexu@tencent.com>,
David Matlack <dmatlack@google.com>,
Aaron Lewis <aaronlewis@google.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jinrong Liang <cloudliang@tencent.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/8] KVM: selftests: KVM: selftests: Add macros for fixed counters in processor.h
Date: Wed, 28 Jun 2023 12:46:18 -0700 [thread overview]
Message-ID: <ZJyOCpueM0viGDfX@google.com> (raw)
In-Reply-To: <20230530134248.23998-2-cloudliang@tencent.com>
Heh, duplicate "KVM: selftests:" in the shortlog.
On Tue, May 30, 2023, Jinrong Liang wrote:
> From: Jinrong Liang <cloudliang@tencent.com>
>
> Add macro in processor.h, providing a efficient way to obtain
Try not to describe what the patch literally does in terms of code, the purpose
of the shortlog+changelog is to complement the diff, e.g. it's super obvious from
the diff that this patch adds macros in processor.h.
> the number of fixed counters and fixed counters bit mask. The
Wrap closer to 75 chars, 60 is too aggressive.
> addition of these macro will simplify the handling of fixed
> performance counters, while keeping the code maintainable and
> clean.
Instead of making assertions, justify the patch by stating the effects on code.
Statements like "will simplify the handling" and "keeping the code maintainable
and clean" are subjective. In cases like these, it's extremely unlikely anyone
will disagree, but getting into the habit of providing concrete justification
even for simple cases makes it easier to write changelogs for more complex changes.
E.g.
Add x86 properties for the number of PMU fixed counters and the bitmask
that allows for "discontiguous" fixed counters so that tests don't have
to manually retrieve the correct CPUID leaf+register, and so that the
resulting code is self-documenting.
> Signed-off-by: Jinrong Liang <cloudliang@tencent.com>
> ---
> tools/testing/selftests/kvm/include/x86_64/processor.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tools/testing/selftests/kvm/include/x86_64/processor.h b/tools/testing/selftests/kvm/include/x86_64/processor.h
> index aa434c8f19c5..94751bddf1d9 100644
> --- a/tools/testing/selftests/kvm/include/x86_64/processor.h
> +++ b/tools/testing/selftests/kvm/include/x86_64/processor.h
> @@ -240,6 +240,8 @@ struct kvm_x86_cpu_property {
> #define X86_PROPERTY_PMU_VERSION KVM_X86_CPU_PROPERTY(0xa, 0, EAX, 0, 7)
> #define X86_PROPERTY_PMU_NR_GP_COUNTERS KVM_X86_CPU_PROPERTY(0xa, 0, EAX, 8, 15)
> #define X86_PROPERTY_PMU_EBX_BIT_VECTOR_LENGTH KVM_X86_CPU_PROPERTY(0xa, 0, EAX, 24, 31)
> +#define X86_PROPERTY_PMU_FIXED_CTRS_BITMASK KVM_X86_CPU_PROPERTY(0xa, 0, ECX, 0, 31)
Please spell out COUNTERS so that all the properties are consistent.
> +#define X86_PROPERTY_PMU_NR_FIXED_COUNTERS KVM_X86_CPU_PROPERTY(0xa, 0, EDX, 0, 4)
>
> #define X86_PROPERTY_SUPPORTED_XCR0_LO KVM_X86_CPU_PROPERTY(0xd, 0, EAX, 0, 31)
> #define X86_PROPERTY_XSTATE_MAX_SIZE_XCR0 KVM_X86_CPU_PROPERTY(0xd, 0, EBX, 0, 31)
> --
> 2.31.1
>
next prev parent reply other threads:[~2023-06-28 19:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-30 13:42 [PATCH v2 0/8] KVM: selftests: Test the consistency of the PMU's CPUID and its features Jinrong Liang
2023-05-30 13:42 ` [PATCH v2 1/8] KVM: selftests: KVM: selftests: Add macros for fixed counters in processor.h Jinrong Liang
2023-06-28 19:46 ` Sean Christopherson [this message]
2023-05-30 13:42 ` [PATCH v2 2/8] KVM: selftests: Add pmu.h for PMU events and common masks Jinrong Liang
2023-06-28 20:02 ` Sean Christopherson
2023-05-30 13:42 ` [PATCH v2 3/8] KVM: selftests: Test Intel PMU architectural events on gp counters Jinrong Liang
2023-06-28 20:43 ` Sean Christopherson
2023-06-28 21:03 ` Jim Mattson
2023-05-30 13:42 ` [PATCH v2 4/8] KVM: selftests: Test Intel PMU architectural events on fixed counters Jinrong Liang
2023-05-30 13:42 ` [PATCH v2 5/8] KVM: selftests: Test consistency of CPUID with num of gp counters Jinrong Liang
2023-05-30 13:42 ` [PATCH v2 6/8] KVM: selftests: Test consistency of CPUID with num of fixed counters Jinrong Liang
2023-06-28 21:01 ` Sean Christopherson
2023-05-30 13:42 ` [PATCH v2 7/8] KVM: selftests: Test Intel supported fixed counters bit mask Jinrong Liang
2023-06-28 21:05 ` Sean Christopherson
2023-05-30 13:42 ` [PATCH v2 8/8] KVM: selftests: Test consistency of PMU MSRs with Intel PMU version Jinrong Liang
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=ZJyOCpueM0viGDfX@google.com \
--to=seanjc@google.com \
--cc=aaronlewis@google.com \
--cc=cloudliang@tencent.com \
--cc=dmatlack@google.com \
--cc=kvm@vger.kernel.org \
--cc=likexu@tencent.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ljr.kernel@gmail.com \
--cc=pbonzini@redhat.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