From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) (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 5A4592E7F1D for ; Wed, 14 Jan 2026 17:33:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768411991; cv=none; b=HtMnUpdBjTnGhoMldZ9ouzUdy4pYjE5JLEbSdWKjm1ZCeeHU2cl9pgYisS0E/TYBLEe0f88nZEunZ1K/ZsiZKswXmAlgiDDELESa+nOloYaPSqZjwKrqtwxslXgusEj7BLTWWNw5kQ3vr5EgzaWuo8ixFVOJGyIA09vlP59ZelU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768411991; c=relaxed/simple; bh=8O9PPhw4HJ1ghVcptQLNcB4UFjagJSyTGDFo/SN9nX8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=fyIObixvY/0qkr+JHb25i0bltYoRmz2gAcIdvDvaWv+v3oXZ87y2CFJYgif7widNcxyDZMn0bySBeMgTmbgxMeA0FmXjsOCIJXEEaRMD7ZmJa/KkzX9Y9K9Ne/z6TTSNRAMAzp87GUNQirz7Q5f2VRukSX9PvI3PfG608zBqA9E= 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=pdbbGpZB; arc=none smtp.client-ip=209.85.222.179 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="pdbbGpZB" Received: by mail-qk1-f179.google.com with SMTP id af79cd13be357-8c52e25e636so7878185a.2 for ; Wed, 14 Jan 2026 09:33:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1768411989; x=1769016789; 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=bCjYai9Len2QQEYBKyLKOlFSVdw2VqJPxFxPg7dhnMU=; b=pdbbGpZB4FN/pc1oIcYQI2sdb7LPSfe4Xrf2buGe9SLPgSmqbntdcOm6xMmIo6+64d 4ger4ttSlWYVfZcN/f8jUP9nkbzLmnEYARy4HRpwNZTdAI8yk5WWq3iK1dlFBPIooVLu A+YF+dPOjM6m/7VFyMbBrXhthQN2NF22KiepJdJEBuHtJwsJyiC7A+WODwUGW2BYVCMo T6rH15gdShRF8SKkfcQ5xw86Tq0TBTYYzaCk/XtDt+23sLvPxJeQLvflYo0dQLGoU3d6 DDrj1Zl2vDy0bJl5GARWZorTYFz0cMdFiLCU2N7XdtUn5D52+fHVuSKETgA0zVMKzJj3 fD+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768411989; x=1769016789; 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=bCjYai9Len2QQEYBKyLKOlFSVdw2VqJPxFxPg7dhnMU=; b=iSyTx8kUhzkFixOuYHD39Qe5joQuJk6AopgO82f6KBzUTBfTPUollrxLI/WX1rbw3n K6zAduo8agOJpR7QwwEb2uJuwwwUq6kJnWe/bJXB76uop+aI7qsXlfbaYEddwG5mvbBP X9/iA+QtK1n1sd0qHTOmlFTixPqldxwjHmZj16TOiOA80c9bPSTLfUd8CZnbbhnNzhHV sUHl+vMziEhHEPABkmHmFBfL3Kng+cklKQ1IX7ANFcCN4QoJuBgsKOG4yvLETliF8alg mjmpwj9iQsoCjSNqDuKbdybx+60wPYzud+IRN/pPQCwN8tyYRv6yLgCIXHnG0COKECyo pKYw== X-Forwarded-Encrypted: i=1; AJvYcCW05RYyApX/5glgZfYpL3kK1hQI1zsJ2xtqendV207xxYwb0Emi/X73vGXxMgNawVPyN2s+0N2a7tKjJlI=@vger.kernel.org X-Gm-Message-State: AOJu0YwcB3ufz1Kkm+yQXCj8iY+595aJ8lAEDsVnM7MpmNwn3xNYMkBy XF9o+zCgSWS7pDurxQk6gHyIYBEw1MKJAc6QouwptkMoMtJCmEcc2QhEf+AD7zXjhXk= X-Gm-Gg: AY/fxX64s0MhTfq5+ECitmL+MQ0zLxT9wsYnW2EK6kK9wAIthXWtOMid4U7VqYUVVe0 o/aJgCuREpedNdVNxrhlWY8Xtx/qx0SYu+i74Lp1EsgbWXz0RSiZCUvxuTzMoVZRIVdost60q6v /zT+fMQRWC2zKtBR3x2dQAU34zDeV7jGKjDwFvVsxSVxcYCAOlIW/D14Vn8tzm7NzsDYSj4YRSM 6p4nibV2jRI7uzFtSaCTOf4De35KeFkUtv7es34i81fJKG4xSnLAmk2OOH/YkY7nz4PxYek5Zo3 jFg48v6AygsVZCJ6Ph24DfpncXv6krIJFK7dX2tssT+S7cOWcLX3ApjbG5ysfkrn98ON1ckPhb4 RZWv4mCzekL1OHEbr+accnkrTI/vdIdwN04ouBZooVQyDuhUn8WbjDFD+g0csv3jM0LvOaDvaUa Ooc57rHbRBw/mhMuD6YmYEMBYS7kgZVAhBjcRTVINmhqIS+LkYNLHz/vRA24RzBOhwSwNP2A== X-Received: by 2002:a05:620a:458b:b0:8b2:7290:27da with SMTP id af79cd13be357-8c52fafd245mr470291685a.12.1768411989233; Wed, 14 Jan 2026 09:33:09 -0800 (PST) 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-8c530b6e7d4sm198764985a.28.2026.01.14.09.33.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jan 2026 09:33:08 -0800 (PST) Date: Wed, 14 Jan 2026 12:32:36 -0500 From: Gregory Price To: "David Hildenbrand (Red Hat)" Cc: linux-mm@kvack.org, linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org, virtualization@lists.linux.dev, kernel-team@meta.com, dan.j.williams@intel.com, vishal.l.verma@intel.com, dave.jiang@intel.com, mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, osalvador@suse.de, akpm@linux-foundation.org Subject: Re: [PATCH 7/8] dax/kmem: add sysfs interface for runtime hotplug state control Message-ID: References: <20260114085201.3222597-1-gourry@gourry.net> <20260114085201.3222597-8-gourry@gourry.net> <3555385d-23de-492c-8192-a991f91d4343@kernel.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: <3555385d-23de-492c-8192-a991f91d4343@kernel.org> On Wed, Jan 14, 2026 at 11:55:21AM +0100, David Hildenbrand (Red Hat) wrote: > On 1/14/26 09:51, Gregory Price wrote: > > The dax kmem driver currently onlines memory automatically during > > probe using the system's default online policy but provides no way > > to control or query the memory state at runtime. Users cannot change > > the online type after probe, and there's no atomic way to offline and > > remove memory blocks together. > > > > Add a new 'hotplug' sysfs attribute that allows userspace to control > > and query the memory state. The interface supports the following states: > > > > - "offline": memory is added but not online > > - "online": memory is online as normal system RAM > > - "online_movable": memory is online in ZONE_MOVABLE > > - "unplug": memory is offlined and removed > > > > The initial state after probe uses MMOP_SYSTEM_DEFAULT to preserve > > backwards compatibility - existing systems with auto-online policies > > will continue to work as before. > > > > The state machine enforces valid transitions: > > - From offline: can transition to online, online_movable, or unplug > > - From online/online_movable: can transition to offline or unplug > > - Cannot switch directly between online and online_movable > > Do we have to support these transitions right from the start? > > What are the use cases for adding memory as offline and then onlining it, > and why do we have to support that through this interface? > the default build config does this, so anyone using the SYSTEM_DEFAULT will have to at least support this unless we want to change peoples existing systems. They'll expect to use the existing pattern. That is: add_memory_driver_managed(, SYSTEM_DEFAULT) -> offline echo online[_*] -> memory*/state If we disallow "offline", then we essentially leave it "unplugged" and the second line (existing user policy) breaks. I thought this would be considered "breaking userland". I could see disallow "offline" if the memory is "online", and just force "unplug". > It would be a lot simpler if we would only allow > > > - "offline": memory is added but not online > > - "online": memory is online as normal system RAM > > - "online_movable": memory is online in ZONE_MOVABLE > > - "unplug": memory is offlined and removed > > That is, transitioning from offline to online or vice versa fails with > -ENOSUPP. User space can do that itself through sysfs and if there is ever a > good use case we can extend this interface here to allow it. > > Or is there a good use case that really requires this? > There's no good use case, just existing users and expected behavior. ~Gregory