Skip to content

Commit c1287d6

Browse files
sumanthkorikkarhcahca
authored andcommitted
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 73954d3 ("dax: add a sysfs knob to control memmap_on_memory behavior") Fixes: ff18dcb ("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>
1 parent 8840cc4 commit c1287d6

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/s390/char/sclp_mem.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,8 @@ static ssize_t sclp_memmap_on_memory_store(struct kobject *kobj, struct kobj_att
275275
rc = kstrtobool(buf, &value);
276276
if (rc)
277277
return rc;
278+
if (value && !mhp_supports_memmap_on_memory())
279+
return -EOPNOTSUPP;
278280
rc = lock_device_hotplug_sysfs();
279281
if (rc)
280282
return rc;

0 commit comments

Comments
 (0)