From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Gregory Price <gourry@gourry.net>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, vishal.l.verma@intel.com,
dave.jiang@intel.com, osalvador@suse.de,
dan.j.williams@intel.com, ljs@kernel.org,
Liam.Howlett@oracle.com, vbabka@kernel.org, rppt@kernel.org,
surenb@google.com, mhocko@suse.com, linux-kernel@vger.kernel.org,
nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org,
kernel-team@meta.com
Subject: Re: [PATCH 0/8] dax/kmem: atomic whole-device hotplug via sysfs
Date: Mon, 13 Apr 2026 21:40:49 +0200 [thread overview]
Message-ID: <478c5700-8bf5-42b9-ad71-bbc618b36c9c@kernel.org> (raw)
In-Reply-To: <ad1GJRyAfIAhj1iz@gourry-fedora-PF4VCD3F>
On 4/13/26 21:38, Gregory Price wrote:
> On Mon, Apr 13, 2026 at 05:47:01PM +0200, David Hildenbrand (Arm) wrote:
>>
>> So, really only user space can try offlining the memory after requested
>> onlining succeeded.
>>
>> I don't think any udev rules do that? The usually only request to
>> online, which should be fine.
>>
>
> In the offline case the block will cease to exist after offlin/remove
> returns, so what should happen is the race on offline just fails and
> the stale object cleans itself up on the way out after failure.
>
> Userland temporarily sees a stale memory block but can't do anything
> with it because sync'd on hotplug lock.
Exactly.
>
>> So if a user does that manually, good for him. We just have to make sure
>> that stuff keeps working as expected.
>>
>
> Yeah the only catch is if a user does something dumb like
>
> cat block/state -> online_movable
> echo offline > block/state
> echo online > block/state
>
> But like... don't do that :]
Yes :)
>
> Udev won't ever offline-online-race like this, so it's not a real issue.
>
>> Or am I missing a case?
>>
>
> So yeah, I'm fairly confident this just works.
>
>>
>> I'll note that offline_and_remove_memory() can take a long time/forever
>> to succeed. User space can abort it by sending a critical signal.
>>
>> For example, if you do
>>
>> $ echo "unplugged" > magic_device_file
>>
>> And it hangs, user space can kill the "echo" command, sending a fatal
>> signal and making offline_and_remove_memory() fail.
>>
>> The question is, if you want to do your best to revert the other offline
>> operations and try re-adding/onlining what you already offlined.
>>
>> offline_and_remove_memory() handles that much nicer internally, as it
>> tries to revert offlining, and only removes once everything was offlined.
>>
>> I think I raised it previously, but you could add a
>> offline_and_remove_memory_ranges() that consumes multiple ranges, and
>> would do this for you under a single lock_device_hotplug().
>>
>
> I don't think this is a very large lift, just a slightly larger hotplug
> locking scope. But then - the per-range thing in this set should just
> work, so let me know if it's worth the extra churn.
Well, you can rather cleanly undo the operation if any offlining fails.
If that's not a requirement, then no need to change it!
--
Cheers,
David
next prev parent reply other threads:[~2026-04-13 19:41 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-21 15:03 Gregory Price
2026-03-21 15:03 ` [PATCH 1/8] mm/memory-tiers: consolidate memory type dedup into mt_get_memory_type() Gregory Price
2026-04-13 15:06 ` David Hildenbrand (Arm)
2026-04-13 19:41 ` Gregory Price
2026-03-21 15:03 ` [PATCH 2/8] mm/memory: add memory_block_align_range() helper Gregory Price
2026-04-13 15:12 ` David Hildenbrand (Arm)
2026-03-21 15:03 ` [PATCH 3/8] mm/memory_hotplug: pass online_type to online_memory_block() via arg Gregory Price
2026-03-21 15:04 ` [PATCH 4/8] mm/memory_hotplug: export mhp_get_default_online_type Gregory Price
2026-04-13 15:18 ` David Hildenbrand (Arm)
2026-03-21 15:04 ` [PATCH 5/8] mm/memory_hotplug: add __add_memory_driver_managed() with online_type arg Gregory Price
2026-04-13 15:21 ` David Hildenbrand (Arm)
2026-03-21 15:04 ` [PATCH 6/8] dax: plumb hotplug online_type through dax Gregory Price
2026-04-13 15:23 ` David Hildenbrand (Arm)
2026-03-21 15:04 ` [PATCH 7/8] dax/kmem: extract hotplug/hotremove helper functions Gregory Price
2026-03-21 15:04 ` [PATCH 8/8] dax/kmem: add sysfs interface for atomic whole-device hotplug Gregory Price
2026-03-21 17:40 ` [PATCH 0/8] dax/kmem: atomic whole-device hotplug via sysfs Andrew Morton
2026-03-21 20:26 ` Gregory Price
2026-04-13 15:47 ` David Hildenbrand (Arm)
2026-04-13 19:38 ` Gregory Price
2026-04-13 19:40 ` David Hildenbrand (Arm) [this message]
2026-04-13 19:59 ` Gregory Price
2026-04-13 14:49 ` David Hildenbrand (Arm)
2026-04-13 14:53 ` 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=478c5700-8bf5-42b9-ad71-bbc618b36c9c@kernel.org \
--to=david@kernel.org \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=gourry@gourry.net \
--cc=kernel-team@meta.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=nvdimm@lists.linux.dev \
--cc=osalvador@suse.de \
--cc=rppt@kernel.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--cc=vishal.l.verma@intel.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