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: <5f2efe0f-fb81-3bed-3aa4-a3b15d823946@amd.com>
Date:   Mon, 22 Aug 2022 20:08:29 +0530
From:   Ravi Bangoria <ravi.bangoria@....com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     acme@...nel.org, alexander.shishkin@...ux.intel.com,
        jolsa@...hat.com, namhyung@...nel.org, songliubraving@...com,
        eranian@...gle.com, alexey.budankov@...ux.intel.com,
        ak@...ux.intel.com, mark.rutland@....com, megha.dey@...el.com,
        frederic@...nel.org, maddy@...ux.ibm.com, irogers@...gle.com,
        kim.phillips@....com, linux-kernel@...r.kernel.org,
        santosh.shukla@....com, ravi.bangoria@....com
Subject: Re: [RFC v2] perf: Rewrite core context handling

[...]

> You mentioned trouble with cpc->task_epc, there's one rebase mistake
> from you and an original bug from me.
> 
> You lost the last hunk, I forgot to clear cpc on
> perf_remove_from_context().
> 
> With these fixes I can run: 'perf test' without things going
> insta-splat.
> 
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -2311,6 +2311,7 @@ __perf_remove_from_context(struct perf_e
>  			   struct perf_event_context *ctx,
>  			   void *info)
>  {
> +	struct perf_event_pmu_context *pmu_ctx = event->pmu_ctx;
>  	unsigned long flags = (unsigned long)info;
>  
>  	if (ctx->is_active & EVENT_TIME) {
> @@ -2325,8 +2326,17 @@ __perf_remove_from_context(struct perf_e
>  		perf_child_detach(event);
>  	list_del_event(event, ctx);
>  
> -	if (!event->pmu_ctx->nr_events)
> -		event->pmu_ctx->rotate_necessary = 0;
> +	if (!pmu_ctx->nr_events) {
> +		pmu_ctx->rotate_necessary = 0;
> +
> +		if (ctx->task) {

IIUC, this should also check for ctx->is_active? i.e.

		if (ctx->task && ctx->is_active) {
			...

> +			struct perf_cpu_pmu_context *cpc;
> +
> +			cpc = this_cpu_ptr(pmu_ctx->pmu->cpu_pmu_context);
> +			WARN_ON_ONCE(cpc->task_epc && cpc->task_epc != pmu_ctx);
> +			cpc->task_epc = NULL;
> +		}
> +	}

Thanks,
Ravi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ