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]
Date:	Sun, 13 Nov 2011 18:06:05 +0200
From:	Gleb Natapov <gleb@...hat.com>
To:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc:	linux-kernel@...r.kernel.org, Paul Mackerras <paulus@...ba.org>,
	Ingo Molnar <mingo@...e.hu>,
	Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Subject: Re: [PATCH] perf: do not set task_ctx pointer in cpuctx if there is
 no events in the context

On Mon, Nov 07, 2011 at 02:00:11PM +0100, Peter Zijlstra wrote:
> On Thu, 2011-11-03 at 09:41 +0200, Gleb Natapov wrote:
> > Ingo, Peter can you look into this please.
> 
> queued it and the jump_label thing.
I see jump_label thing in tip/perf/core but not this one yet. This is
good because this one needs amendment :) See below.

---

Do not set task_ctx pointer during sched_in if there is no
events associated with the context.  Otherwise if during task
execution total number of events in the system will become zero
perf_event_context_sched_out() will not be called and cpuctx->task_ctx
will be left with a stale value. Also perf_event_sched_in() shouldn't try
to schedule task events in this case otherwise cpuctx->task_ctx->is_active
will not be cleared during sched_out and will become incorrect.

Signed-off-by: Gleb Natapov <gleb@...hat.com>
diff --git a/kernel/events/core.c b/kernel/events/core.c
index d1a1bee..7210657 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -2171,9 +2171,10 @@ static void perf_event_context_sched_in(struct perf_event_context *ctx,
 	 */
 	cpu_ctx_sched_out(cpuctx, EVENT_FLEXIBLE);
 
-	perf_event_sched_in(cpuctx, ctx, task);
+	if (ctx->nr_events)
+		cpuctx->task_ctx = ctx;
 
-	cpuctx->task_ctx = ctx;
+	perf_event_sched_in(cpuctx, cpuctx->task_ctx, task);
 
 	perf_pmu_enable(ctx->pmu);
 	perf_ctx_unlock(cpuctx, ctx);
--
			Gleb.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ