Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1413917
| From | "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC][PATCH 1/3] locking: Introduce smp_acquire__after_ctrl_dep |
| Date | 2016-06-05 06:40 +0200 |
| Message-ID | <rGy0W-2a4-1@gated-at.bofh.it> (permalink) |
| References | (5 earlier) <rFTKa-1on-7@gated-at.bofh.it> <rFW5k-2Y2-33@gated-at.bofh.it> <rFWoF-36Q-9@gated-at.bofh.it> <rFXuq-3Iu-27@gated-at.bofh.it> <rFXE6-3Ng-41@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, Jun 03, 2016 at 02:45:53PM +0100, Will Deacon wrote: > On Fri, Jun 03, 2016 at 06:32:38AM -0700, Paul E. McKenney wrote: > > On Fri, Jun 03, 2016 at 02:23:10PM +0200, Peter Zijlstra wrote: > > > On Fri, Jun 03, 2016 at 05:08:27AM -0700, Paul E. McKenney wrote: > > > > On Fri, Jun 03, 2016 at 11:38:34AM +0200, Peter Zijlstra wrote: > > > > > On Fri, Jun 03, 2016 at 02:48:38PM +0530, Vineet Gupta wrote: > > > > > > On Wednesday 25 May 2016 09:27 PM, Paul E. McKenney wrote: > > > > > > > For your example, but keeping the compiler in check: > > > > > > > > > > > > > > if (READ_ONCE(a)) > > > > > > > WRITE_ONCE(b, 1); > > > > > > > smp_rmb(); > > > > > > > WRITE_ONCE(c, 2); > > > > > > > > > > So I think it example is broken. The store to @c is not in fact > > > > > dependent on the condition of @a. > > > > > > > > At first glance, the compiler could pull the write to "c" above the > > > > conditional, but the "memory" constraint in smp_rmb() prevents this. > > > > From a hardware viewpoint, the write to "c" does depend on the "if", > > > > as the conditional branch does precede that write in execution order. > > > > > > > > But yes, this is using smp_rmb() in a very strange way, if that is > > > > what you are getting at. > > > > > > Well, the CPU could decide that the store to C happens either way around > > > the branch. I'm not sure I'd rely on CPUs not being _that_ clever. > > > > If I remember correctly, both Power and ARM guarantee that the CPU won't > > be that clever. Not sure about Itanium. > > I wouldn't be so sure about ARM. On 32-bit, at least, we have conditional > store instructions so if the compiler could somehow use one of those for > the first WRITE_ONCE then there's very obviously no control dependency > on the second WRITE_ONCE and they could be observed out of order. OK, good to know... > I note that smp_rmb() on ARM and arm64 actually orders against subsequent > (in program order) writes, so this is still pretty theoretical for us. So the combined control-dependency/smp_rmb() still works, but I should re-examine the straight control dependency stuff. Thanx, Paul
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [RFC][PATCH 1/3] locking: Introduce smp_acquire__after_ctrl_dep Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2016-06-03 11:20 +0200
Re: [RFC][PATCH 1/3] locking: Introduce smp_acquire__after_ctrl_dep Peter Zijlstra <peterz@infradead.org> - 2016-06-03 11:40 +0200
Re: [RFC][PATCH 1/3] locking: Introduce smp_acquire__after_ctrl_dep "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-03 14:10 +0200
Re: [RFC][PATCH 1/3] locking: Introduce smp_acquire__after_ctrl_dep Peter Zijlstra <peterz@infradead.org> - 2016-06-03 14:30 +0200
Re: [RFC][PATCH 1/3] locking: Introduce smp_acquire__after_ctrl_dep Peter Zijlstra <peterz@infradead.org> - 2016-06-03 14:30 +0200
Re: [RFC][PATCH 1/3] locking: Introduce smp_acquire__after_ctrl_dep "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-03 15:40 +0200
Re: [RFC][PATCH 1/3] locking: Introduce smp_acquire__after_ctrl_dep "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-03 15:40 +0200
Re: [RFC][PATCH 1/3] locking: Introduce smp_acquire__after_ctrl_dep Will Deacon <will.deacon@arm.com> - 2016-06-03 15:50 +0200
Re: [RFC][PATCH 1/3] locking: Introduce smp_acquire__after_ctrl_dep "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-05 06:40 +0200
Re: [RFC][PATCH 1/3] locking: Introduce smp_acquire__after_ctrl_dep "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-06 19:30 +0200
Re: [RFC][PATCH 1/3] locking: Introduce smp_acquire__after_ctrl_dep Peter Zijlstra <peterz@infradead.org> - 2016-06-07 09:20 +0200
Re: [RFC][PATCH 1/3] locking: Introduce smp_acquire__after_ctrl_dep Hannes Frederic Sowa <hannes@stressinduktion.org> - 2016-06-07 14:50 +0200
Re: [RFC][PATCH 1/3] locking: Introduce smp_acquire__after_ctrl_dep "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-07 15:10 +0200
Re: [RFC][PATCH 1/3] locking: Introduce smp_acquire__after_ctrl_dep Hannes Frederic Sowa <hannes@stressinduktion.org> - 2016-06-07 17:00 +0200
Re: [RFC][PATCH 1/3] locking: Introduce smp_acquire__after_ctrl_dep "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-07 17:30 +0200
Re: [RFC][PATCH 1/3] locking: Introduce smp_acquire__after_ctrl_dep Peter Zijlstra <peterz@infradead.org> - 2016-06-07 19:50 +0200
Re: [RFC][PATCH 1/3] locking: Introduce smp_acquire__after_ctrl_dep "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-07 20:50 +0200
Re: [RFC][PATCH 1/3] locking: Introduce smp_acquire__after_ctrl_dep Will Deacon <will.deacon@arm.com> - 2016-06-07 20:10 +0200
Re: [RFC][PATCH 1/3] locking: Introduce smp_acquire__after_ctrl_dep "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-07 20:50 +0200
Re: [RFC][PATCH 1/3] locking: Introduce smp_acquire__after_ctrl_dep "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2016-06-07 21:00 +0200
Re: [RFC][PATCH 1/3] locking: Introduce smp_acquire__after_ctrl_dep Hannes Frederic Sowa <hannes@stressinduktion.org> - 2016-06-07 20:40 +0200
csiph-web