Re: sx locks and memory barriers

2009-10-05 Thread John Baldwin
Attilio Rao wrote: 2009/9/29 John Baldwin j...@freebsd.org: On Tuesday 29 September 2009 4:42:13 pm Attilio Rao wrote: 2009/9/29 Max Laier m...@love2party.net: On Tuesday 29 September 2009 17:39:37 Attilio Rao wrote: 2009/9/25 Fabio Checconi fa...@freebsd.org: Hi all, looking at sys/sx.h I

Re: sx locks and memory barriers

2009-10-03 Thread Attilio Rao
2009/9/29 John Baldwin j...@freebsd.org: On Tuesday 29 September 2009 4:42:13 pm Attilio Rao wrote: 2009/9/29 Max Laier m...@love2party.net: On Tuesday 29 September 2009 17:39:37 Attilio Rao wrote: 2009/9/25 Fabio Checconi fa...@freebsd.org: Hi all, looking at sys/sx.h I have some

Re: sx locks and memory barriers

2009-09-30 Thread John Baldwin
On Tuesday 29 September 2009 5:39:43 pm Attilio Rao wrote: 2009/9/29 John Baldwin j...@freebsd.org: On Tuesday 29 September 2009 4:42:13 pm Attilio Rao wrote: 2009/9/29 Max Laier m...@love2party.net: On Tuesday 29 September 2009 17:39:37 Attilio Rao wrote: 2009/9/25 Fabio Checconi

Re: sx locks and memory barriers

2009-09-29 Thread Attilio Rao
2009/9/25 Fabio Checconi fa...@freebsd.org: Hi all, looking at sys/sx.h I have some troubles understanding this comment: * A note about memory barriers. Exclusive locks need to use the same * memory barriers as mutexes: _acq when acquiring an exclusive lock * and _rel when releasing an

Re: sx locks and memory barriers

2009-09-29 Thread Max Laier
On Tuesday 29 September 2009 17:39:37 Attilio Rao wrote: 2009/9/25 Fabio Checconi fa...@freebsd.org: Hi all, looking at sys/sx.h I have some troubles understanding this comment: * A note about memory barriers. Exclusive locks need to use the same * memory barriers as mutexes: _acq

Re: sx locks and memory barriers

2009-09-29 Thread John Baldwin
On Tuesday 29 September 2009 11:39:37 am Attilio Rao wrote: 2009/9/25 Fabio Checconi fa...@freebsd.org: Hi all, looking at sys/sx.h I have some troubles understanding this comment: * A note about memory barriers. Exclusive locks need to use the same * memory barriers as mutexes:

Re: sx locks and memory barriers

2009-09-29 Thread Attilio Rao
2009/9/29 John Baldwin j...@freebsd.org: On Tuesday 29 September 2009 11:39:37 am Attilio Rao wrote: 2009/9/25 Fabio Checconi fa...@freebsd.org: Hi all, looking at sys/sx.h I have some troubles understanding this comment: * A note about memory barriers. Exclusive locks need to use the

Re: sx locks and memory barriers

2009-09-29 Thread John Baldwin
On Tuesday 29 September 2009 3:15:40 pm Attilio Rao wrote: 2009/9/29 John Baldwin j...@freebsd.org: On Tuesday 29 September 2009 11:39:37 am Attilio Rao wrote: 2009/9/25 Fabio Checconi fa...@freebsd.org: Hi all, looking at sys/sx.h I have some troubles understanding this comment:

Re: sx locks and memory barriers

2009-09-29 Thread Attilio Rao
2009/9/29 John Baldwin j...@freebsd.org: On Tuesday 29 September 2009 3:15:40 pm Attilio Rao wrote: 2009/9/29 John Baldwin j...@freebsd.org: On Tuesday 29 September 2009 11:39:37 am Attilio Rao wrote: 2009/9/25 Fabio Checconi fa...@freebsd.org: Hi all, looking at sys/sx.h I have some

Re: sx locks and memory barriers

2009-09-29 Thread Attilio Rao
2009/9/29 Max Laier m...@love2party.net: On Tuesday 29 September 2009 17:39:37 Attilio Rao wrote: 2009/9/25 Fabio Checconi fa...@freebsd.org: Hi all, looking at sys/sx.h I have some troubles understanding this comment: * A note about memory barriers. Exclusive locks need to use the

Re: sx locks and memory barriers

2009-09-29 Thread Marius Nünnerich
On Tue, Sep 29, 2009 at 21:15, Attilio Rao atti...@freebsd.org wrote: 2009/9/29 John Baldwin j...@freebsd.org: On Tuesday 29 September 2009 11:39:37 am Attilio Rao wrote: 2009/9/25 Fabio Checconi fa...@freebsd.org: Hi all,  looking at sys/sx.h I have some troubles understanding this

Re: sx locks and memory barriers

2009-09-29 Thread Attilio Rao
2009/9/29 Marius Nünnerich mar...@nuenneri.ch: On Tue, Sep 29, 2009 at 21:15, Attilio Rao atti...@freebsd.org wrote: 2009/9/29 John Baldwin j...@freebsd.org: On Tuesday 29 September 2009 11:39:37 am Attilio Rao wrote: 2009/9/25 Fabio Checconi fa...@freebsd.org: Hi all, looking at sys/sx.h

Re: sx locks and memory barriers

2009-09-29 Thread John Baldwin
On Tuesday 29 September 2009 4:26:56 pm Marius Nünnerich wrote: On Tue, Sep 29, 2009 at 21:15, Attilio Rao atti...@freebsd.org wrote: 2009/9/29 John Baldwin j...@freebsd.org: On Tuesday 29 September 2009 11:39:37 am Attilio Rao wrote: 2009/9/25 Fabio Checconi fa...@freebsd.org: Hi all,

Re: sx locks and memory barriers

2009-09-29 Thread John Baldwin
On Tuesday 29 September 2009 4:42:13 pm Attilio Rao wrote: 2009/9/29 Max Laier m...@love2party.net: On Tuesday 29 September 2009 17:39:37 Attilio Rao wrote: 2009/9/25 Fabio Checconi fa...@freebsd.org: Hi all, looking at sys/sx.h I have some troubles understanding this comment: *

Re: sx locks and memory barriers

2009-09-29 Thread Attilio Rao
2009/9/29 John Baldwin j...@freebsd.org: On Tuesday 29 September 2009 4:42:13 pm Attilio Rao wrote: 2009/9/29 Max Laier m...@love2party.net: On Tuesday 29 September 2009 17:39:37 Attilio Rao wrote: 2009/9/25 Fabio Checconi fa...@freebsd.org: Hi all, looking at sys/sx.h I have some

Re: sx locks and memory barriers

2009-09-25 Thread Robert Noland
On Fri, 2009-09-25 at 00:49 +0200, Fabio Checconi wrote: Hi all, looking at sys/sx.h I have some troubles understanding this comment: * A note about memory barriers. Exclusive locks need to use the same * memory barriers as mutexes: _acq when acquiring an exclusive lock * and _rel

Re: sx locks and memory barriers

2009-09-25 Thread Ryan Stone
The code that Fabio proposes looks like this: sx_slock(data-lock); if (data-buffer) a = *data-buffer; sx_sunlock(data-lock); This point is that without a memory barrier on the unlock, the CPU is free to reorder the instructions into the order is his message.

Re: sx locks and memory barriers

2009-09-25 Thread Robert Noland
On Fri, 2009-09-25 at 09:30 -0400, Ryan Stone wrote: The code that Fabio proposes looks like this: sx_slock(data-lock); if (data-buffer) a = *data-buffer; sx_sunlock(data-lock); This point is that without a memory barrier on the unlock, the CPU is free to reorder the instructions

sx locks and memory barriers

2009-09-24 Thread Fabio Checconi
Hi all, looking at sys/sx.h I have some troubles understanding this comment: * A note about memory barriers. Exclusive locks need to use the same * memory barriers as mutexes: _acq when acquiring an exclusive lock * and _rel when releasing an exclusive lock. On the other side, * shared