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: <20090529091608.GA15278@elte.hu>
Date:	Fri, 29 May 2009 11:16:08 +0200
From:	Ingo Molnar <mingo@...e.hu>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	Paul Mackerras <paulus@...ba.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH RFC] perf_counter: Don't swap contexts containing
	locked mutex


* Ingo Molnar <mingo@...e.hu> wrote:

> 
> * Peter Zijlstra <peterz@...radead.org> wrote:
> 
> > On Fri, 2009-05-29 at 10:13 +0200, Peter Zijlstra wrote:
> > > On Fri, 2009-05-29 at 10:06 +0200, Peter Zijlstra wrote:
> > > 
> > > > static struct perf_counter_ctx *pin_ctx(struct perf_counter *counter, u64 *old_gen)
> > > > {
> > > > 	struct perf_counter_context *ctx;
> > > > 	unsigned long flags;
> > > > 
> > > > 	rcu_read_lock();
> > > > retry:
> > > > 	ctx = rcu_dereference(counter->ctx);
> > > > 	spin_lock_irqsave(&ctx->lock, flags);
> > > > 	if (ctx != rcu_dereference(counter->ctx))
> > > > 		goto retry;
> > > > 
> > > > 	*old_gen = ctx->generation;
> > > > 	ctx->generation = ~0ULL;
> > > > 	spin_unlock_irqrestore(&ctx->lock, flags);
> > > > 	rcu_read_unlock();
> > > > 
> > > > 	return ctx;
> > > > }
> > > > 
> > > > static void unpin_ctx(struct perf_counter_ctx *ctx, u64 old_gen)
> > > > {
> > > > 	unsigned long flags;
> > > > 
> > > > 	spin_lock_irqsave(&ctx->lock, flags);
> > > > 	ctx->generation = old_gen;
> > > > 	spin_unlock_irqrestore(&ctx->lock, flags);
> > > > }
> > > 
> > > OK, I think I got this wrong, counter->ctx isn't the problem.
> > > task->perf_counter_ctx is.
> > > 
> > > Still would be nice to write it in the above form. I'll go over the code
> > > again to see who else might want it.
> > 
> > OK, I went over the code, and your patch does indeed cover the few 
> > spots we need. It was just my brain going haywire and auditing the 
> > wrong pattern.
> 
> ok - i'll try this with my 'perf stat make -j' workload that 
> quickly locks up on a Nehalem. (bug introduced by the context 
> switch optimizations)

nope, that still hangs the box.

try the latest Git repo (i tried 95110d7) and do this:

  make clean
  perf stat -- make -j

that locks up for me, very quickly, with permanently stuck tasks:

   PID USER      PR  NI  VIRT  RES  SHR S  %CPU %MEM   TIME    COMMAND        
 10748 mingo     20   0     0    0    0 R 100.4  0.0   0:06.44 chmod         
 10756 mingo     20   0     0    0    0 R 100.4  0.0   0:06.43 touch         

looping in the remove-context retry loop.

	Ingo
--
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