From: Linus Torvalds <torvalds@linux-foundation.org>
To: Guenter Roeck <linux@roeck-us.net>,
Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Vlastimil Babka <vbabka@suse.cz>,
linux-kernel@vger.kernel.org, Linux-MM <linux-mm@kvack.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 6.10 000/809] 6.10.3-rc3 review
Date: Tue, 6 Aug 2024 10:49:58 -0700 [thread overview]
Message-ID: <CAHk-=wiss_E41A1uH0-1MXF-GjxzW_Rbz+Xbs+fbr-vyQFpo4g@mail.gmail.com> (raw)
In-Reply-To: <CAHk-=wjmumbT73xLkSAnnxDwaFE__Ny=QCp6B_LE2aG1SUqiTg@mail.gmail.com>
[ Adding s390 people, this is strange ]
New people, see
https://lore.kernel.org/all/CAHk-=wjmumbT73xLkSAnnxDwaFE__Ny=QCp6B_LE2aG1SUqiTg@mail.gmail.com/
for context. There's a heisenbug that depends on random code layout
issues on s390.
On Tue, 6 Aug 2024 at 10:34, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> Hmm. Do we have some alignment confusion?
>
> The alignment rules for 192 are to align it to 64-byte boundaries
> (because that's the largest power of two that divides it), and that
> means it stays at 192, and that would give 21 objects per 4kB page.
>
> But if we use the "align up to next power of two", you get 256 bytes,
> and 16 objects per page.
>
> And that 21-vs-16 confusion would seem to match this pretty well:
>
> [ 0.000000] BUG kmem_cache_node (Not tainted): objects 21 > max 16
>
> which makes me wonder...
I'd suspect commit ad59baa31695 ("slab, rust: extend kmalloc()
alignment guarantees to remove Rust padding"), perhaps with some odd
s390 code generation issue for 'ffs()'.
IOW, this new code in mm/slab_common.c
if (flags & SLAB_KMALLOC)
align = max(align, 1U << (ffs(size) - 1));
might not match some other alignment code.
Or maybe it's the s390 ffs().
It looks like
static inline int ffs(int word)
{
unsigned long mask = 2 * BITS_PER_LONG - 1;
unsigned int val = (unsigned int)word;
return (1 + (__flogr(-val & val) ^ (BITS_PER_LONG - 1))) & mask;
}
where s390 has this very odd "flogr" instruction ("find last one G
register"?) for the non-constant case.
That uses a "union register_pair" but only ever uses the "even"
register without ever using the full 128-bit part or the odd register.
So the other register in the register pair is uninitialized.
Does that cause random compiler issues based on register allocation?
Just for fun, does something like this make any difference?
--- a/arch/s390/include/asm/bitops.h
+++ b/arch/s390/include/asm/bitops.h
@@ -305,6 +305,7 @@ static inline unsigned char __flogr(unsigned long word)
union register_pair rp;
rp.even = word;
+ rp.odd = 0;
asm volatile(
" flogr %[rp],%[rp]\n"
: [rp] "+d" (rp.pair) : : "cc");
Thomas notices that the special "div by constant" routines moved
around, and I'm not seeing how *that* would matter, but it's all
obviously very strange.
Linus
prev parent reply other threads:[~2024-08-06 17:50 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240731095022.970699670@linuxfoundation.org>
[not found] ` <718b8afe-222f-4b3a-96d3-93af0e4ceff1@roeck-us.net>
2024-08-06 2:40 ` Linus Torvalds
2024-08-06 11:02 ` Vlastimil Babka
2024-08-06 17:33 ` Thomas Gleixner
[not found] ` <90e02d99-37a2-437e-ad42-44b80c4e94f6@suse.cz>
[not found] ` <87frrh44mf.ffs@tglx>
[not found] ` <76c643ee-17d6-463b-8ee1-4e30b0133671@roeck-us.net>
[not found] ` <87plqjz6aa.ffs@tglx>
2024-08-08 15:53 ` Linus Torvalds
2024-08-08 16:12 ` Thomas Gleixner
2024-08-08 16:33 ` Linus Torvalds
2024-08-08 17:48 ` Thomas Gleixner
2024-08-08 18:19 ` Linus Torvalds
2024-08-08 20:52 ` Guenter Roeck
2024-08-08 21:50 ` John David Anglin
2024-08-08 22:29 ` John David Anglin
2024-08-08 23:33 ` Linus Torvalds
2024-08-09 0:33 ` John David Anglin
2024-08-09 0:56 ` Guenter Roeck
2024-08-09 0:50 ` Guenter Roeck
2024-08-08 22:15 ` Richard Henderson
2024-09-03 7:54 ` Helge Deller
2024-09-03 14:13 ` Guenter Roeck
2024-09-03 18:43 ` Linus Torvalds
[not found] ` <cffe30ed-43a3-46ac-ad03-afb7633f17e5@roeck-us.net>
2024-08-08 15:58 ` John David Anglin
[not found] ` <f63c6789-b01a-4d76-b7c9-74c04867bc13@roeck-us.net>
[not found] ` <CAHk-=wjmumbT73xLkSAnnxDwaFE__Ny=QCp6B_LE2aG1SUqiTg@mail.gmail.com>
2024-08-06 17:49 ` Linus Torvalds [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAHk-=wiss_E41A1uH0-1MXF-GjxzW_Rbz+Xbs+fbr-vyQFpo4g@mail.gmail.com' \
--to=torvalds@linux-foundation.org \
--cc=agordeev@linux.ibm.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux@roeck-us.net \
--cc=tglx@linutronix.de \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox