<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/kernel/padata.c, 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>2017-06-20T12:04:40Z</updated>
<entry>
<title>padata: avoid race in reordering</title>
<updated>2017-06-20T12:04:40Z</updated>
<author>
<name>Jason A. Donenfeld</name>
</author>
<published>2017-03-23T11:24:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7a76e42ecca6c06b1551120df6ea5c35f524f6ed'/>
<id>urn:sha1:7a76e42ecca6c06b1551120df6ea5c35f524f6ed</id>
<content type='text'>
commit de5540d088fe97ad583cc7d396586437b32149a5 upstream.

Under extremely heavy uses of padata, crashes occur, and with list
debugging turned on, this happens instead:

[87487.298728] WARNING: CPU: 1 PID: 882 at lib/list_debug.c:33
__list_add+0xae/0x130
[87487.301868] list_add corruption. prev-&gt;next should be next
(ffffb17abfc043d0), but was ffff8dba70872c80. (prev=ffff8dba70872b00).
[87487.339011]  [&lt;ffffffff9a53d075&gt;] dump_stack+0x68/0xa3
[87487.342198]  [&lt;ffffffff99e119a1&gt;] ? console_unlock+0x281/0x6d0
[87487.345364]  [&lt;ffffffff99d6b91f&gt;] __warn+0xff/0x140
[87487.348513]  [&lt;ffffffff99d6b9aa&gt;] warn_slowpath_fmt+0x4a/0x50
[87487.351659]  [&lt;ffffffff9a58b5de&gt;] __list_add+0xae/0x130
[87487.354772]  [&lt;ffffffff9add5094&gt;] ? _raw_spin_lock+0x64/0x70
[87487.357915]  [&lt;ffffffff99eefd66&gt;] padata_reorder+0x1e6/0x420
[87487.361084]  [&lt;ffffffff99ef0055&gt;] padata_do_serial+0xa5/0x120

padata_reorder calls list_add_tail with the list to which its adding
locked, which seems correct:

spin_lock(&amp;squeue-&gt;serial.lock);
list_add_tail(&amp;padata-&gt;list, &amp;squeue-&gt;serial.list);
spin_unlock(&amp;squeue-&gt;serial.lock);

This therefore leaves only place where such inconsistency could occur:
if padata-&gt;list is added at the same time on two different threads.
This pdata pointer comes from the function call to
padata_get_next(pd), which has in it the following block:

next_queue = per_cpu_ptr(pd-&gt;pqueue, cpu);
padata = NULL;
reorder = &amp;next_queue-&gt;reorder;
if (!list_empty(&amp;reorder-&gt;list)) {
       padata = list_entry(reorder-&gt;list.next,
                           struct padata_priv, list);
       spin_lock(&amp;reorder-&gt;lock);
       list_del_init(&amp;padata-&gt;list);
       atomic_dec(&amp;pd-&gt;reorder_objects);
       spin_unlock(&amp;reorder-&gt;lock);

       pd-&gt;processed++;

       goto out;
}
out:
return padata;

I strongly suspect that the problem here is that two threads can race
on reorder list. Even though the deletion is locked, call to
list_entry is not locked, which means it's feasible that two threads
pick up the same padata object and subsequently call list_add_tail on
them at the same time. The fix is thus be hoist that lock outside of
that block.

Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
Acked-by: Steffen Klassert &lt;steffen.klassert@secunet.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Willy Tarreau &lt;w@1wt.eu&gt;
</content>
</entry>
<entry>
<title>padata: use __this_cpu_read per-cpu helper</title>
<updated>2012-12-06T09:16:23Z</updated>
<author>
<name>Shan Wei</name>
</author>
<published>2012-12-06T09:16:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f0fcf2002bf122afe8fe1b74b2cee3710c7e6cd9'/>
<id>urn:sha1:f0fcf2002bf122afe8fe1b74b2cee3710c7e6cd9</id>
<content type='text'>
For bottom halves off, __this_cpu_read is better.

Signed-off-by: Shan Wei &lt;davidshan@tencent.com&gt;
Reviewed-by: Christoph Lameter &lt;cl@linux.com&gt;
Acked-by: Steffen Klassert &lt;steffen.klassert@secunet.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>padata: Fix cpu hotplug</title>
<updated>2012-03-29T11:52:46Z</updated>
<author>
<name>Steffen Klassert</name>
</author>
<published>2012-03-28T06:44:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9612090527526a15832480c48b1f4b39e93e8a35'/>
<id>urn:sha1:9612090527526a15832480c48b1f4b39e93e8a35</id>
<content type='text'>
We don't remove the cpu that went offline from our cpumasks
on cpu hotplug. This got lost somewhere along the line, so
restore it. This fixes a hang of the padata instance on cpu
hotplug.

Signed-off-by: Steffen Klassert &lt;steffen.klassert@secunet.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>padata: Use the online cpumask as the default</title>
<updated>2012-03-29T11:52:46Z</updated>
<author>
<name>Steffen Klassert</name>
</author>
<published>2012-03-28T06:43:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=13614e0fb1a8840c134be35c179ff23e23676304'/>
<id>urn:sha1:13614e0fb1a8840c134be35c179ff23e23676304</id>
<content type='text'>
We use the active cpumask to determine the superset of cpus
to use for parallelization. However, the active cpumask is
for internal usage of the scheduler and therefore not the
appropriate cpumask for these purposes. So use the online
cpumask instead.

Reported-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Signed-off-by: Steffen Klassert &lt;steffen.klassert@secunet.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>padata: Add a reference to the api documentation</title>
<updated>2012-03-29T11:52:45Z</updated>
<author>
<name>Steffen Klassert</name>
</author>
<published>2012-03-28T06:42:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=107f8bdac992356b3a80d41c9f6ff4399159aa81'/>
<id>urn:sha1:107f8bdac992356b3a80d41c9f6ff4399159aa81</id>
<content type='text'>
Add a reference to the padata api documentation at Documentation/padata.txt

Suggested-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Signed-off-by: Steffen Klassert &lt;steffen.klassert@secunet.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>padata: Fix race on sequence number wrap</title>
<updated>2012-03-14T09:25:56Z</updated>
<author>
<name>Steffen Klassert</name>
</author>
<published>2012-03-09T06:20:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2dc9b5dbdef09840de852a4f0cc6a9c9eece7220'/>
<id>urn:sha1:2dc9b5dbdef09840de852a4f0cc6a9c9eece7220</id>
<content type='text'>
When padata_do_parallel() is called from multiple cpus for the same
padata instance, we can get object reordering on sequence number wrap
because testing for sequence number wrap and reseting the sequence
number must happen atomically but is implemented with two atomic
operations. This patch fixes this by converting the sequence number
from atomic_t to an unsigned int and protect the access with a
spin_lock. As a side effect, we get rid of the sequence number wrap
handling because the seqence number wraps back to null now without
the need to do anything.

Signed-off-by: Steffen Klassert &lt;steffen.klassert@secunet.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>padata: Fix race in the serialization path</title>
<updated>2012-03-14T09:25:56Z</updated>
<author>
<name>Steffen Klassert</name>
</author>
<published>2012-03-09T06:20:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3047817b894ddae62be07787bc8735a616104398'/>
<id>urn:sha1:3047817b894ddae62be07787bc8735a616104398</id>
<content type='text'>
When a padata object is queued to the serialization queue, another
cpu might process and free the padata object. So don't dereference
it after queueing to the serialization queue.

Signed-off-by: Steffen Klassert &lt;steffen.klassert@secunet.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
</content>
</entry>
<entry>
<title>kernel: Map most files to use export.h instead of module.h</title>
<updated>2011-10-31T13:20:12Z</updated>
<author>
<name>Paul Gortmaker</name>
</author>
<published>2011-05-23T18:51:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9984de1a5a8a96275fcab818f7419af5a3c86e71'/>
<id>urn:sha1:9984de1a5a8a96275fcab818f7419af5a3c86e71</id>
<content type='text'>
The changed files were only including linux/module.h for the
EXPORT_SYMBOL infrastructure, and nothing else.  Revector them
onto the isolated export header for faster compile times.

Nothing to see here but a whole lot of instances of:

  -#include &lt;linux/module.h&gt;
  +#include &lt;linux/export.h&gt;

This commit is only changing the kernel dir; next targets
will probably be mm, fs, the arch dirs, etc.

Signed-off-by: Paul Gortmaker &lt;paul.gortmaker@windriver.com&gt;
</content>
</entry>
<entry>
<title>Fix common misspellings</title>
<updated>2011-03-31T14:26:23Z</updated>
<author>
<name>Lucas De Marchi</name>
</author>
<published>2011-03-31T01:57:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=25985edcedea6396277003854657b5f3cb31a628'/>
<id>urn:sha1:25985edcedea6396277003854657b5f3cb31a628</id>
<content type='text'>
Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi &lt;lucas.demarchi@profusion.mobi&gt;
</content>
</entry>
<entry>
<title>Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6</title>
<updated>2010-08-04T22:23:14Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2010-08-04T22:23:14Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b7c8e55db7141dcbb9d5305a3260fa0ed62a1bcc'/>
<id>urn:sha1:b7c8e55db7141dcbb9d5305a3260fa0ed62a1bcc</id>
<content type='text'>
* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (39 commits)
  random: Reorder struct entropy_store to remove padding on 64bits
  padata: update API documentation
  padata: Remove padata_get_cpumask
  crypto: pcrypt - Update pcrypt cpumask according to the padata cpumask notifier
  crypto: pcrypt - Rename pcrypt_instance
  padata: Pass the padata cpumasks to the cpumask_change_notifier chain
  padata: Rearrange set_cpumask functions
  padata: Rename padata_alloc functions
  crypto: pcrypt - Dont calulate a callback cpu on empty callback cpumask
  padata: Check for valid cpumasks
  padata: Allocate cpumask dependend recources in any case
  padata: Fix cpu index counting
  crypto: geode_aes - Convert pci_table entries to PCI_VDEVICE (if PCI_ANY_ID is used)
  pcrypt: Added sysfs interface to pcrypt
  padata: Added sysfs primitives to padata subsystem
  padata: Make two separate cpumasks
  padata: update documentation
  padata: simplify serialization mechanism
  padata: make padata_do_parallel to return zero on success
  padata: Handle empty padata cpumasks
  ...
</content>
</entry>
</feed>
