[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <gsnt8qqu377k.fsf@coltonlewis-kvm.c.googlers.com>
Date: Tue, 28 Jan 2025 22:27:11 +0000
From: Colton Lewis <coltonlewis@...gle.com>
To: Rob Herring <robh@...nel.org>
Cc: kvm@...r.kernel.org, linux@...linux.org.uk, catalin.marinas@....com,
will@...nel.org, maz@...nel.org, oliver.upton@...ux.dev, joey.gouly@....com,
suzuki.poulose@....com, yuzenghui@...wei.com, mark.rutland@....com,
pbonzini@...hat.com, shuah@...nel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, kvmarm@...ts.linux.dev,
linux-kselftest@...r.kernel.org
Subject: Re: [RFC PATCH 1/4] perf: arm_pmuv3: Introduce module param to
partition the PMU
Hey Rob, thanks for the review.
Rob Herring <robh@...nel.org> writes:
> On Mon, Jan 27, 2025 at 4:26 PM Colton Lewis <coltonlewis@...gle.com>
> wrote:
>> @@ -1215,10 +1243,19 @@ static void __armv8pmu_probe_pmu(void *info)
>> cpu_pmu->pmuver = pmuver;
>> probe->present = true;
>> + pmcr_n = FIELD_GET(ARMV8_PMU_PMCR_N, armv8pmu_pmcr_read());
>> /* Read the nb of CNTx counters supported from PMNC */
>> - bitmap_set(cpu_pmu->cntr_mask,
>> - 0, FIELD_GET(ARMV8_PMU_PMCR_N, armv8pmu_pmcr_read()));
>> + bitmap_set(cpu_pmu->cntr_mask, 0, pmcr_n);
>> +
>> + if (reserved_guest_counters > 0 && reserved_guest_counters <
>> pmcr_n) {
>> + cpu_pmu->hpmn = reserved_guest_counters;
>> + cpu_pmu->partitioned = true;
> You're storing the same information 3 times. 'partitioned' is just
> 'reserved_guest_counters != 0' or 'cpu_pmu->hpmn != pmcr_n'.
Yes, because code outside this module that isn't already reading PMCR.N
will need to know the result of that comparion.
>> + } else {
>> + reserved_guest_counters = 0;
>> + cpu_pmu->hpmn = pmcr_n;
>> + cpu_pmu->partitioned = false;
>> + }
>> /* Add the CPU cycles counter */
>> set_bit(ARMV8_PMU_CYCLE_IDX, cpu_pmu->cntr_mask);
>> @@ -1516,3 +1553,5 @@ void arch_perf_update_userpage(struct perf_event
>> *event,
>> userpg->cap_user_time_zero = 1;
>> userpg->cap_user_time_short = 1;
>> }
>> +
>> +module_param(reserved_guest_counters, byte, 0);
> Module params are generally discouraged. Since this driver can't be a
> module, this is a boot time only option. There's little reason this
> can't be a sysfs setting. There's some complexity in changing this
> when counters are in use (just reject the change) and when we have
> asymmetric PMUs. Alternatively, it could be a sysctl like user access.
I see what you mean. I'm not dealing with those complexities yet. That's
why this is an RFC.
> Rob
Powered by blists - more mailing lists