lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 11 Mar 2021 17:13:55 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     "Liang, Kan" <kan.liang@...ux.intel.com>
Cc:     mingo@...nel.org, linux-kernel@...r.kernel.org, acme@...nel.org,
        tglx@...utronix.de, bp@...en8.de, namhyung@...nel.org,
        jolsa@...hat.com, ak@...ux.intel.com, yao.jin@...ux.intel.com,
        alexander.shishkin@...ux.intel.com, adrian.hunter@...el.com
Subject: Re: [PATCH V2 16/25] perf/x86: Register hybrid PMUs

On Thu, Mar 11, 2021 at 10:41:00AM -0500, Liang, Kan wrote:
> 
> 
> On 3/11/2021 7:34 AM, Peter Zijlstra wrote:
> > On Wed, Mar 10, 2021 at 08:37:52AM -0800, kan.liang@...ux.intel.com wrote:
> > > @@ -2092,9 +2105,37 @@ static int __init init_hw_perf_events(void)
> > >   	if (err)
> > >   		goto out1;
> > > -	err = perf_pmu_register(&pmu, "cpu", PERF_TYPE_RAW);
> > > -	if (err)
> > > -		goto out2;
> > > +	if (!is_hybrid()) {
> > > +		err = perf_pmu_register(&pmu, "cpu", PERF_TYPE_RAW);
> > > +		if (err)
> > > +			goto out2;
> > > +	} else {
> > > +		u8 cpu_type = get_hybrid_cpu_type(smp_processor_id());
> > > +		struct x86_hybrid_pmu *hybrid_pmu;
> > > +		int i;
> > > +
> > > +		for (i = 0; i < x86_pmu.num_hybrid_pmus; i++) {
> > > +			hybrid_pmu = &x86_pmu.hybrid_pmu[i];
> > > +
> > > +			hybrid_pmu->pmu = pmu;
> > > +			hybrid_pmu->pmu.type = -1;
> > > +			hybrid_pmu->pmu.attr_update = x86_pmu.attr_update;
> > > +			hybrid_pmu->pmu.capabilities |= PERF_PMU_CAP_HETEROGENEOUS_CPUS;
> > > +
> > > +			/* Only register the PMU for the boot CPU */
> > 
> > Why ?!
> > > AFAICT we could register them all here. That instantly fixes that
> > CPU_STARTING / CPU_DEAD fail elsewhere in this patch.
> 
> It's possible that all CPUs of a certain type all offline, but I cannot know
> the information here, because the boot CPU is the only online CPU. I don't
> know the status of the other CPUs.
> 
> If we unconditionally register all PMUs, users may see a PMU in
> /sys/devices, but they cannot use it, because there is no available CPU.
> Is it acceptable that registering an empty PMU?

Sure. That's what it has a cpumask for after all.

ISTR that being the case with some dodgy RAPL thing on SPR as well.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ