From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3174F38D6BD for ; Mon, 13 Apr 2026 19:38:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776109098; cv=none; b=klEWpvisZIGAiSfRcYcKf7h4p4GsYAZW/MV1hyz6Xa5Q4yLriM/F2EnyX/Cf24MvVITjWe8TYgQZNfBSu2qf9Ve2bnacek7lHoFqQ5v4CGb5J8Vs1cp9rWzDIDHSDwgD/xl3l+RUbqFpSG8S0sCKcG8cKbt8z3odpv7GEkMbLJA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776109098; c=relaxed/simple; bh=iq+k1kdjsFO//4jKVGXmpkWsGljQ+hWQez+mk2k+r5I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=cA21HDO262IUcVd9xA12rzgVGz+AWql4i43Tj7QFjySShy2i8XN7eksnYuAYzAuBzc5t/9C9VpdZ7l6H4HzvqL+HqOiErTpDyfAUmgiabCYAjzxASTyUG/0m+wKKsQ/4l7NK4Wk/HaP+IYX1GdXvnUFeh9+M+T3rEt4Yk7qLZdU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=pmBdQ1Vh; arc=none smtp.client-ip=209.85.160.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="pmBdQ1Vh" Received: by mail-qt1-f181.google.com with SMTP id d75a77b69052e-506a747448dso39146631cf.0 for ; Mon, 13 Apr 2026 12:38:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1776109096; x=1776713896; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Y+Cg30G7JazeOMCJRrNEUInL5xwrDgCPHzG/fcerzOo=; b=pmBdQ1Vhzc6MKRM6wQtKfOekfO63QxJ0E2e4ICRIqJWjDy5Ir7xLqywcjMZG1F0y9/ 4Mk6+0ZxlEMeRJdZ0uEl3uoOapiiQzL7ekmzBTU1dlpIIt8trF+I65eCLTvAiN+ajOem 37MTDcNsRoHXuQ+g2i0FAVMsv1OGF0skstzKPWURYjflp9+xzeDYXVoED0NNdVE5V/xd QaCNgrbPdNUXF/Xz0BoWOELzpZVGPLzZPYH5vF936Z1w9uHDXR11wPCy0PRZqEiHMuyX Sa+v+Y6KZiqscRZDcu7FiAQnoSWoEXkgVt/19ck6OQaRNa5DuoBMEofP+ztE8N3ch+uI wDXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776109096; x=1776713896; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Y+Cg30G7JazeOMCJRrNEUInL5xwrDgCPHzG/fcerzOo=; b=PLkreHgWC7wlwZx9yC8E26dgpUaJlI/k+NauW8XJRAwgjEifM8Z132AH55a1uMAQcV OZp5KEKkcUP848T7pqt9DlSiIhLZrygCORGC3oeGAaaCpMuDA2GJ+9oGjKCy3qkFXLeX tH4xoNkaJQgJ84L9RFq35wZ5zJeVc3f26ucBS36ourJbg09GzJr4LhJfJl8m+RIAqZzw fSuJ3e3Lwm/xolQR2KAwN+O6HfF5djek+fIr0hvF4g5QFd4jtmuW6cJLD01LnDSoXZLk 3J+kq715/J1GmIIw+YSqKKYUvedZLd85zpcSz4FgB77UjHX1wCZm+wLpnmZhZX6HduG/ fpjw== X-Forwarded-Encrypted: i=1; AFNElJ+Vpl/ibWriFDWnfUkA6BwlotqW6K5tpHQxoRq0J/VQAumS03U/oquGgycb6MIPVJq+JOubuxd2yCU/I98=@vger.kernel.org X-Gm-Message-State: AOJu0YzwQyaSI8WHhkAJeh9pkXmXIx//E+1M7SQUnFf/0LdZIQpSzzml qH+wvSehNQ/FuO3IB8nJNdl4nDL9lL+644GjZ5OlLFzJPUkKLXxNVRRz3UyZxNFcyJw= X-Gm-Gg: AeBDievnTRMuP7XOxJFfYy/u8oyqKkvSQwmwSBnTRoTEeIFQc5r+4eLRMVa20pEao+R 0uJUxrygdPdr4ZFsbt9PFPU8eNeh940ce892U1rhpFMDXmmBYNP4SuzHj2CeyHH99r07EXbqaXC 4lOd9wE9AYgFF5IboQw+vwyQT0OhWl15lhH6UScZ8/ANmqnbZbuBUxp7Q7y45LlDbjwhB1E+VEf 13WcArMtDItfP9z+TErVZUA4wxEhDs8G5jzin7JPilOw13DJQ31WetViXxCEPEgv4w68O2BLHLd LyqRUg7vjhItYwWRKNehV0AOjhenpQwFlbvOJjuz35KaEXbDATiOTEpGQIVuOEhfiBlJHPU4Ewv Me+Fg+yg92lfWsexHXEK+g1V7djp3bbVZSmCB4SFOpoxl8ZSFprgxTjY/EsnRmVgckucHQlwccK S5goNU/LTz5m9qz5OUzhAcsYfqNSnhIj/PSloUpZi6FuCk4hoWnuwX9/XSIzRE49hY1OMwALduA fx57vs4PMTSpejY+7fGnQR9rwXkeKSl+g== X-Received: by 2002:a05:622a:82:b0:50d:8210:eea6 with SMTP id d75a77b69052e-50dd5a97fddmr224412971cf.1.1776109095971; Mon, 13 Apr 2026 12:38:15 -0700 (PDT) Received: from gourry-fedora-PF4VCD3F (pool-71-191-243-150.washdc.fios.verizon.net. [71.191.243.150]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-50dd564c160sm95841161cf.30.2026.04.13.12.38.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Apr 2026 12:38:15 -0700 (PDT) Date: Mon, 13 Apr 2026 15:38:13 -0400 From: Gregory Price To: "David Hildenbrand (Arm)" Cc: Andrew Morton , 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 Message-ID: References: <20260321150404.3288786-1-gourry@gourry.net> <20260321104021.4a6074330131a2058e8706bd@linux-foundation.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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. > 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 :] 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. ~Gregory