<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/x86/include/asm/spinlock.h, branch linux-3.10.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.10.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.10.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2014-01-09T20:24:23Z</updated>
<entry>
<title>sched: fix the theoretical signal_wake_up() vs schedule() race</title>
<updated>2014-01-09T20:24:23Z</updated>
<author>
<name>Oleg Nesterov</name>
</author>
<published>2013-08-12T16:14:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=57f74b6ecebf59991677dd2da0f0433e8be6c945'/>
<id>urn:sha1:57f74b6ecebf59991677dd2da0f0433e8be6c945</id>
<content type='text'>
commit e0acd0a68ec7dbf6b7a81a87a867ebd7ac9b76c4 upstream.

This is only theoretical, but after try_to_wake_up(p) was changed
to check p-&gt;state under p-&gt;pi_lock the code like

	__set_current_state(TASK_INTERRUPTIBLE);
	schedule();

can miss a signal. This is the special case of wait-for-condition,
it relies on try_to_wake_up/schedule interaction and thus it does
not need mb() between __set_current_state() and if(signal_pending).

However, this __set_current_state() can move into the critical
section protected by rq-&gt;lock, now that try_to_wake_up() takes
another lock we need to ensure that it can't be reordered with
"if (signal_pending(current))" check inside that section.

The patch is actually one-liner, it simply adds smp_wmb() before
spin_lock_irq(rq-&gt;lock). This is what try_to_wake_up() already
does by the same reason.

We turn this wmb() into the new helper, smp_mb__before_spinlock(),
for better documentation and to allow the architectures to change
the default implementation.

While at it, kill smp_mb__after_lock(), it has no callers.

Perhaps we can also add smp_mb__before/after_spinunlock() for
prepare_to_wait().

Signed-off-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Acked-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>x86/spinlocks: Fix comment in spinlock.h</title>
<updated>2012-08-22T07:52:47Z</updated>
<author>
<name>Richard Weinberger</name>
</author>
<published>2012-08-14T21:47:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=83be4ffa1acbcd529b771f4d2e639b15e2b7957e'/>
<id>urn:sha1:83be4ffa1acbcd529b771f4d2e639b15e2b7957e</id>
<content type='text'>
This comment is no longer true.  We support up to 2^16 CPUs
because __ticket_t is an u16 if NR_CPUS is larger than 256.

Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
</content>
</entry>
<entry>
<title>x86: spinlock.h: Remove REG_PTR_MODE</title>
<updated>2012-03-30T17:01:59Z</updated>
<author>
<name>Richard Weinberger</name>
</author>
<published>2012-03-29T23:38:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=35372a7d45291140a97518a8d1c8cb0e31ee2bb7'/>
<id>urn:sha1:35372a7d45291140a97518a8d1c8cb0e31ee2bb7</id>
<content type='text'>
REG_PTR_MODE has no users at all.

Signed-off-by: Richard Weinberger &lt;richard@nod.at&gt;
Link: http://lkml.kernel.org/r/1333064283-3109-1-git-send-email-richard@nod.at
Acked-by: Acked-by: Jan Beulich &lt;jbeulich@suse.com&gt;
Signed-off-by: H. Peter Anvin &lt;hpa@zytor.com&gt;
</content>
</entry>
<entry>
<title>x86/spinlocks: Eliminate TICKET_MASK</title>
<updated>2012-02-07T09:09:54Z</updated>
<author>
<name>Jan Beulich</name>
</author>
<published>2012-02-03T15:06:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7931d493051ea9b09e4fddee2dc40b2eb88d62b9'/>
<id>urn:sha1:7931d493051ea9b09e4fddee2dc40b2eb88d62b9</id>
<content type='text'>
The definition of it being questionable already (unnecessarily
including a cast), and it being used in a single place that can
be written shorter without it, remove this #define.

Along the same lines, simplify __ticket_spin_is_locked()'s main
expression, which was the more convoluted way because of needs
that went away with the recent type changes by Jeremy.

This is pure cleanup, no functional change intended.

Signed-off-by: Jan Beulich &lt;jbeulich@suse.com&gt;
Acked-by: Jeremy Fitzhardinge &lt;jeremy@goop.org&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Peter Zijlstra &lt;a.p.zijlstra@chello.nl&gt;
Link: http://lkml.kernel.org/r/4F2C06020200007800071066@nat28.tlf.novell.com
Signed-off-by: Ingo Molnar &lt;mingo@elte.hu&gt;
</content>
</entry>
<entry>
<title>x86/cmpxchg: add a locked add() helper</title>
<updated>2011-11-25T18:42:59Z</updated>
<author>
<name>Jeremy Fitzhardinge</name>
</author>
<published>2011-09-28T18:49:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3d94ae0c70a71a9824479366775e2c7679a57d94'/>
<id>urn:sha1:3d94ae0c70a71a9824479366775e2c7679a57d94</id>
<content type='text'>
Mostly to remove some conditional code in spinlock.h.

Signed-off-by: Jeremy Fitzhardinge &lt;jeremy@goop.org&gt;
</content>
</entry>
<entry>
<title>x86, ticketlock: remove obsolete comment</title>
<updated>2011-09-28T06:37:20Z</updated>
<author>
<name>Jeremy Fitzhardinge</name>
</author>
<published>2011-09-09T00:50:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4a7f340c6a75ec5fca23d9c80a59f3f28cc4a61e'/>
<id>urn:sha1:4a7f340c6a75ec5fca23d9c80a59f3f28cc4a61e</id>
<content type='text'>
The note about partial registers is not really relevent now that we
rely on gcc to generate all the assembler.

Signed-off-by: Jeremy Fitzhardinge &lt;jeremy.fitzhardinge@citrix.com&gt;
</content>
</entry>
<entry>
<title>x86, ticketlock: Make __ticket_spin_trylock common</title>
<updated>2011-08-29T20:46:34Z</updated>
<author>
<name>Jeremy Fitzhardinge</name>
</author>
<published>2010-07-13T22:14:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=229855d6f3b40d01a903120c433d75e483a0b06d'/>
<id>urn:sha1:229855d6f3b40d01a903120c433d75e483a0b06d</id>
<content type='text'>
Make trylock code common regardless of ticket size.

(Also, rename arch_spinlock.slock to head_tail.)

Signed-off-by: Jeremy Fitzhardinge &lt;jeremy.fitzhardinge@citrix.com&gt;
Link: http://lkml.kernel.org/r/4E5BCC40.3030501@goop.org
Signed-off-by: H. Peter Anvin &lt;hpa@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>x86, ticketlock: Convert __ticket_spin_lock to use xadd()</title>
<updated>2011-08-29T20:46:07Z</updated>
<author>
<name>Jeremy Fitzhardinge</name>
</author>
<published>2010-07-13T21:07:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2994488fe5bb721de1ded53af1a2fc41f47f6ddc'/>
<id>urn:sha1:2994488fe5bb721de1ded53af1a2fc41f47f6ddc</id>
<content type='text'>
Convert the two variants of __ticket_spin_lock() to use xadd(), which
has the effect of making them identical, so remove the duplicate function.

Signed-off-by: Jeremy Fitzhardinge &lt;jeremy.fitzhardinge@citrix.com&gt;
Link: http://lkml.kernel.org/r/4E5BCC40.3030501@goop.org
Signed-off-by: H. Peter Anvin &lt;hpa@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>x86, ticketlock: Convert spin loop to C</title>
<updated>2011-08-29T20:45:43Z</updated>
<author>
<name>Jeremy Fitzhardinge</name>
</author>
<published>2010-07-03T00:06:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c576a3ea905c25d50339503e0e5c7fef724e0147'/>
<id>urn:sha1:c576a3ea905c25d50339503e0e5c7fef724e0147</id>
<content type='text'>
The inner loop of __ticket_spin_lock isn't doing anything very special,
so reimplement it in C.

For the 8 bit ticket lock variant, we use a register union to get direct
access to the lower and upper bytes in the tickets, but unfortunately gcc
won't generate a direct comparison between the two halves of the register,
so the generated asm isn't quite as pretty as the hand-coded version.
However benchmarking shows that this is actually a small improvement in
runtime performance on some benchmarks, and never a slowdown.

We also need to make sure there's a barrier at the end of the lock loop
to make sure that the compiler doesn't move any instructions from within
the locked region into the region where we don't yet own the lock.

Signed-off-by: Jeremy Fitzhardinge &lt;jeremy.fitzhardinge@citrix.com&gt;
Link: http://lkml.kernel.org/r/4E5BCC40.3030501@goop.org
Signed-off-by: H. Peter Anvin &lt;hpa@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>x86, ticketlock: Clean up types and accessors</title>
<updated>2011-08-29T20:45:19Z</updated>
<author>
<name>Jeremy Fitzhardinge</name>
</author>
<published>2010-07-02T22:26:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=84eb950db13ca40a0572ce9957e14723500943d6'/>
<id>urn:sha1:84eb950db13ca40a0572ce9957e14723500943d6</id>
<content type='text'>
A few cleanups to the way spinlocks are defined and accessed:
 - define __ticket_t which is the size of a spinlock ticket (ie, enough
   bits to hold all the cpus)
 - Define struct arch_spinlock as a union containing plain slock and
   the head and tail tickets
 - Use head and tail to implement some of the spinlock predicates.
 - Make all ticket variables unsigned.
 - Use TICKET_SHIFT to form constants

Most of this will be used in later patches.

Signed-off-by: Jeremy Fitzhardinge &lt;jeremy.fitzhardinge@citrix.com&gt;
Link: http://lkml.kernel.org/r/4E5BCC40.3030501@goop.org
Signed-off-by: H. Peter Anvin &lt;hpa@linux.intel.com&gt;
</content>
</entry>
</feed>
