From: "David Hildenbrand (Arm)" <david@kernel.org>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: linux-kernel@vger.kernel.org, Miaohe Lin <linmiaohe@huawei.com>,
Naoya Horiguchi <nao.horiguchi@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Oscar Salvador <osalvador@suse.de>,
Andi Kleen <andi@firstfloor.org>,
Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>,
Rik van Riel <riel@redhat.com>,
Vlastimil Babka <vbabka@kernel.org>,
Lorenzo Stoakes <ljs@kernel.org>,
"Liam R. Howlett" <liam@infradead.org>,
Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.com>,
Brendan Jackman <jackmanb@google.com>,
Johannes Weiner <hannes@cmpxchg.org>, Zi Yan <ziy@nvidia.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Nico Pache <npache@redhat.com>,
Ryan Roberts <ryan.roberts@arm.com>, Dev Jain <dev.jain@arm.com>,
Barry Song <baohua@kernel.org>, Lance Yang <lance.yang@linux.dev>,
Christoph Lameter <cl@gentwo.org>,
David Rientjes <rientjes@google.com>,
Roman Gushchin <roman.gushchin@linux.dev>,
Harry Yoo <harry@kernel.org>, Hao Li <hao.li@linux.dev>,
Kiryl Shutsemau <kas@kernel.org>,
Byungchul Park <byungchul@sk.com>,
linux-mm@kvack.org, linux-cxl@vger.kernel.org
Subject: Re: [PATCH 0/2] mm: memory-failure: fix HWPoison flag race with non-atomic page flag ops
Date: Wed, 1 Jul 2026 10:08:45 +0200 [thread overview]
Message-ID: <2f884bfa-3cd5-4fba-8aa4-c2e68890ab64@kernel.org> (raw)
In-Reply-To: <20260630174852-mutt-send-email-mst@kernel.org>
>> Cheers,
>>
>> David
>
> Yay. I did that + dropped the extra lock/unlock and now it's in the noise in
> my testing. needs much more testing of course.
Cool. I'd expect that latency-sensitive workloads (PREEMPT_RT) would not want to
have hwpoison handling either way, so using the no_resched variants at these
places might be doable.
>
> If you want me to post (including addressing your other feedback) let me
> know.
>
Let's first discuss the options. We essentially have the following one so far:
1) Ignore the problem
It's been there forever ... but I am not quite happy about that.
2) Use atomics everywhere
The easiest+cleanest, but as measured, the performance hit is real.
3) Keep retrying for a couple of times
The big problem is "how long". A CPU in a hypervisor might be stalled for quite
a while (20s? can be longer).
4) Disable preemption around non-atomic updates + synchronize_rcu() loop
I think it should work, but I don't like the possibly endless retry loop. (well,
it would never be an endless loop in practice)
Is there a problem with synchronize_rcu() latency, given that it can take in bad
scenarios a couple of seconds? (grace periods can be large ... but also very short)
4) disable local interrupts around non-atomic updates + let all CPUs perform
atomic setting/clearing of the bit through smp_call_function_many().
Disabling local interrupts is way too expensive. :(
5) disable preemption around non-atomic updates + let all CPUs perform
atomic setting/clearing of the bit through schedule_on_each_cpu()
Mixture of 3) + 4), but schedule_on_each_cpu() can also possibly take a long
time (as long as we cannot schedule on a CPU ...).
We could likely build something that remembers all pages with bits-to-set /
bits-to-clear, to then kick off a per-cpu work ... and once all CPUs processed a
page it was fully processed ... needs much more thought.
6) stop_machine()
Big hammer. I think we'd still need to disable preemption around non-atomic updates.
7) Move hwpoison bit out of page->flags
Use a sparse bitmap. Quite invasive, and any hwpoison bit checking code would
get more expensive.
Did I mess something up / forget something?
> Or look into call_rcu_tasks/call_rcu_tasks_rude which might work without
> changes in mm.
Looking into call_rcu_tasks() (the first time) the semantics are interesting
("involuntary preemption is not a Tasks RCU quiescent state").
I'm curious how this interacts with random page allocations (on the IRQ path?),
and which design you envision given that we only get a single callback (who
prevents code to re-enter).
>
> Or if someone else is gonnu work on this, absolutely fine too.
I can likely let someone work on that, but I think we should first figure out
what can really be done. (and likely when we send it out, it should be an RFC)
--
Cheers,
David
next prev parent reply other threads:[~2026-07-01 8:08 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-28 21:45 [PATCH 0/2] mm: memory-failure: fix HWPoison flag race with non-atomic page flag ops Michael S. Tsirkin
2026-06-28 21:45 ` [PATCH 1/2] mm: memory-failure: use RCU to fix HWPoison flag race Michael S. Tsirkin
2026-06-28 21:45 ` [PATCH 2/2] mm: wrap non-atomic page flag ops in RCU for HWPoison safety Michael S. Tsirkin
2026-06-29 2:11 ` [PATCH 0/2] mm: memory-failure: fix HWPoison flag race with non-atomic page flag ops Andi Kleen
2026-06-29 8:10 ` Michael S. Tsirkin
2026-06-29 8:21 ` David Hildenbrand (Arm)
2026-06-29 8:39 ` Michael S. Tsirkin
2026-06-29 16:54 ` Andi Kleen
2026-06-29 17:04 ` David Hildenbrand (Arm)
2026-06-29 20:43 ` Michael S. Tsirkin
2026-06-29 6:49 ` David Hildenbrand (Arm)
2026-06-29 7:34 ` Michael S. Tsirkin
2026-06-29 13:05 ` David Hildenbrand (Arm)
2026-06-29 20:08 ` Michael S. Tsirkin
2026-06-29 20:55 ` Andi Kleen
2026-06-29 21:17 ` Michael S. Tsirkin
2026-06-29 21:39 ` Andi Kleen
2026-06-29 21:59 ` Michael S. Tsirkin
2026-06-29 21:22 ` David Hildenbrand (Arm)
2026-06-29 21:43 ` David Hildenbrand (Arm)
2026-06-29 23:34 ` Michael S. Tsirkin
2026-06-30 6:17 ` David Hildenbrand (Arm)
2026-06-30 6:27 ` Michael S. Tsirkin
2026-06-30 6:34 ` David Hildenbrand (Arm)
2026-06-30 7:25 ` Michael S. Tsirkin
2026-06-29 21:50 ` Michael S. Tsirkin
2026-06-30 6:30 ` David Hildenbrand (Arm)
2026-06-30 6:41 ` David Hildenbrand (Arm)
2026-06-30 21:58 ` Michael S. Tsirkin
2026-07-01 8:08 ` David Hildenbrand (Arm) [this message]
2026-07-01 8:18 ` Michael S. Tsirkin
2026-07-01 8:26 ` David Hildenbrand (Arm)
2026-07-01 8:33 ` Michael S. Tsirkin
2026-07-01 8:36 ` David Hildenbrand (Arm)
2026-07-01 15:54 ` Michael S. Tsirkin
2026-07-01 16:17 ` David Hildenbrand (Arm)
2026-06-29 21:54 ` Michael S. Tsirkin
2026-07-01 7:25 ` David Hildenbrand (Arm)
2026-06-29 23:29 ` Michael S. Tsirkin
2026-07-01 7:31 ` David Hildenbrand (Arm)
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=2f884bfa-3cd5-4fba-8aa4-c2e68890ab64@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=byungchul@sk.com \
--cc=cl@gentwo.org \
--cc=dev.jain@arm.com \
--cc=hannes@cmpxchg.org \
--cc=hao.li@linux.dev \
--cc=harry@kernel.org \
--cc=hidehiro.kawai.ez@hitachi.com \
--cc=jackmanb@google.com \
--cc=kas@kernel.org \
--cc=lance.yang@linux.dev \
--cc=liam@infradead.org \
--cc=linmiaohe@huawei.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=mhocko@suse.com \
--cc=mst@redhat.com \
--cc=nao.horiguchi@gmail.com \
--cc=npache@redhat.com \
--cc=osalvador@suse.de \
--cc=riel@redhat.com \
--cc=rientjes@google.com \
--cc=roman.gushchin@linux.dev \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--cc=ziy@nvidia.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