<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/lib/rhashtable.c, branch v4.4.136</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.4.136</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.4.136'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2015-12-19T04:44:18Z</updated>
<entry>
<title>rhashtable: Kill harmless RCU warning in rhashtable_walk_init</title>
<updated>2015-12-19T04:44:18Z</updated>
<author>
<name>Herbert Xu</name>
<email>herbert@gondor.apana.org.au</email>
</author>
<published>2015-12-19T02:45:28Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=179ccc0a73641ffd24e44ff10a7bd494efe98d8d'/>
<id>urn:sha1:179ccc0a73641ffd24e44ff10a7bd494efe98d8d</id>
<content type='text'>
The commit c6ff5268293ef98e48a99597e765ffc417e39fa5 ("rhashtable:
Fix walker list corruption") causes a suspicious RCU usage warning
because we no longer hold ht-&gt;mutex when we dereference ht-&gt;tbl.

However, this is a false positive because we now hold ht-&gt;lock
which also guarantees that ht-&gt;tbl won't disppear from under us.

This patch kills the warning by using rcu_dereference_protected.

Reported-by: kernel test robot &lt;ying.huang@linux.intel.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>rhashtable: Fix walker list corruption</title>
<updated>2015-12-16T16:13:14Z</updated>
<author>
<name>Herbert Xu</name>
<email>herbert@gondor.apana.org.au</email>
</author>
<published>2015-12-16T08:45:54Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=c6ff5268293ef98e48a99597e765ffc417e39fa5'/>
<id>urn:sha1:c6ff5268293ef98e48a99597e765ffc417e39fa5</id>
<content type='text'>
The commit ba7c95ea3870fe7b847466d39a049ab6f156aa2c ("rhashtable:
Fix sleeping inside RCU critical section in walk_stop") introduced
a new spinlock for the walker list.  However, it did not convert
all existing users of the list over to the new spin lock.  Some
continued to use the old mutext for this purpose.  This obviously
led to corruption of the list.

The fix is to use the spin lock everywhere where we touch the list.

This also allows us to do rcu_rad_lock before we take the lock in
rhashtable_walk_start.  With the old mutex this would've deadlocked
but it's safe with the new spin lock.

Fixes: ba7c95ea3870 ("rhashtable: Fix sleeping inside RCU...")
Reported-by: Colin Ian King &lt;colin.king@canonical.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>rhashtable: Enforce minimum size on initial hash table</title>
<updated>2015-12-16T15:44:08Z</updated>
<author>
<name>Herbert Xu</name>
<email>herbert@gondor.apana.org.au</email>
</author>
<published>2015-12-16T10:13:14Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3a324606bbabfc30084ce9d08169910773ba9a92'/>
<id>urn:sha1:3a324606bbabfc30084ce9d08169910773ba9a92</id>
<content type='text'>
William Hua &lt;william.hua@canonical.com&gt; wrote:
&gt;
&gt; I wasn't aware there was an enforced minimum size. I simply set the
&gt; nelem_hint in the rhastable_params struct to 1, expecting it to grow as
&gt; needed. This caused a segfault afterwards when trying to insert an
&gt; element.

OK we're doing the size computation before we enforce the limit
on min_size.

---8&lt;---
We need to do the initial hash table size computation after we
have obtained the correct min_size/max_size parameters.  Otherwise
we may end up with a hash table whose size is outside the allowed
envelope.

Fixes: a998f712f77e ("rhashtable: Round up/down min/max_size to...")
Reported-by: William Hua &lt;william.hua@canonical.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>Revert "rhashtable: Use __vmalloc with GFP_ATOMIC for table allocation"</title>
<updated>2015-12-06T03:47:11Z</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2015-12-06T03:47:11Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a90099d9fabd2458084b9c2b79f1a62d9b76a61a'/>
<id>urn:sha1:a90099d9fabd2458084b9c2b79f1a62d9b76a61a</id>
<content type='text'>
This reverts commit d3716f18a7d841565c930efde30737a3557eee69.

vmalloc cannot be used in BH disabled contexts, even
with GFP_ATOMIC.  And we certainly want to support
rhashtable users inserting entries with software
interrupts disabled.

Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>rhashtable: Use __vmalloc with GFP_ATOMIC for table allocation</title>
<updated>2015-12-04T21:53:05Z</updated>
<author>
<name>Herbert Xu</name>
<email>herbert@gondor.apana.org.au</email>
</author>
<published>2015-12-04T14:39:56Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d3716f18a7d841565c930efde30737a3557eee69'/>
<id>urn:sha1:d3716f18a7d841565c930efde30737a3557eee69</id>
<content type='text'>
When an rhashtable user pounds rhashtable hard with back-to-back
insertions we may end up growing the table in GFP_ATOMIC context.
Unfortunately when the table reaches a certain size this often
fails because we don't have enough physically contiguous pages
to hold the new table.

Eric Dumazet suggested (and in fact wrote this patch) using
__vmalloc instead which can be used in GFP_ATOMIC context.

Reported-by: Phil Sutter &lt;phil@nwl.cc&gt;
Suggested-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>rhashtable: Prevent spurious EBUSY errors on insertion</title>
<updated>2015-12-04T19:38:26Z</updated>
<author>
<name>Herbert Xu</name>
<email>herbert@gondor.apana.org.au</email>
</author>
<published>2015-12-03T12:41:29Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3cf92222a39cc7842c373dd90a0c204fa7d7cced'/>
<id>urn:sha1:3cf92222a39cc7842c373dd90a0c204fa7d7cced</id>
<content type='text'>
Thomas and Phil observed that under stress rhashtable insertion
sometimes failed with EBUSY, even though this error should only
ever been seen when we're under attack and our hash chain length
has grown to an unacceptable level, even after a rehash.

It turns out that the logic for detecting whether there is an
existing rehash is faulty.  In particular, when two threads both
try to grow the same table at the same time, one of them may see
the newly grown table and thus erroneously conclude that it had
been rehashed.  This is what leads to the EBUSY error.

This patch fixes this by remembering the current last table we
used during insertion so that rhashtable_insert_rehash can detect
when another thread has also done a resize/rehash.  When this is
detected we will give up our resize/rehash and simply retry the
insertion with the new table.

Reported-by: Thomas Graf &lt;tgraf@suug.ch&gt;
Reported-by: Phil Sutter &lt;phil@nwl.cc&gt;
Signed-off-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Tested-by: Phil Sutter &lt;phil@nwl.cc&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>lib: fix data race in rhashtable_rehash_one</title>
<updated>2015-09-23T00:36:07Z</updated>
<author>
<name>Dmitriy Vyukov</name>
<email>dvyukov@google.com</email>
</author>
<published>2015-09-22T08:51:52Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=7def0f952eccdd0edb3c504f4dab35ee0d3aba1f'/>
<id>urn:sha1:7def0f952eccdd0edb3c504f4dab35ee0d3aba1f</id>
<content type='text'>
rhashtable_rehash_one() uses complex logic to update entry-&gt;next field,
after INIT_RHT_NULLS_HEAD and NULLS_MARKER expansion:

entry-&gt;next = 1 | ((base + off) &lt;&lt; 1)

This can be compiled along the lines of:

entry-&gt;next = base + off
entry-&gt;next &lt;&lt;= 1
entry-&gt;next |= 1

Which will break concurrent readers.

NULLS value recomputation is not needed here, so just remove
the complex logic.

The data race was found with KernelThreadSanitizer (KTSAN).

Signed-off-by: Dmitry Vyukov &lt;dvyukov@google.com&gt;
Acked-by: Eric Dumazet &lt;edumazet@google.com&gt;
Acked-by: Thomas Graf &lt;tgraf@suug.ch&gt;
Acked-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>rhashtable: fix for resize events during table walk</title>
<updated>2015-07-08T21:53:49Z</updated>
<author>
<name>Phil Sutter</name>
<email>phil@nwl.cc</email>
</author>
<published>2015-07-06T13:51:20Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=142b942a75cb10ede1b42bf85368d41449ab4e3b'/>
<id>urn:sha1:142b942a75cb10ede1b42bf85368d41449ab4e3b</id>
<content type='text'>
If rhashtable_walk_next detects a resize operation in progress, it jumps
to the new table and continues walking that one. But it misses to drop
the reference to it's current item, leading it to continue traversing
the new table's bucket in which the current item is sorted into, and
after reaching that bucket's end continues traversing the new table's
second bucket instead of the first one, thereby potentially missing
items.

This fixes the rhashtable runtime test for me. Bug probably introduced
by Herbert Xu's patch eddee5ba ("rhashtable: Fix walker behaviour during
rehash") although not explicitly tested.

Fixes: eddee5ba ("rhashtable: Fix walker behaviour during rehash")
Signed-off-by: Phil Sutter &lt;phil@nwl.cc&gt;
Acked-by: Herbert Xu &lt;herbert@gondor.apana.org.au&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
<entry>
<title>Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net</title>
<updated>2015-06-09T03:06:56Z</updated>
<author>
<name>David S. Miller</name>
<email>davem@davemloft.net</email>
</author>
<published>2015-06-09T03:06:56Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=941742f49762ba4c908510f036b09a46c1b14513'/>
<id>urn:sha1:941742f49762ba4c908510f036b09a46c1b14513</id>
<content type='text'>
</content>
</entry>
<entry>
<title>rhashtable: add missing import &lt;linux/export.h&gt;</title>
<updated>2015-06-07T07:10:15Z</updated>
<author>
<name>Hauke Mehrtens</name>
<email>hauke@hauke-m.de</email>
</author>
<published>2015-06-06T20:07:23Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=6d7954130c8d7100b7aba3c986fc4eefedf1a1ad'/>
<id>urn:sha1:6d7954130c8d7100b7aba3c986fc4eefedf1a1ad</id>
<content type='text'>
rhashtable uses EXPORT_SYMBOL_GPL() without importing linux/export.h
directly it is only imported indirectly through some other includes.

Signed-off-by: Hauke Mehrtens &lt;hauke@hauke-m.de&gt;
Signed-off-by: David S. Miller &lt;davem@davemloft.net&gt;
</content>
</entry>
</feed>
