<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/kernel/padata.c, branch v4.9.38</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.9.38</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.9.38'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2017-05-20T12:28:40Z</updated>
<entry>
<title>padata: free correct variable</title>
<updated>2017-05-20T12:28:40Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2017-04-07T00:33:30Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=6240377c574b06c5ef900cab3be2625e482ae8bf'/>
<id>urn:sha1:6240377c574b06c5ef900cab3be2625e482ae8bf</id>
<content type='text'>
commit 07a77929ba672d93642a56dc2255dd21e6e2290b upstream.

The author meant to free the variable that was just allocated, instead
of the one that failed to be allocated, but made a simple typo. This
patch rectifies that.

Signed-off-by: Jason A. Donenfeld &lt;Jason@zx2c4.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>padata: avoid race in reordering</title>
<updated>2017-04-08T07:30:36Z</updated>
<author>
<name>Jason A. Donenfeld</name>
<email>Jason@zx2c4.com</email>
</author>
<published>2017-03-23T11:24:43Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=eb8c62a3848e8b1df75c66933fa6cb6e347e6273'/>
<id>urn:sha1:eb8c62a3848e8b1df75c66933fa6cb6e347e6273</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: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>padata: Convert to hotplug state machine</title>
<updated>2016-09-19T19:44:30Z</updated>
<author>
<name>Sebastian Andrzej Siewior</name>
<email>bigeasy@linutronix.de</email>
</author>
<published>2016-09-06T17:04:49Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=30e92153b4e6f1cd01e30c34d9ef6f0986f96b0e'/>
<id>urn:sha1:30e92153b4e6f1cd01e30c34d9ef6f0986f96b0e</id>
<content type='text'>
Install the callbacks via the state machine. CPU-hotplug multinstance support
is used with the nocalls() version. Maybe parts of padata_alloc() could be
moved into the online callback so that we could invoke -&gt;startup callback for
instance and drop get_online_cpus().

Signed-off-by: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Cc: Steffen Klassert &lt;steffen.klassert@secunet.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: linux-crypto@vger.kernel.org
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160906170457.32393-14-bigeasy@linutronix.de
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;

</content>
</entry>
<entry>
<title>kernel/padata.c: hide unused functions</title>
<updated>2016-05-20T02:12:14Z</updated>
<author>
<name>Arnd Bergmann</name>
<email>arnd@arndb.de</email>
</author>
<published>2016-05-20T00:09:59Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=19d795b677bda354644cfb87a196b087fdc2a965'/>
<id>urn:sha1:19d795b677bda354644cfb87a196b087fdc2a965</id>
<content type='text'>
A recent cleanup removed some exported functions that were not used
anywhere, which in turn exposed the fact that some other functions in
the same file are only used in some configurations.

We now get a warning about them when CONFIG_HOTPLUG_CPU is disabled:

  kernel/padata.c:670:12: error: '__padata_remove_cpu' defined but not used [-Werror=unused-function]
   static int __padata_remove_cpu(struct padata_instance *pinst, int cpu)
              ^~~~~~~~~~~~~~~~~~~
  kernel/padata.c:650:12: error: '__padata_add_cpu' defined but not used [-Werror=unused-function]
   static int __padata_add_cpu(struct padata_instance *pinst, int cpu)

This rearranges the code so the __padata_remove_cpu/__padata_add_cpu
functions are within the #ifdef that protects the code that calls them.

[akpm@linux-foundation.org: coding-style fixes]
Fixes: 4ba6d78c671e ("kernel/padata.c: removed unused code")
Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Richard Cochran &lt;rcochran@linutronix.de&gt;
Cc: Steffen Klassert &lt;steffen.klassert@secunet.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>kernel/padata.c: removed unused code</title>
<updated>2016-05-20T02:12:14Z</updated>
<author>
<name>Richard Cochran</name>
<email>rcochran@linutronix.de</email>
</author>
<published>2016-05-20T00:09:56Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=815613da6a67c196d7458d0e6c278ea88e21933f'/>
<id>urn:sha1:815613da6a67c196d7458d0e6c278ea88e21933f</id>
<content type='text'>
By accident I stumbled across code that has never been used.  This
driver has EXPORT_SYMBOL functions, and the only user of the code is
pcrypt.c, but this only uses a subset of the exported symbols.

According to 'git log -G', the functions, padata_set_cpumasks,
padata_add_cpu, and padata_remove_cpu have never been used since they
were first introduced.  This patch removes the unused code.

On one 64 bit build, with CRYPTO_PCRYPT built in, the text is more than
4k smaller.

  kbuild_hp&gt; size $KBUILD_OUTPUT/vmlinux
      text    data     bss      dec hex    filename
  10566658 4678360 1122304 16367322 f9beda vmlinux
  10561984 4678360 1122304 16362648 f9ac98 vmlinux

On another config, 32 bit, the saving is about 0.5k bytes.

  kbuild_hp-x86&gt; size $KBUILD_OUTPUT/vmlinux
  6012005 2409513 2785280 11206798 ab008e vmlinux
  6011491 2409513 2785280 11206284 aafe8c vmlinux

Signed-off-by: Richard Cochran &lt;rcochran@linutronix.de&gt;
Cc: Steffen Klassert &lt;steffen.klassert@secunet.com&gt;
Cc: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>padata: use %*pb[l] to print bitmaps including cpumasks and nodemasks</title>
<updated>2015-02-14T05:21:38Z</updated>
<author>
<name>Tejun Heo</name>
<email>tj@kernel.org</email>
</author>
<published>2015-02-13T22:38:05Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=4497da6f950951b8819cd827bbebb8f214e8ecbe'/>
<id>urn:sha1:4497da6f950951b8819cd827bbebb8f214e8ecbe</id>
<content type='text'>
printk and friends can now format bitmaps using '%*pb[l]'.  cpumask
and nodemask also provide cpumask_pr_args() and nodemask_pr_args()
respectively which can be used to generate the two printf arguments
necessary to format the specified cpu/nodemask.

Signed-off-by: Tejun Heo &lt;tj@kernel.org&gt;
Cc: Steffen Klassert &lt;steffen.klassert@secunet.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>padata: Fix wrong usage of rcu_dereference()</title>
<updated>2013-12-05T13:28:42Z</updated>
<author>
<name>Mathias Krause</name>
<email>minipli@googlemail.com</email>
</author>
<published>2013-11-28T18:20:05Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=c0e656b7a6e1ac03b2921d49211a735893efd544'/>
<id>urn:sha1:c0e656b7a6e1ac03b2921d49211a735893efd544</id>
<content type='text'>
A kernel with enabled lockdep complains about the wrong usage of
rcu_dereference() under a rcu_read_lock_bh() protected region.

  ===============================
  [ INFO: suspicious RCU usage. ]
  3.13.0-rc1+ #126 Not tainted
  -------------------------------
  linux/kernel/padata.c:115 suspicious rcu_dereference_check() usage!

  other info that might help us debug this:

  rcu_scheduler_active = 1, debug_locks = 1
  1 lock held by cryptomgr_test/153:
   #0:  (rcu_read_lock_bh){.+....}, at: [&lt;ffffffff8115c235&gt;] padata_do_parallel+0x5/0x270

Fix that by using rcu_dereference_bh() instead.

Signed-off-by: Mathias Krause &lt;minipli@googlemail.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: make the sequence counter an atomic_t</title>
<updated>2013-10-30T04:02:58Z</updated>
<author>
<name>Mathias Krause</name>
<email>mathias.krause@secunet.com</email>
</author>
<published>2013-10-25T10:14:15Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=0b6b098efcddac2bf4e2a895c9b655560bbfcee4'/>
<id>urn:sha1:0b6b098efcddac2bf4e2a895c9b655560bbfcee4</id>
<content type='text'>
Using a spinlock to atomically increase a counter sounds wrong -- we've
atomic_t for this!

Also move 'seq_nr' to a different cache line than 'lock' to reduce cache
line trashing. This has the nice side effect of decreasing the size of
struct parallel_data from 192 to 128 bytes for a x86-64 build, e.g.
occupying only two instead of three cache lines.

Those changes results in a 5% performance increase on an IPsec test run
using pcrypt.

Btw. the seq_lock spinlock was never explicitly initialized -- one more
reason to get rid of it.

Signed-off-by: Mathias Krause &lt;mathias.krause@secunet.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 - Register hotcpu notifier after initialization</title>
<updated>2013-08-29T04:37:59Z</updated>
<author>
<name>Richard Weinberger</name>
<email>richard@nod.at</email>
</author>
<published>2013-08-23T11:12:33Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=b8b4a4166e3401b7d8ea9deb8d64d875a468144c'/>
<id>urn:sha1:b8b4a4166e3401b7d8ea9deb8d64d875a468144c</id>
<content type='text'>
padata_cpu_callback() takes pinst-&gt;lock, to avoid taking
an uninitialized lock, register the notifier after it's
initialization.

Signed-off-by: Richard Weinberger &lt;richard@nod.at&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 - share code between CPU_ONLINE and CPU_DOWN_FAILED, same to CPU_DOWN_PREPARE and CPU_UP_CANCELED</title>
<updated>2013-08-29T04:37:59Z</updated>
<author>
<name>Chen Gang</name>
<email>gang.chen@asianux.com</email>
</author>
<published>2013-08-22T06:43:37Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=9c823f9f7e4b392921d0d8b251bec080d58f9077'/>
<id>urn:sha1:9c823f9f7e4b392921d0d8b251bec080d58f9077</id>
<content type='text'>
Share code between CPU_ONLINE and CPU_DOWN_FAILED, same to
CPU_DOWN_PREPARE and CPU_UP_CANCELED.

It will fix 2 bugs:

  "not check the return value of __padata_remove_cpu() and __padata_add_cpu()".
  "need add 'break' between CPU_UP_CANCELED and CPU_DOWN_FAILED".

Signed-off-by: Chen Gang &lt;gang.chen@asianux.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>
</feed>
