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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YY6U8UY3/9X2ZNYt@hirez.programming.kicks-ass.net>
Date:   Fri, 12 Nov 2021 17:23:13 +0100
From:   Peter Zijlstra <peterz@...radead.org>
To:     Stephane Eranian <eranian@...gle.com>
Cc:     linux-kernel@...r.kernel.org, kim.phillips@....com,
        acme@...hat.com, jolsa@...hat.com, songliubraving@...com,
        mpe@...erman.id.au, maddy@...ux.ibm.com
Subject: Re: [PATCH v2 03/13] perf/x86/amd: add AMD Fam19h Branch Sampling
 support

On Thu, Nov 11, 2021 at 12:44:05AM -0800, Stephane Eranian wrote:

> +static void amd_pmu_enable_event(struct perf_event *event)
> +{
> +	x86_pmu_enable_event(event);
> +
> +	if (__this_cpu_read(cpu_hw_events.enabled)) {
> +		if (is_amd_brs(&event->hw))
> +			amd_brs_enable();
> +	}

Does this path actually trigger? I thought we always use the enable_all
path these days. Could easily be I misremember though.

> +}
> +
> +static void amd_pmu_enable_all(int added)
> +{
> +	struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
> +	struct hw_perf_event *hwc;
> +	int idx;
> +
> +	for (idx = 0; idx < x86_pmu.num_counters; idx++) {
> +		hwc = &cpuc->events[idx]->hw;
> +
> +		/* only activate events which are marked as active */
> +		if (!test_bit(idx, cpuc->active_mask))
> +			continue;
> +
> +		amd_pmu_enable_event(cpuc->events[idx]);
> +	}
> +}

The thing is, since te BRS is a 'global' state, it doesn't really make
sense to enable it per-event.

Anyway, I think the above actually works, just wondering if we can
perhaps simplify it.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ