From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (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 6EDB12BEFFE for ; Sat, 21 Mar 2026 20:26:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774124808; cv=none; b=pg6OOTVfunXXtPfezeG2i2ZIdF8JLCIdlGGtN+dlfnVQCYEDLbCt0jrlCt1btO90tz7sidHhYvNcujiEgvk28KiXK86De2p/CoFgW7dlklYi6m+sDxAID6JJbOX2lWzJNshm9dMqqZJFz663L0gL5FFbE25ZH5Ij65//KsztDcc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774124808; c=relaxed/simple; bh=0o7bVmmzRFp2N7/OlVNvlYnXrmD3xdgI8R7r+xdEOBg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gpxsQqF2cQ9v6KgaF7kYujwkWPbZKcQsyFe+2QLPr0tB2OlAlE/NjFDabihKyE+QsKH8lcSkJ6cnDGGL6aQ7E6RS7CuBrktUmc/hf2hJyM4TaNaxVtRjScF6iF1BiPFSH8wn6vtKjR67S60hmkcNTlijkKFEgtelhHEOfeilaYQ= 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=k1EVktGz; arc=none smtp.client-ip=209.85.222.178 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="k1EVktGz" Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-8cb5c9ba82bso250566185a.2 for ; Sat, 21 Mar 2026 13:26:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1774124806; x=1774729606; 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=0tEq3kR663AZN+wJIQdRtj/jb9LMYPMsRdvJZPaBgUg=; b=k1EVktGzIGzqy37Jyn+wP3atHpdSuiZE6Nf4tX2NVPBp6FVPL7HvSsBbBzITXBZLpA KqrGMU2i7/aMzsR8PK1b1dU5NK3YZij4UlnSfhdU3Aw/LuKSE6JRLQzVdQca710EGqX8 7taIiPi0hQ+KuAFWF2E1x+qY1s40p9626WJ3FjQYTDKvopKTD5LSvtWZra0avgkwwtkR KUKYI6WgqgI+RJSnMefztpvyKDru2vKAkSQUC0B3ETXhEvmdsI0u//GSyui9LkBfrBl2 9Y0LK2lN2aHKo9aPyuCiSycin9TCfsrYcX0MdxK6B9n4UBzm1YpX1+/9MOEGOJLKh2ST iemA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774124806; x=1774729606; 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=0tEq3kR663AZN+wJIQdRtj/jb9LMYPMsRdvJZPaBgUg=; b=PEyEaXvL91mMdh1IS5WgqqicwPHAzVkyUKafvyyDN80Yrw080cMZYONa8EQl+ky/jL 162MvuJNf3rZ152BXwJ05TFTz6JaG09Vf5OOmAxsbbNEo/xUJgwaa/7DHVgx+vjOH41y +Uv3i6z9oNGqpd1TzwL8nTGlXMytzYHe6yRcYrSkLj31ncoXm6kHrJKtPgZebbyRJgSe yLC+/Oni7BVXfFuqTwP41/A5GMihDwEswR4jnt++QEHQj9rVPRYmK+DPyL7HILCa47DF K6dgt1okiUi2U7ThDr8dMPStj9jG6T9ZzIlMYEusv8T4lalD5md8cxMsjh9+GeyYA6Lg T2lA== X-Forwarded-Encrypted: i=1; AJvYcCVs8x1ILFARBf1d1lJT0x38YNwYE45u3tEIOv4Jbe2MD3M4xfArymyePV57cp+3Wgb2iMUC6cSiZADpE4Q=@vger.kernel.org X-Gm-Message-State: AOJu0YyvbEDJlBeqyYgUo2MAEDIUJeHQjWMuXb0cpCEV5VqgFYqrO9Vz lqnyEMnwkM2I8NYxeOTj3chygs++O6o21kXy5wAWwi45z3WBknQh9nWXL0LqnuPNS2M= X-Gm-Gg: ATEYQzxtoa4kFhmPUOb/Ql0JaApN4pohUuJznGOkQygmj2/Ly6pu6/sWoPvkC7lfZyR 0yls+4k6ANAp3nWHu+o7+iCCqSO/30XTL23a7Zi4dTF/J6pYKwZDmamCuhm18ylyLEWe3BkySeG PgE1k3iEk5EyzS4w8fliDKLlZYHT0/07xwIRBYR15cr49y14ZPm83bP5BHMcQ16NQkzP+OqUdRy M/9l4bqAJtOqULuPSgqbT8Je6WiACrVozFZY2EKabtY4JEgXBBWkaZrU/5TKtI71MV6IgFZbDKK DO/xU7K0FN363OKYb6n4t2YKlRL3bKo2fQG5UozFoHHKBV8bBEy7BErH96a1SyNdGX7AupLT1zC 4GBz0Ve1Anl8jpK+F9DpZmsEuudGpbx7i3qehzUAVSGYHVXBqGF9MAFitCIu90+OgI85sglVLdh jVZHMAreSfkxuRkl16WPgldag0f79POcI1rsr9envoLNATp4EpB0y8jR/INxnoFB/nH3TJVFZFW JsmoJmgDA== X-Received: by 2002:a05:620a:4010:b0:8cf:e19e:b4ce with SMTP id af79cd13be357-8cfe19eb50emr74563885a.71.1774124806341; Sat, 21 Mar 2026 13:26:46 -0700 (PDT) Received: from gourry-fedora-PF4VCD3F (pool-96-255-20-138.washdc.ftas.verizon.net. [96.255.20.138]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8cfc9089bebsm467118485a.27.2026.03.21.13.26.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Mar 2026 13:26:44 -0700 (PDT) Date: Sat, 21 Mar 2026 16:26:41 -0400 From: Gregory Price To: Andrew Morton Cc: linux-mm@kvack.org, vishal.l.verma@intel.com, dave.jiang@intel.com, david@kernel.org, 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: <20260321104021.4a6074330131a2058e8706bd@linux-foundation.org> On Sat, Mar 21, 2026 at 10:40:21AM -0700, Andrew Morton wrote: > On Sat, 21 Mar 2026 11:03:56 -0400 Gregory Price wrote: > > > The dax kmem driver currently onlines memory during probe using the > > system default policy, with no way to control or query the region state > > at runtime - other than by inspecting the state of individual blocks. > > > > Offlining and removing an entire region requires operating on individual > > memory blocks, creating race conditions where external entities can > > interfere between the offline and remove steps. > > > > The problem was discussed specifically in the LPC2025 device memory > > sessions - https://lpc.events/event/19/contributions/2016/ - where > > it was discussed how the non-atomic interface for dax hotplug is causing > > issues in some distributions which have competing userland controllers > > that interfere with each other. > > > > This series adds a sysfs "hotplug" attribute for atomic whole-device > > hotplug control, along with the mm and dax plumbing to support it. > > AI review (which hasn't completed at this time) has a lot to say: > https://sashiko.dev/#/patchset/20260321150404.3288786-1-gourry@gourry.net Looking at the results - i mucked up a UAF during the rebase that i didn't catch during testing. Will clean that up. I also just realized I left an extern in one of the patches that I thought I had removed. So I owe a respin on this in more ways than one. But on the AI review comment for non-trivial stuff --- Much of the remaining commentary is about either the pre-existing code race conditions, or design questions in the space of that race condition. Specifically: userland can still try to twiddle the memoryN/state bits while the dax device loops over non-contiguous regions. I dropped this commit: https://lore.kernel.org/all/20260114235022.3437787-6-gourry@gourry.net/ >From the series, because the feedback here: https://lore.kernel.org/linux-mm/d1938a63-839b-44a5-a68f-34ad290fef21@kernel.org/ suggested that offline_and_remove_memory() would resolve the race condition problem - but the patch proposed actually solved two issues: 1) Inconsistent hotplug state issue (user is still using the old per-block offlining pattern) 2) The old offline pattern calling BUG() instead of WARN() when trying to unbind while things are still online. But this goes to the issue of: If the race condition in userland has been around for many years, is it to be considered a feature we should not break - or on what time scale should we consider breaking it? I don't know the answer, David will have to weigh in on that. ~Gregory