diff options
| author | Sumanth Korikkar <sumanthk@linux.ibm.com> | 2025-11-05 13:55:28 +0100 |
|---|---|---|
| committer | Heiko Carstens <hca@linux.ibm.com> | 2025-11-06 14:18:23 +0100 |
| commit | c1287d67c3a91aa19e4d9bbd3ad943cfbfa6bed4 (patch) | |
| tree | 2a38a0b74d10e5829fece84d3c53cb973a5b62ee | |
| parent | 8840cc45209b3224cb17a44c0ff4f95760baf761 (diff) | |
s390/sclp_mem: Consider global memory_hotplug.memmap_on_memory setting
When the global kernel command line parameter
memory_hotplug.memmap_on_memory is set to false, per-memory-block
memmap_on_memory setting can still be set to true. However, when
configuring memory block, add_memory_resource() would configure it
without memmap_on_memory.
i.e.
Even if the MHP_MEMMAP_ON_MEMORY flag is set,
mhp_supports_memmap_on_memory() returns false unless the kernel command
line parameter "memory_hotplug.memmap_on_memory" is enabled. When both
the flag and the cmdline parameter are set, the memory block can be
configured with or without memmap_on_memory support.
To ensure consistent behavior, permit configuring per-memory-block
memmap_on_memory only when the memory_hotplug.memmap_on_memory kernel
command line parameter is enabled.
This is similar to commit 73954d379efd ("dax: add a sysfs knob to
control memmap_on_memory behavior")
Fixes: ff18dcb19aab ("s390/sclp: Add support for dynamic (de)configuration of memory")
Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
| -rw-r--r-- | drivers/s390/char/sclp_mem.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/s390/char/sclp_mem.c b/drivers/s390/char/sclp_mem.c index 3a7a69615d99..bc515a24b3f2 100644 --- a/drivers/s390/char/sclp_mem.c +++ b/drivers/s390/char/sclp_mem.c @@ -275,6 +275,8 @@ static ssize_t sclp_memmap_on_memory_store(struct kobject *kobj, struct kobj_att rc = kstrtobool(buf, &value); if (rc) return rc; + if (value && !mhp_supports_memmap_on_memory()) + return -EOPNOTSUPP; rc = lock_device_hotplug_sysfs(); if (rc) return rc; |
