From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) (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 4762338946A for ; Mon, 2 Feb 2026 18:02:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770055335; cv=none; b=q1k1P5AzuQJ6078jeIpVWFsn9f3/8cN3SlwvmEAlXCYGsTfxm5tKeSuR6aeMBHpSCPfYMj9O8IEPbFuBbwdXH1Kd0MhGTB49iP6FC6aHbuxYKGkrZ+2XuPXtgA0/nMjXAOSu/zNQ7USsBKpEzq3Rm9eJKbo+qiUcyiBDktAu7ck= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770055335; c=relaxed/simple; bh=MbAgTX+hDTfHzpvyoNvAv/VH86Gp5D8IWac2rvKmaY0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=YXTtgzx8czA7WHDyqrlx0GM0LaA52nJojQSVLRyDhI47mT/99CIIkp8jWmGimiaNZ5T1xAwkFTajxAhtHi3xFi1CYmZA28oJL45eZXzLIWA0qP3z6W5X13zHxkreZmcr8+wl909bdmrgINNlb/9urLwyfO6RDwuBO1WlAAbjl9k= 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=Aj1JpC+x; arc=none smtp.client-ip=209.85.160.175 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="Aj1JpC+x" Received: by mail-qt1-f175.google.com with SMTP id d75a77b69052e-502b0aa36feso50717141cf.1 for ; Mon, 02 Feb 2026 10:02:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1770055333; x=1770660133; 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=NMO26NJqLzUacsptvD643N0i+a1yKYqxDegqXwZutbI=; b=Aj1JpC+xrABNzYNRpCdkZPyfq4fpyHofQgTKnTflpXvwKssxlbTrRAytGzhuPWUdNK CfRYx9eV/CaKWasmMIYZOb3PbKKbRph2X5q9IzvXiW3Zp4VcIzjHLGh5BGVQq11KaLfK HIfPvH1wqREF7DiOxjT+o1zGx22ZdlKX59n2D/PmifZQ5eB6tz2BfWcSischrqsnggfy 1F79UPbPyw6n/UOrq3Aqn8haN46JgwftdoHEVRWplbueekIRggnWnH6OMK1GDMW35go/ vTvErql0wX5l2Qey8bJa5VH/Q24DExcroGeIQO0uC294obNNfFCH8LyGWZIWtX+AXCgn 9mRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770055333; x=1770660133; 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=NMO26NJqLzUacsptvD643N0i+a1yKYqxDegqXwZutbI=; b=Jncq7URGCxjsTfm/pQHmv7bouEM3xqh64Nt31OaI2sC2wqGaQTRf4ZaRblaE2grHZd SymAqGmMuhC8eCbxE9Fpmgg9+XN3rcsT+DcCY2q8pTQrcR7IF8vVsFadhIvuoe/Id9k8 6acBGJVG2XPhl7h9DK3WEk/U5It2zxLsYeflp+7DkTC/YvILu8bVlfpyg/+6KWc0vDKd i6tfHZhlOCtwHRBoYcXIdImodWDQiE9O5sU1IdVZlJAReOsV/uWWDDCYmnnVqi5jR3MX fbukHr+AfKSBIZsgUpOWoMm8otBZczaSBeyrdOV8OTQBXlWiOGBGNup6LyKrwZjm0dz5 Mbfg== X-Forwarded-Encrypted: i=1; AJvYcCWnKj0mnT1bWhWIDcK3AaMtKMARzto9DMNTV4KCxpydKt2mkxvMpwsvu676V7s288/gM7heI1ovi4UxxYM=@vger.kernel.org X-Gm-Message-State: AOJu0Ywzd7xTH5+6BuufNZ7x1mTC5G6cDlme22QTz1mUQhps6B5QvgmS JlP1CLDg/z9GNeLuUcpaJsMY4GO/tG0W3s9tOJksOb833NXlB7Lz5DM1wJGTLp4roKA= X-Gm-Gg: AZuq6aL4GHhcNJkw4WqIk3TZ7ge4innrQryGYww9uLD3ARpyMaOFWQhAlqWaDuKiyu9 DYWvkt7czdWEQRPsn+8EzSe6K4+eR//d9GL7fbFGxY3aN1dGayX01pHd1vgJx/8JlKMyRuvhk81 hn3+auNHzc7H3kS17P9Jynix7hEQ0e6AwEzvzWsR9BaLsClijtk0pYdSGFVAzZ6hPGPHGFhGET+ +dU1/SUbY5E4vigiWz5IFLuZsbGGjZdlTTzj0B34UPjb5B0k0cDCrWM81t6wapBablq0mS7zA2q 1ItfqlT12bAuAF1WLJL1snkX1r+QcSD8hqYfkVhKTdOV473Bu4ka3xOgJXr/ND+apeCP76ok2kl pA56dI4R037gFdGnZ8nLT3EVof02DOmHMYJxH6gHSgilxfCSJx9/9aCTR5fdT/xYu/9xvegQ2xD 8wwoIGdaTprrQHTcowqikEL876ZRq5vrLKhbVpVtvQ6jOtzYPMITMGF2UxCLrx3zs63FNQbg== X-Received: by 2002:ac8:5a54:0:b0:501:45d7:10cd with SMTP id d75a77b69052e-506092c7f24mr3163751cf.20.1770055332821; Mon, 02 Feb 2026 10:02:12 -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 6a1803df08f44-894d36c5430sm119862196d6.22.2026.02.02.10.02.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Feb 2026 10:02:12 -0800 (PST) Date: Mon, 2 Feb 2026 13:02:10 -0500 From: Gregory Price To: Jonathan Cameron Cc: linux-mm@kvack.org, linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kernel-team@meta.com, dave@stgolabs.net, dave.jiang@intel.com, alison.schofield@intel.com, vishal.l.verma@intel.com, ira.weiny@intel.com, dan.j.williams@intel.com, willy@infradead.org, jack@suse.cz, terry.bowman@amd.com, john@jagalactic.com, David Hildenbrand , Oscar Salvador , Andrew Morton Subject: Re: [PATCH 2/9] mm/memory_hotplug: add __add_memory_driver_managed() with online_type arg Message-ID: References: <20260129210442.3951412-1-gourry@gourry.net> <20260129210442.3951412-3-gourry@gourry.net> <20260202172524.00000c6d@huawei.com> 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: <20260202172524.00000c6d@huawei.com> On Mon, Feb 02, 2026 at 05:25:24PM +0000, Jonathan Cameron wrote: > On Thu, 29 Jan 2026 16:04:35 -0500 > Gregory Price wrote: > > > Enable dax kmem driver to select how to online the memory rather than > > implicitly depending on the system default. This will allow users of > > dax to plumb through a preferred auto-online policy for their region. > > > > Refactor and new interface: > > Add __add_memory_driver_managed() which accepts an explicit online_type > > and export mhp_get_default_online_type() so callers can pass it when > > they want the default behavior. > > Hi Gregory, > > I think maybe I'd have left the export for the first user outside of > memory_hotplug.c. Not particularly important however. > > Maybe talk about why a caller of __add_memory_driver_managed() might want > the default? Feels like that's for the people who don't... > Less about why they want the default, more about maintaining backward compatibility. In the cxl driver, Ben pointed out something that made me realize we can change `region/bind()` to actually use the new `sysram/bind` path by just adding a one line `sysram_regionN->online_type = default()` I can add this detail to the changelog. > > Other comments are mostly about using a named enum. I'm not sure > if there is some existing reason why that doesn't work? -Errno pushed through > this variable or anything like that? > I can add a cleanup-patch prior to use the enum, but i don't think this actually enables the compiler to do anything new at the moment? An enum just resolves to an int, and setting `enum thing val = -1` when the enum definition doesn't include -1 doesn't actually fire any errors (at least IIRC - maybe i'm just wrong). Same with function(enum) -> function(-1) wouldn't fire a compilation error It might actually be worth adding `MMOP_NOT_CONFIGURED = -1` so that the cxl-sysram driver can set this explicitly rather than just setting -1 as an implicit version of this - but then why would memory_hotplug.c ever want to expose a NOT_CONFIGURED option lol. So, yeah, the enum looks nicer, but not sure how much it buys us beyond that. > It's a little odd to add nice kernel-doc formatted documentation > when the non __ variant has free form docs. Maybe tidy that up first > if we want to go kernel-doc in this file? (I'm in favor, but no idea > on general feelings...) > ack. Can add some more cleanups early in the series. > > + if (online_type < 0 || online_type > MMOP_ONLINE_MOVABLE) > > This is where using an enum would help compiler know what is going on > and maybe warn if anyone writes something that isn't defined. > I think you still have to sanity check this, but maybe the code looks cleaner, so will do. ~Gregory