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:	Thu, 2 Apr 2009 20:58:54 +1100
From:	Paul Mackerras <paulus@...ba.org>
To:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc:	Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org,
	Mike Galbraith <efault@....de>,
	Arjan van de Ven <arjan@...radead.org>,
	Wu Fengguang <fengguang.wu@...el.com>
Subject: Re: [PATCH 2/9] perf_counter: fix update_userpage()

Peter Zijlstra writes:

> > Good point.  This should work, though:
> > 
> > 	do {
> > 		seq = pc->lock;
> > 		barrier();
> > 		value = read_pmc(pc->index) + pc->offset;
> > 		barrier();
> > 	} while (pc->lock != seq);
> > 	return value;
> 
> I don't think you need the first barrier(), all you need to avoid is it
> reusing the first pc->lock read, so one should suffice.

I need it to make sure that the compiler doesn't put the load of
pc->index or pc->offset before the first load of pc->lock.  The second
barrier is needed to make sure the compiler puts the second load of
pc->lock after the loads of pc->index and pc->offset.  So I think I do
need to barrier()s (but only compiler barriers, not cpu memory
barriers).

> Also, you need to handle the !pc->index case.

Hmmm, yeah.  I claim that read_pmc(0) always returns 0. :)

Paul.
--
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