Try to make daxctl reconfigure-device with system-ram mode offline memory when both param.no_online and param.force are set but daxctl_dev_will_auto_online_memory returns true.
Signed-off-by: Xiao Yang <[email protected]> --- daxctl/device.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/daxctl/device.c b/daxctl/device.c index ba31eb6..dfa7f79 100644 --- a/daxctl/device.c +++ b/daxctl/device.c @@ -83,7 +83,7 @@ OPT_STRING('m', "mode", ¶m.mode, "mode", "mode to switch the device to"), \ OPT_BOOLEAN('N', "no-online", ¶m.no_online, \ "don't auto-online memory sections"), \ OPT_BOOLEAN('f', "force", ¶m.force, \ - "attempt to offline memory sections before reconfiguration"), \ + "attempt to offline memory sections for reconfiguration"), \ OPT_BOOLEAN('C', "check-config", ¶m.check_config, \ "use config files to determine parameters for the operation") @@ -734,8 +734,13 @@ static int reconfig_mode_system_ram(struct daxctl_dev *dev) return rc; } - if (param.no_online) + if (param.no_online) { + if (param.force && daxctl_dev_will_auto_online_memory(dev)) { + rc = dev_offline_memory(dev); + return rc; + } return 0; + } return dev_online_memory(dev); } -- 2.40.1
