* [PATCH] KVM: arm64: Fix the name of sys_reg_desc related to PMU
@ 2023-07-12 7:55 chenxiang
2023-07-12 8:36 ` Marc Zyngier
0 siblings, 1 reply; 7+ messages in thread
From: chenxiang @ 2023-07-12 7:55 UTC (permalink / raw)
To: maz, oliver.upton, james.morse; +Cc: kvmarm, kvm, linuxarm, Xiang Chen
From: Xiang Chen <chenxiang66@hisilicon.com>
For those PMU system registers defined in sys_reg_descs[], use macro
PMU_SYS_REG() / PMU_PMEVCNTR_EL0 / PMU_PMEVTYPER_EL0 to define them, and
later two macros call macro PMU_SYS_REG() actually.
Currently the input parameter of PMU_SYS_REG() is other macro which is
calculation formula of the value of system registers, so for example, if
we want to "SYS_PMINTENSET_EL1" as the name of sys register, actually
the name will be as following:
(((3) << 19) | ((0) << 16) | ((9) << 12) | ((14) << 8) | ((1) << 5))
To fix the issue, use the name as a input parameter of PMU_SYS_REG like
MTE_REG or EL2_REG.
Signed-off-by: Xiang Chen <chenxiang66@hisilicon.com>
---
arch/arm64/kvm/sys_regs.c | 41 +++++++++++++++++++++--------------------
1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
index bd34318..0af5f2f 100644
--- a/arch/arm64/kvm/sys_regs.c
+++ b/arch/arm64/kvm/sys_regs.c
@@ -1115,18 +1115,19 @@ static bool access_pmuserenr(struct kvm_vcpu *vcpu, struct sys_reg_params *p,
{ SYS_DESC(SYS_DBGWCRn_EL1(n)), \
trap_wcr, reset_wcr, 0, 0, get_wcr, set_wcr }
-#define PMU_SYS_REG(r) \
- SYS_DESC(r), .reset = reset_pmu_reg, .visibility = pmu_visibility
+#define PMU_SYS_REG(name) \
+ SYS_DESC(SYS_##name), .reset = reset_pmu_reg, \
+ .visibility = pmu_visibility
/* Macro to expand the PMEVCNTRn_EL0 register */
#define PMU_PMEVCNTR_EL0(n) \
- { PMU_SYS_REG(SYS_PMEVCNTRn_EL0(n)), \
+ { PMU_SYS_REG(PMEVCNTRn_EL0(n)), \
.reset = reset_pmevcntr, .get_user = get_pmu_evcntr, \
.access = access_pmu_evcntr, .reg = (PMEVCNTR0_EL0 + n), }
/* Macro to expand the PMEVTYPERn_EL0 register */
#define PMU_PMEVTYPER_EL0(n) \
- { PMU_SYS_REG(SYS_PMEVTYPERn_EL0(n)), \
+ { PMU_SYS_REG(PMEVTYPERn_EL0(n)), \
.reset = reset_pmevtyper, \
.access = access_pmu_evtyper, .reg = (PMEVTYPER0_EL0 + n), }
@@ -2115,9 +2116,9 @@ static const struct sys_reg_desc sys_reg_descs[] = {
{ SYS_DESC(SYS_PMBSR_EL1), undef_access },
/* PMBIDR_EL1 is not trapped */
- { PMU_SYS_REG(SYS_PMINTENSET_EL1),
+ { PMU_SYS_REG(PMINTENSET_EL1),
.access = access_pminten, .reg = PMINTENSET_EL1 },
- { PMU_SYS_REG(SYS_PMINTENCLR_EL1),
+ { PMU_SYS_REG(PMINTENCLR_EL1),
.access = access_pminten, .reg = PMINTENSET_EL1 },
{ SYS_DESC(SYS_PMMIR_EL1), trap_raz_wi },
@@ -2164,41 +2165,41 @@ static const struct sys_reg_desc sys_reg_descs[] = {
{ SYS_DESC(SYS_CTR_EL0), access_ctr },
{ SYS_DESC(SYS_SVCR), undef_access },
- { PMU_SYS_REG(SYS_PMCR_EL0), .access = access_pmcr,
+ { PMU_SYS_REG(PMCR_EL0), .access = access_pmcr,
.reset = reset_pmcr, .reg = PMCR_EL0 },
- { PMU_SYS_REG(SYS_PMCNTENSET_EL0),
+ { PMU_SYS_REG(PMCNTENSET_EL0),
.access = access_pmcnten, .reg = PMCNTENSET_EL0 },
- { PMU_SYS_REG(SYS_PMCNTENCLR_EL0),
+ { PMU_SYS_REG(PMCNTENCLR_EL0),
.access = access_pmcnten, .reg = PMCNTENSET_EL0 },
- { PMU_SYS_REG(SYS_PMOVSCLR_EL0),
+ { PMU_SYS_REG(PMOVSCLR_EL0),
.access = access_pmovs, .reg = PMOVSSET_EL0 },
/*
* PM_SWINC_EL0 is exposed to userspace as RAZ/WI, as it was
* previously (and pointlessly) advertised in the past...
*/
- { PMU_SYS_REG(SYS_PMSWINC_EL0),
+ { PMU_SYS_REG(PMSWINC_EL0),
.get_user = get_raz_reg, .set_user = set_wi_reg,
.access = access_pmswinc, .reset = NULL },
- { PMU_SYS_REG(SYS_PMSELR_EL0),
+ { PMU_SYS_REG(PMSELR_EL0),
.access = access_pmselr, .reset = reset_pmselr, .reg = PMSELR_EL0 },
- { PMU_SYS_REG(SYS_PMCEID0_EL0),
+ { PMU_SYS_REG(PMCEID0_EL0),
.access = access_pmceid, .reset = NULL },
- { PMU_SYS_REG(SYS_PMCEID1_EL0),
+ { PMU_SYS_REG(PMCEID1_EL0),
.access = access_pmceid, .reset = NULL },
- { PMU_SYS_REG(SYS_PMCCNTR_EL0),
+ { PMU_SYS_REG(PMCCNTR_EL0),
.access = access_pmu_evcntr, .reset = reset_unknown,
.reg = PMCCNTR_EL0, .get_user = get_pmu_evcntr},
- { PMU_SYS_REG(SYS_PMXEVTYPER_EL0),
+ { PMU_SYS_REG(PMXEVTYPER_EL0),
.access = access_pmu_evtyper, .reset = NULL },
- { PMU_SYS_REG(SYS_PMXEVCNTR_EL0),
+ { PMU_SYS_REG(PMXEVCNTR_EL0),
.access = access_pmu_evcntr, .reset = NULL },
/*
* PMUSERENR_EL0 resets as unknown in 64bit mode while it resets as zero
* in 32bit mode. Here we choose to reset it as zero for consistency.
*/
- { PMU_SYS_REG(SYS_PMUSERENR_EL0), .access = access_pmuserenr,
+ { PMU_SYS_REG(PMUSERENR_EL0), .access = access_pmuserenr,
.reset = reset_val, .reg = PMUSERENR_EL0, .val = 0 },
- { PMU_SYS_REG(SYS_PMOVSSET_EL0),
+ { PMU_SYS_REG(PMOVSSET_EL0),
.access = access_pmovs, .reg = PMOVSSET_EL0 },
{ SYS_DESC(SYS_TPIDR_EL0), NULL, reset_unknown, TPIDR_EL0 },
@@ -2354,7 +2355,7 @@ static const struct sys_reg_desc sys_reg_descs[] = {
* PMCCFILTR_EL0 resets as unknown in 64bit mode while it resets as zero
* in 32bit mode. Here we choose to reset it as zero for consistency.
*/
- { PMU_SYS_REG(SYS_PMCCFILTR_EL0), .access = access_pmu_evtyper,
+ { PMU_SYS_REG(PMCCFILTR_EL0), .access = access_pmu_evtyper,
.reset = reset_val, .reg = PMCCFILTR_EL0, .val = 0 },
EL2_REG(VPIDR_EL2, access_rw, reset_unknown, 0),
--
2.8.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH] KVM: arm64: Fix the name of sys_reg_desc related to PMU
2023-07-12 7:55 [PATCH] KVM: arm64: Fix the name of sys_reg_desc related to PMU chenxiang
@ 2023-07-12 8:36 ` Marc Zyngier
2023-07-13 2:35 ` chenxiang (M)
0 siblings, 1 reply; 7+ messages in thread
From: Marc Zyngier @ 2023-07-12 8:36 UTC (permalink / raw)
To: chenxiang; +Cc: oliver.upton, james.morse, kvmarm, kvm, linuxarm
On Wed, 12 Jul 2023 08:55:05 +0100,
chenxiang <chenxiang66@hisilicon.com> wrote:
>
> From: Xiang Chen <chenxiang66@hisilicon.com>
>
> For those PMU system registers defined in sys_reg_descs[], use macro
> PMU_SYS_REG() / PMU_PMEVCNTR_EL0 / PMU_PMEVTYPER_EL0 to define them, and
> later two macros call macro PMU_SYS_REG() actually.
> Currently the input parameter of PMU_SYS_REG() is other macro which is
> calculation formula of the value of system registers, so for example, if
> we want to "SYS_PMINTENSET_EL1" as the name of sys register, actually
> the name will be as following:
> (((3) << 19) | ((0) << 16) | ((9) << 12) | ((14) << 8) | ((1) << 5))
>
> To fix the issue, use the name as a input parameter of PMU_SYS_REG like
> MTE_REG or EL2_REG.
Why is the name relevant? Is this related to tracing?
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] KVM: arm64: Fix the name of sys_reg_desc related to PMU
2023-07-12 8:36 ` Marc Zyngier
@ 2023-07-13 2:35 ` chenxiang (M)
2023-07-13 6:56 ` Marc Zyngier
0 siblings, 1 reply; 7+ messages in thread
From: chenxiang (M) @ 2023-07-13 2:35 UTC (permalink / raw)
To: Marc Zyngier; +Cc: oliver.upton, james.morse, kvmarm, kvm, linuxarm
Hi Marc,
在 2023/7/12 星期三 16:36, Marc Zyngier 写道:
> On Wed, 12 Jul 2023 08:55:05 +0100,
> chenxiang <chenxiang66@hisilicon.com> wrote:
>> From: Xiang Chen <chenxiang66@hisilicon.com>
>>
>> For those PMU system registers defined in sys_reg_descs[], use macro
>> PMU_SYS_REG() / PMU_PMEVCNTR_EL0 / PMU_PMEVTYPER_EL0 to define them, and
>> later two macros call macro PMU_SYS_REG() actually.
>> Currently the input parameter of PMU_SYS_REG() is other macro which is
>> calculation formula of the value of system registers, so for example, if
>> we want to "SYS_PMINTENSET_EL1" as the name of sys register, actually
>> the name will be as following:
>> (((3) << 19) | ((0) << 16) | ((9) << 12) | ((14) << 8) | ((1) << 5))
>>
>> To fix the issue, use the name as a input parameter of PMU_SYS_REG like
>> MTE_REG or EL2_REG.
> Why is the name relevant? Is this related to tracing?
I think It is not related to tracing. I find the issue when i want to
know which system reigsters are set
when on live migration and printk the name of sys_reg_desc in function
kvm_sys_reg_set_user,
find the name of some registers are abnormal as followings:
[ 227.145540] kvm_sys_reg_set_user 3427:SYS_FAR_EL1
[ 227.158057] kvm_sys_reg_set_user 3427:SYS_PAR_EL1
[ 227.170574] kvm_sys_reg_set_user 3427:(((3) << 19) | ((0) << 16) |
((9) << 12) | ((14) << 8) | ((1) << 5))
[ 227.188037] kvm_sys_reg_set_user 3427:(((3) << 19) | ((0) << 16) |
((9) << 12) | ((14) << 8) | ((2) << 5))
[ 227.205511] kvm_sys_reg_set_user 3427:SYS_MAIR_EL1
[ 227.218117] kvm_sys_reg_set_user 3427:SYS_PIRE0_EL1
I think it is caused by the macro PMU_SYS_REG(). For example
PMU_SYS_REG(SYS_PMINTENSET_EL1),
#define SYS_PMINTENSET_EL1 sys_reg(3, 0, 9, 14, 1)
#define sys_reg(op0, op1, crn, crm, op2) (((op0) << OP0_shift) | ((op1)
<< OP1_shift) | ((crn) << CRn_shift) | ((crm) << CRm_shift) | ((op2) <<
OP2_shift))
So SYS_PMINTENSET_EL1 is equal to (((3) << 19) | ((0) << 16) | ((9) <<
12) | ((14) << 8) | ((1) << 5)), and PMU_SYS_REG(SYS_PMINTENSET_EL1) calls
SYS_DESC() which uses the input parameter as the name, so the name of
SYS_PMINTENSET_EL1 becomes (((3) << 19) | ((0) << 16) | ((9) << 12) |
((14) << 8) | ((1) << 5)).
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] KVM: arm64: Fix the name of sys_reg_desc related to PMU
2023-07-13 2:35 ` chenxiang (M)
@ 2023-07-13 6:56 ` Marc Zyngier
2023-07-13 9:10 ` chenxiang (M)
0 siblings, 1 reply; 7+ messages in thread
From: Marc Zyngier @ 2023-07-13 6:56 UTC (permalink / raw)
To: chenxiang (M); +Cc: oliver.upton, james.morse, kvmarm, kvm, linuxarm
On Thu, 13 Jul 2023 03:35:39 +0100,
"chenxiang (M)" <chenxiang66@hisilicon.com> wrote:
>
> Hi Marc,
>
>
> 在 2023/7/12 星期三 16:36, Marc Zyngier 写道:
> > On Wed, 12 Jul 2023 08:55:05 +0100,
> > chenxiang <chenxiang66@hisilicon.com> wrote:
> >> From: Xiang Chen <chenxiang66@hisilicon.com>
> >>
> >> For those PMU system registers defined in sys_reg_descs[], use macro
> >> PMU_SYS_REG() / PMU_PMEVCNTR_EL0 / PMU_PMEVTYPER_EL0 to define them, and
> >> later two macros call macro PMU_SYS_REG() actually.
> >> Currently the input parameter of PMU_SYS_REG() is other macro which is
> >> calculation formula of the value of system registers, so for example, if
> >> we want to "SYS_PMINTENSET_EL1" as the name of sys register, actually
> >> the name will be as following:
> >> (((3) << 19) | ((0) << 16) | ((9) << 12) | ((14) << 8) | ((1) << 5))
> >>
> >> To fix the issue, use the name as a input parameter of PMU_SYS_REG like
> >> MTE_REG or EL2_REG.
> > Why is the name relevant? Is this related to tracing?
> I think It is not related to tracing. I find the issue when i want to
> know which system reigsters are set
> when on live migration and printk the name of sys_reg_desc in function
> kvm_sys_reg_set_user,
> find the name of some registers are abnormal as followings:
>
> [ 227.145540] kvm_sys_reg_set_user 3427:SYS_FAR_EL1
> [ 227.158057] kvm_sys_reg_set_user 3427:SYS_PAR_EL1
> [ 227.170574] kvm_sys_reg_set_user 3427:(((3) << 19) | ((0) << 16) |
> ((9) << 12) | ((14) << 8) | ((1) << 5))
> [ 227.188037] kvm_sys_reg_set_user 3427:(((3) << 19) | ((0) << 16) |
> ((9) << 12) | ((14) << 8) | ((2) << 5))
> [ 227.205511] kvm_sys_reg_set_user 3427:SYS_MAIR_EL1
> [ 227.218117] kvm_sys_reg_set_user 3427:SYS_PIRE0_EL1
So what is this if not some form of tracing?
I agree that it would be good to fix it, at least because the register
name is smaller than the encoding, but the commit message should at
least mention what this is used for.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] KVM: arm64: Fix the name of sys_reg_desc related to PMU
2023-07-13 6:56 ` Marc Zyngier
@ 2023-07-13 9:10 ` chenxiang (M)
2023-07-13 9:40 ` Marc Zyngier
0 siblings, 1 reply; 7+ messages in thread
From: chenxiang (M) @ 2023-07-13 9:10 UTC (permalink / raw)
To: Marc Zyngier; +Cc: oliver.upton, james.morse, kvmarm, kvm, linuxarm
Hi Marc,
在 2023/7/13 星期四 14:56, Marc Zyngier 写道:
> On Thu, 13 Jul 2023 03:35:39 +0100,
> "chenxiang (M)" <chenxiang66@hisilicon.com> wrote:
>> Hi Marc,
>>
>>
>> 在 2023/7/12 星期三 16:36, Marc Zyngier 写道:
>>> On Wed, 12 Jul 2023 08:55:05 +0100,
>>> chenxiang <chenxiang66@hisilicon.com> wrote:
>>>> From: Xiang Chen <chenxiang66@hisilicon.com>
>>>>
>>>> For those PMU system registers defined in sys_reg_descs[], use macro
>>>> PMU_SYS_REG() / PMU_PMEVCNTR_EL0 / PMU_PMEVTYPER_EL0 to define them, and
>>>> later two macros call macro PMU_SYS_REG() actually.
>>>> Currently the input parameter of PMU_SYS_REG() is other macro which is
>>>> calculation formula of the value of system registers, so for example, if
>>>> we want to "SYS_PMINTENSET_EL1" as the name of sys register, actually
>>>> the name will be as following:
>>>> (((3) << 19) | ((0) << 16) | ((9) << 12) | ((14) << 8) | ((1) << 5))
>>>>
>>>> To fix the issue, use the name as a input parameter of PMU_SYS_REG like
>>>> MTE_REG or EL2_REG.
>>> Why is the name relevant? Is this related to tracing?
>> I think It is not related to tracing. I find the issue when i want to
>> know which system reigsters are set
>> when on live migration and printk the name of sys_reg_desc in function
>> kvm_sys_reg_set_user,
>> find the name of some registers are abnormal as followings:
>>
>> [ 227.145540] kvm_sys_reg_set_user 3427:SYS_FAR_EL1
>> [ 227.158057] kvm_sys_reg_set_user 3427:SYS_PAR_EL1
>> [ 227.170574] kvm_sys_reg_set_user 3427:(((3) << 19) | ((0) << 16) |
>> ((9) << 12) | ((14) << 8) | ((1) << 5))
>> [ 227.188037] kvm_sys_reg_set_user 3427:(((3) << 19) | ((0) << 16) |
>> ((9) << 12) | ((14) << 8) | ((2) << 5))
>> [ 227.205511] kvm_sys_reg_set_user 3427:SYS_MAIR_EL1
>> [ 227.218117] kvm_sys_reg_set_user 3427:SYS_PIRE0_EL1
> So what is this if not some form of tracing?
Ah, i was misunderstood your question. I thought you aksed whether it is
related to kernel tracing
(which is already existed in kernel) such as tracepoint or debugfs.
>
> I agree that it would be good to fix it, at least because the register
> name is smaller than the encoding, but the commit message should at
> least mention what this is used for.
Ok, i will modify commit message in next version.
>
> Thanks,
>
> M.
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] KVM: arm64: Fix the name of sys_reg_desc related to PMU
2023-07-13 9:10 ` chenxiang (M)
@ 2023-07-13 9:40 ` Marc Zyngier
2023-07-14 3:13 ` chenxiang (M)
0 siblings, 1 reply; 7+ messages in thread
From: Marc Zyngier @ 2023-07-13 9:40 UTC (permalink / raw)
To: chenxiang (M); +Cc: oliver.upton, james.morse, kvmarm, kvm, linuxarm
On Thu, 13 Jul 2023 10:10:01 +0100,
"chenxiang (M)" <chenxiang66@hisilicon.com> wrote:
>
> Hi Marc,
>
>
> 在 2023/7/13 星期四 14:56, Marc Zyngier 写道:
> > On Thu, 13 Jul 2023 03:35:39 +0100,
> > "chenxiang (M)" <chenxiang66@hisilicon.com> wrote:
> >> Hi Marc,
> >>
> >>
> >> 在 2023/7/12 星期三 16:36, Marc Zyngier 写道:
> >>> On Wed, 12 Jul 2023 08:55:05 +0100,
> >>> chenxiang <chenxiang66@hisilicon.com> wrote:
> >>>> From: Xiang Chen <chenxiang66@hisilicon.com>
> >>>>
> >>>> For those PMU system registers defined in sys_reg_descs[], use macro
> >>>> PMU_SYS_REG() / PMU_PMEVCNTR_EL0 / PMU_PMEVTYPER_EL0 to define them, and
> >>>> later two macros call macro PMU_SYS_REG() actually.
> >>>> Currently the input parameter of PMU_SYS_REG() is other macro which is
> >>>> calculation formula of the value of system registers, so for example, if
> >>>> we want to "SYS_PMINTENSET_EL1" as the name of sys register, actually
> >>>> the name will be as following:
> >>>> (((3) << 19) | ((0) << 16) | ((9) << 12) | ((14) << 8) | ((1) << 5))
> >>>>
> >>>> To fix the issue, use the name as a input parameter of PMU_SYS_REG like
> >>>> MTE_REG or EL2_REG.
> >>> Why is the name relevant? Is this related to tracing?
> >> I think It is not related to tracing. I find the issue when i want to
> >> know which system reigsters are set
> >> when on live migration and printk the name of sys_reg_desc in function
> >> kvm_sys_reg_set_user,
> >> find the name of some registers are abnormal as followings:
> >>
> >> [ 227.145540] kvm_sys_reg_set_user 3427:SYS_FAR_EL1
> >> [ 227.158057] kvm_sys_reg_set_user 3427:SYS_PAR_EL1
> >> [ 227.170574] kvm_sys_reg_set_user 3427:(((3) << 19) | ((0) << 16) |
> >> ((9) << 12) | ((14) << 8) | ((1) << 5))
> >> [ 227.188037] kvm_sys_reg_set_user 3427:(((3) << 19) | ((0) << 16) |
> >> ((9) << 12) | ((14) << 8) | ((2) << 5))
> >> [ 227.205511] kvm_sys_reg_set_user 3427:SYS_MAIR_EL1
> >> [ 227.218117] kvm_sys_reg_set_user 3427:SYS_PIRE0_EL1
> > So what is this if not some form of tracing?
>
> Ah, i was misunderstood your question. I thought you aksed whether
> it is related to kernel tracing (which is already existed in kernel)
> such as tracepoint or debugfs.
But that's my point: tracepoints such as kvm_sys_access already output
the name (as well as the encoding), and are likely to be affected by
this problem.
And that's a much more interesting justification for this change.
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] KVM: arm64: Fix the name of sys_reg_desc related to PMU
2023-07-13 9:40 ` Marc Zyngier
@ 2023-07-14 3:13 ` chenxiang (M)
0 siblings, 0 replies; 7+ messages in thread
From: chenxiang (M) @ 2023-07-14 3:13 UTC (permalink / raw)
To: Marc Zyngier; +Cc: oliver.upton, james.morse, kvmarm, kvm, linuxarm
Hi Marc,
在 2023/7/13 星期四 17:40, Marc Zyngier 写道:
> On Thu, 13 Jul 2023 10:10:01 +0100,
> "chenxiang (M)" <chenxiang66@hisilicon.com> wrote:
>> Hi Marc,
>>
>>
>> 在 2023/7/13 星期四 14:56, Marc Zyngier 写道:
>>> On Thu, 13 Jul 2023 03:35:39 +0100,
>>> "chenxiang (M)" <chenxiang66@hisilicon.com> wrote:
>>>> Hi Marc,
>>>>
>>>>
>>>> 在 2023/7/12 星期三 16:36, Marc Zyngier 写道:
>>>>> On Wed, 12 Jul 2023 08:55:05 +0100,
>>>>> chenxiang <chenxiang66@hisilicon.com> wrote:
>>>>>> From: Xiang Chen <chenxiang66@hisilicon.com>
>>>>>>
>>>>>> For those PMU system registers defined in sys_reg_descs[], use macro
>>>>>> PMU_SYS_REG() / PMU_PMEVCNTR_EL0 / PMU_PMEVTYPER_EL0 to define them, and
>>>>>> later two macros call macro PMU_SYS_REG() actually.
>>>>>> Currently the input parameter of PMU_SYS_REG() is other macro which is
>>>>>> calculation formula of the value of system registers, so for example, if
>>>>>> we want to "SYS_PMINTENSET_EL1" as the name of sys register, actually
>>>>>> the name will be as following:
>>>>>> (((3) << 19) | ((0) << 16) | ((9) << 12) | ((14) << 8) | ((1) << 5))
>>>>>>
>>>>>> To fix the issue, use the name as a input parameter of PMU_SYS_REG like
>>>>>> MTE_REG or EL2_REG.
>>>>> Why is the name relevant? Is this related to tracing?
>>>> I think It is not related to tracing. I find the issue when i want to
>>>> know which system reigsters are set
>>>> when on live migration and printk the name of sys_reg_desc in function
>>>> kvm_sys_reg_set_user,
>>>> find the name of some registers are abnormal as followings:
>>>>
>>>> [ 227.145540] kvm_sys_reg_set_user 3427:SYS_FAR_EL1
>>>> [ 227.158057] kvm_sys_reg_set_user 3427:SYS_PAR_EL1
>>>> [ 227.170574] kvm_sys_reg_set_user 3427:(((3) << 19) | ((0) << 16) |
>>>> ((9) << 12) | ((14) << 8) | ((1) << 5))
>>>> [ 227.188037] kvm_sys_reg_set_user 3427:(((3) << 19) | ((0) << 16) |
>>>> ((9) << 12) | ((14) << 8) | ((2) << 5))
>>>> [ 227.205511] kvm_sys_reg_set_user 3427:SYS_MAIR_EL1
>>>> [ 227.218117] kvm_sys_reg_set_user 3427:SYS_PIRE0_EL1
>>> So what is this if not some form of tracing?
>> Ah, i was misunderstood your question. I thought you aksed whether
>> it is related to kernel tracing (which is already existed in kernel)
>> such as tracepoint or debugfs.
> But that's my point: tracepoints such as kvm_sys_access already output
> the name (as well as the encoding), and are likely to be affected by
> this problem.
>
> And that's a much more interesting justification for this change.
Got it. Thanks.
>
> Thanks,
>
> M.
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-07-14 3:13 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-12 7:55 [PATCH] KVM: arm64: Fix the name of sys_reg_desc related to PMU chenxiang
2023-07-12 8:36 ` Marc Zyngier
2023-07-13 2:35 ` chenxiang (M)
2023-07-13 6:56 ` Marc Zyngier
2023-07-13 9:10 ` chenxiang (M)
2023-07-13 9:40 ` Marc Zyngier
2023-07-14 3:13 ` chenxiang (M)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox