* [REGRESSION] boot regression in next-20170428
@ 2017-04-28 15:08 Niklas Cassel
2017-04-28 16:06 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Niklas Cassel @ 2017-04-28 15:08 UTC (permalink / raw)
To: herbert, davem; +Cc: linux-kernel
Hello
Since next-20170428
the ARTPEC-6 SoC (MACH_ARTPEC6) does no longer boot.
It works fine with next-20170427.
I've bisected it to the following commit:
6d684e54690caef45cf14051ddeb7c71beeb681b is the first bad commit
commit 6d684e54690caef45cf14051ddeb7c71beeb681b
Author: Herbert Xu <herbert@gondor.apana.org.au>
Date: Thu Apr 27 13:44:51 2017 +0800
rhashtable: Cap total number of entries to 2^31
When max_size is not set or if it set to a sufficiently large
value, the nelems counter can overflow. This would cause havoc
with the automatic shrinking as it would then attempt to fit a
huge number of entries into a tiny hash table.
This patch fixes this by adding max_elems to struct rhashtable
to cap the number of elements. This is set to 2^31 as nelems is
not a precise count. This is sufficiently smaller than UINT_MAX
that it should be safe.
When max_size is set max_elems will be lowered to at most twice
max_size as is the status quo.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Enabling earlyprintk does not give any more info,
it simply hangs after:
JUMP dest=0x2000000 dtb=0x2900000 machine=0x1399 initrd=0x02a00000/0x0021b193 cmdline="earlyprintk debug initcall_debug=1"
Uncompressing Linux... done, booting the kernel.
Regards,
Niklas
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [REGRESSION] boot regression in next-20170428
2017-04-28 15:08 [REGRESSION] boot regression in next-20170428 Niklas Cassel
@ 2017-04-28 16:06 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2017-04-28 16:06 UTC (permalink / raw)
To: niklas.cassel; +Cc: herbert, linux-kernel
From: Niklas Cassel <niklas.cassel@axis.com>
Date: Fri, 28 Apr 2017 17:08:17 +0200
> Hello
>
>
> Since next-20170428
> the ARTPEC-6 SoC (MACH_ARTPEC6) does no longer boot.
>
> It works fine with next-20170427.
>
>
> I've bisected it to the following commit:
>
> 6d684e54690caef45cf14051ddeb7c71beeb681b is the first bad commit
> commit 6d684e54690caef45cf14051ddeb7c71beeb681b
> Author: Herbert Xu <herbert@gondor.apana.org.au>
> Date: Thu Apr 27 13:44:51 2017 +0800
>
> rhashtable: Cap total number of entries to 2^31
Fixed by:
>From 2d2ab658d2debcb4c0e29c9e6f18e5683f3077bf Mon Sep 17 00:00:00 2001
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Fri, 28 Apr 2017 14:10:48 +0800
Subject: [PATCH] rhashtable: Do not lower max_elems when max_size is zero
The commit 6d684e54690c ("rhashtable: Cap total number of entries
to 2^31") breaks rhashtable users that do not set max_size. This
is because when max_size is zero max_elems is also incorrectly set
to zero instead of 2^31.
This patch fixes it by only lowering max_elems when max_size is not
zero.
Fixes: 6d684e54690c ("rhashtable: Cap total number of entries to 2^31")
Reported-by: Florian Fainelli <f.fainelli@gmail.com>
Reported-by: kernel test robot <fengguang.wu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
lib/rhashtable.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index 751630b..3895486 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -958,13 +958,14 @@ int rhashtable_init(struct rhashtable *ht,
if (params->min_size)
ht->p.min_size = roundup_pow_of_two(params->min_size);
- if (params->max_size)
- ht->p.max_size = rounddown_pow_of_two(params->max_size);
-
/* Cap total entries at 2^31 to avoid nelems overflow. */
ht->max_elems = 1u << 31;
- if (ht->p.max_size < ht->max_elems / 2)
- ht->max_elems = ht->p.max_size * 2;
+
+ if (params->max_size) {
+ ht->p.max_size = rounddown_pow_of_two(params->max_size);
+ if (ht->p.max_size < ht->max_elems / 2)
+ ht->max_elems = ht->p.max_size * 2;
+ }
ht->p.min_size = max(ht->p.min_size, HASH_MIN_SIZE);
--
2.4.11
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-28 16:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-28 15:08 [REGRESSION] boot regression in next-20170428 Niklas Cassel
2017-04-28 16:06 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®