linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "David Hildenbrand (arm)" <david@kernel.org>
To: Gregory Price <gourry@gourry.net>,
	Jonathan Cameron <jonathan.cameron@huawei.com>
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, Oscar Salvador <osalvador@suse.de>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 2/9] mm/memory_hotplug: add __add_memory_driver_managed() with online_type arg
Date: Wed, 4 Feb 2026 22:08:45 +0100	[thread overview]
Message-ID: <3424eba7-523b-4351-abd0-3a888a3e5e61@kernel.org> (raw)
In-Reply-To: <aYEZAUJMLWvaug50@gourry-fedora-PF4VCD3F>

On 2/2/26 22:37, Gregory Price wrote:
> On Mon, Feb 02, 2026 at 06:46:09PM +0000, Jonathan Cameron wrote:
>>>
>>> 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?
>>
>> Good point. More coffee needed (or sleep)
>>
>> It lets sparse do some checking, but sadly only for wrong enum assignment.
>> (Gcc has -Wenum-conversion as well which I think is effectively the same)
>> I.e. you can't assign a value from a different enum without casting.
>>
>> It can't do anything if people just pass in an out of range int.
>>
> 
> Which, after looking a bit... mm/memory_hotplug.c does this quite a bit
> internally - except it uses a uint8_t
> 
> Example:
> 
> static int try_offline_memory_block(struct memory_block *mem, void *arg)
> {
>          uint8_t online_type = MMOP_ONLINE_KERNEL;
>          uint8_t **online_types = arg;
> 	... snip ...
> }
> 
> int offline_and_remove_memory(u64 start, u64 size)
> {
>          uint8_t *online_types, *tmp;
> 	... snip ...
>          online_types = kmalloc_array(mb_count, sizeof(*online_types),
>                                       GFP_KERNEL);
> }
> 
> So that's fun.
> 
> I'm not sure it's worth the churn here, but happy to do it if there are
> strong opinions.
> 
> ---
> 
> David do you have thoughts here?

I guess we should clean that all up where easily possible, but I don't 
expect you to do that.

For online_types I used it, obviously, to save memory. So I'd expect it 
to stay at least there, but cast it to the proper type once we take it 
out the array.

-- 
Cheers,

David


  reply	other threads:[~2026-02-04 21:08 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-29 21:04 [PATCH 0/9] cxl: explicit DAX driver selection and hotplug Gregory Price
2026-01-29 21:04 ` [PATCH 1/9] mm/memory_hotplug: pass online_type to online_memory_block() via arg Gregory Price
2026-02-02 17:10   ` Jonathan Cameron
2026-02-02 17:46     ` Gregory Price
2026-01-29 21:04 ` [PATCH 2/9] mm/memory_hotplug: add __add_memory_driver_managed() with online_type arg Gregory Price
2026-02-02 17:25   ` Jonathan Cameron
2026-02-02 18:02     ` Gregory Price
2026-02-02 18:46       ` Jonathan Cameron
2026-02-02 21:37         ` Gregory Price
2026-02-04 21:08           ` David Hildenbrand (arm) [this message]
2026-02-05  4:23             ` Gregory Price
2026-01-29 21:04 ` [PATCH 3/9] dax: plumb online_type from dax_kmem creators to hotplug Gregory Price
2026-01-29 21:04 ` [PATCH 4/9] drivers/cxl,dax: add dax driver mode selection for dax regions Gregory Price
2026-02-02 17:54   ` Jonathan Cameron
2026-01-29 21:04 ` [PATCH 5/9] cxl/core/region: move pmem region driver logic into pmem_region Gregory Price
2026-02-02 17:56   ` Jonathan Cameron
2026-01-29 21:04 ` [PATCH 6/9] cxl/core/region: move dax region device logic into dax_region.c Gregory Price
2026-02-02 17:57   ` Jonathan Cameron
2026-01-29 21:04 ` [PATCH 7/9] cxl/core: add cxl_devdax_region driver for explicit userland region binding Gregory Price
2026-01-29 21:04 ` [PATCH 8/9] cxl/core: Add dax_kmem_region and sysram_region drivers Gregory Price
2026-01-30 21:27   ` Cheatham, Benjamin
2026-01-30 22:12     ` Gregory Price
2026-02-02 17:02       ` Cheatham, Benjamin
2026-02-02 17:41         ` Gregory Price
2026-02-02 19:19         ` Gregory Price
2026-02-02 18:20   ` Jonathan Cameron
2026-02-02 18:23     ` Gregory Price
2026-01-29 21:04 ` [PATCH 9/9] Documentation/driver-api/cxl: add dax and sysram driver documentation Gregory Price
2026-01-29 21:17 ` [PATCH 0/9] cxl: explicit DAX driver selection and hotplug Gregory Price
2026-01-30 17:34 ` Gregory Price

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=3424eba7-523b-4351-abd0-3a888a3e5e61@kernel.org \
    --to=david@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=gourry@gourry.net \
    --cc=ira.weiny@intel.com \
    --cc=jack@suse.cz \
    --cc=john@jagalactic.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=kernel-team@meta.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nvdimm@lists.linux.dev \
    --cc=osalvador@suse.de \
    --cc=terry.bowman@amd.com \
    --cc=vishal.l.verma@intel.com \
    --cc=willy@infradead.org \
    /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