From: David Hildenbrand <david@redhat.com>
To: Ryan Roberts <ryan.roberts@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Pasha Tatashin <pasha.tatashin@soleen.com>,
Andrew Morton <akpm@linux-foundation.org>,
Uladzislau Rezki <urezki@gmail.com>,
Christoph Hellwig <hch@infradead.org>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
Mark Rutland <mark.rutland@arm.com>,
Anshuman Khandual <anshuman.khandual@arm.com>,
Alexandre Ghiti <alexghiti@rivosinc.com>,
Kevin Brodsky <kevin.brodsky@arm.com>
Cc: linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org,
syzbot+5c0d9392e042f41d45c5@syzkaller.appspotmail.com
Subject: Re: [PATCH] arm64/mm: Disable barrier batching in interrupt contexts
Date: Mon, 12 May 2025 14:05:45 +0200 [thread overview]
Message-ID: <836f2574-cb60-44c5-865c-7f13a90779ec@redhat.com> (raw)
In-Reply-To: <e37d5e61-54e7-4425-837f-25a13f5a68b5@arm.com>
>>> static inline void arch_leave_lazy_mmu_mode(void)
>>> {
>>> + if (in_interrupt())
>>> + return;
>>> +
>>> arch_flush_lazy_mmu_mode();
>>> clear_thread_flag(TIF_LAZY_MMU);
>>> }
>>
>> I guess in all cases we could optimize out the in_interrupt() check on !debug
>> configs.
>
> I think that assumes we can easily and accurately identify all configs that
> cause this? We've identified 2 but I'm not confident that it's a full list.
Agreed. I was wondering if we could convert the ones to use different
pte helpers, whereby these helpers would not be available without
CONFIG_WHATEVER. Then, make these features select CONFIG_WHATEVER.
VM_WARN_ON_* would be used to catch any violations / wrong use of pte
helpers.
> Also, KFENCE isn't really a debug config (despite me calling it that in the
> commit log) - it's supposed to be something that can be enabled in production
> builds.
Agreed. Even Fedora has it.
>
>>
>> Hm, maybe there is an elegant way to catch all of these "problematic" users?
>
> I'm all ears if you have any suggestions? :)
>
>
> It actaully looks like x86/XEN tries to solves this problem in a similar way:
Heh, yes. Good old xen ...
>
> enum xen_lazy_mode xen_get_lazy_mode(void)
> {
> if (in_interrupt())
> return XEN_LAZY_NONE;
>
> return this_cpu_read(xen_lazy_mode);
> }
>
> Although I'm not convinced it's fully robust. It also has:
>
> static inline void enter_lazy(enum xen_lazy_mode mode)
> {
> BUG_ON(this_cpu_read(xen_lazy_mode) != XEN_LAZY_NONE);
>
> this_cpu_write(xen_lazy_mode, mode);
> }
>
> which is called as part of its arch_enter_lazy_mmu_mode() implementation. If a
> task was already in lazy mmu mode when an interrupt comes in and causes the
> nested arch_enter_lazy_mmu_mode() that we saw in this bug report, surely that
> BUG_ON() should trigger?
Hm, good point. But that code is old, so probably something seems to be
preventing that?
In any case, just a thought on the in_interrupt() check, I think this
commit is good enough as is.
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2025-05-12 12:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-12 10:22 Ryan Roberts
2025-05-12 11:00 ` Catalin Marinas
2025-05-12 11:03 ` Ryan Roberts
2025-05-12 11:07 ` David Hildenbrand
2025-05-12 12:00 ` Ryan Roberts
2025-05-12 12:05 ` David Hildenbrand [this message]
2025-05-12 12:33 ` Ryan Roberts
2025-05-12 13:14 ` Catalin Marinas
2025-05-12 13:53 ` Ryan Roberts
2025-05-12 14:14 ` Ryan Roberts
2025-05-13 20:46 ` Will Deacon
2025-05-14 9:29 ` Ryan Roberts
2025-05-14 15:13 ` Will Deacon
2025-05-14 15:14 ` Will Deacon
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=836f2574-cb60-44c5-865c-7f13a90779ec@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=alexghiti@rivosinc.com \
--cc=anshuman.khandual@arm.com \
--cc=catalin.marinas@arm.com \
--cc=hch@infradead.org \
--cc=kevin.brodsky@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mark.rutland@arm.com \
--cc=pasha.tatashin@soleen.com \
--cc=ryan.roberts@arm.com \
--cc=syzbot+5c0d9392e042f41d45c5@syzkaller.appspotmail.com \
--cc=urezki@gmail.com \
--cc=will@kernel.org \
--cc=willy@infradead.org \
/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