linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Ryan Roberts <ryan.roberts@arm.com>
Cc: Mark Brown <broonie@kernel.org>, Linux-MM <linux-mm@kvack.org>
Subject: Re: shmem folio changes have broken linux-next
Date: Tue, 6 Aug 2024 16:16:42 +0100	[thread overview]
Message-ID: <ZrI-WqQIN7DGMOY2@casper.infradead.org> (raw)
In-Reply-To: <234b0b85-cbf1-4af4-85c9-ac0d00ceeed2@arm.com>

On Tue, Aug 06, 2024 at 09:47:19AM +0100, Ryan Roberts wrote:
> Our CI is reporting an oops during boot on linux-next (next-20240806) on arm64. Bisect tells me that it is due to your commit cdc4ad36a871b ("fs: Convert aops->write_begin to take a folio"), but there is no link to a mail thread on the patch and I can't find it in lore.

You're looking in the wrong place ;-)

https://lore.kernel.org/linux-fsdevel/20240717154716.237943-22-willy@infradead.org/#Z31mm:shmem.c

> Anyway, I believe the issue is that you are doing this in shmem_write_begin():
> 
>   if (folio_test_has_hwpoisoned(folio)) {
> 
> But folio could be small and I think that function is only safe for large folios? (AFAICT it is unconditionally looking at the flags in the second page?).
> 
> Elsewhere in the file, this pattern is used:
> 
>   if (folio_test_hwpoison(folio) ||
>       (folio_test_large(folio) && folio_test_has_hwpoisoned(folio))) {

Ugh.  The hwpoison stuff is too complicated.  Because that's wrong too.
It should be ...

if (folio_test_large(folio) && folio_test_has_hwpoisoned(folio) ||
    !folio_test_large(folio) && folio_test_hwpoison(folio))

right?  But that's a mouthful to write.  I'm tempted to rip it all out
and start again ...

> Here is the oops (pretty much as soon as we get into user space):
> 
> [    0.623253] page: refcount:3 mapcount:0 mapping:00000000eebcb8cf index:0x0 pfn:0x18cc07
> [    0.624212] memcg:ffff000142023000
> [    0.624617] aops:shmem_aops ino:800 dentry name:"memfd:snapd-env-generator"
> [    0.625444] flags: 0xbfffe0000040005(locked|referenced|swapbacked|node=0|zone=2|lastcpupid=0x1ffff)
> [    0.626532] raw: 0bfffe0000040005 0000000000000000 dead000000000122 ffff000181dd0ac0
> [    0.627442] raw: 0000000000000000 0000000000000000 00000003ffffffff ffff000142023000
> [    0.628331] page dumped because: VM_BUG_ON_PAGE(n > 0 && !((__builtin_constant_p(PG_head) && __builtin_constant_p((uintptr_t)(&page->flags) != (uintptr_t)((void *)0)) && (uintptr_t)(&page->flags) != (uintptr_t)((void *)0) && __builtin_constant_p(*(const unsigned long *)(&page->flags))) ? const_test_bit(PG_head, &page->flags) : generic_test_bit(PG_head, &page->flags)))
> [    0.632106] ------------[ cut here ]------------
> [    0.632630] kernel BUG at include/linux/page-flags.h:308!

I'm glad I made it so noisy instead of silently checking something
that's not the flag we thought it was ...


  reply	other threads:[~2024-08-06 15:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-06  8:47 Ryan Roberts
2024-08-06 15:16 ` Matthew Wilcox [this message]
2024-08-06 15:29   ` Ryan Roberts

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=ZrI-WqQIN7DGMOY2@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=broonie@kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ryan.roberts@arm.com \
    /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