daxctl: Don't check param.no_movable when param.no_online is set
PATCH 1/2 daxctl: Don't check param.no_movable when param.no_online is set
param.no_movable is used to online memory in ZONE_NORMAL but param.no_online is used to not online memory. So it's unnecessary to check param.no_movable when param.no_online is set.
--- daxctl/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
daxctl/device.c +1 -1
@@ -711,7 +711,7 @@ static int reconfig_mode_system_ram(struct daxctl_dev *dev)const char *devname =daxctl_dev_get_devname (dev);int rc, skip_enable =0 ; -if (param.no_online || !param.no_movable) { +if (param.no_online) {if (!param.force &&daxctl_dev_will_auto_online_memory (dev)) { fprintf(stderr, "%s: error: kernel policy will auto-online memory, aborting\n",
Signature · 1 line
2.40.1
PATCH 2/2 daxctl: Force to offline memory by param.force
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.
--- daxctl/device.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
daxctl/device.c +7 -2
@@ -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); }
Signature · 1 line
2.40.1
RE: [NDCTL PATCH 2/2] daxctl: Force to offline memory by param.force
Quoted 3 lines · Xiao Yang
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_memoryreturns true.
So is the goal here to try to save some steps in the case where the kernel already onlined the device?
It should probably emit a warning that the memory was onlined automatically so the admin can consider changing the default kernel policy. Otherwise, it may be too late to undo the onlining at this point.
Quoted 20 lines
Signed-off-by Xiao Yang <[email protected]>--- daxctl/device.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)daxctl/device.c +1
-1@@ -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" )
daxctl/device.c static int reconfig_mode_system_ram(struct daxctl_dev *dev) · line 740
Quoted 8 lines
daxctl/device.c +4
-1@@ -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;
It is not clear that this is an error that should fail the reconfigure-device, because the reconfiguration succeeded. The fact that the kernel policy forced the memory online is the administrators fault for setting conflicting policy. This is why I think a warning is appropriate because the administrator is confused if they are letting kernel an daxctl policy conflict.
Ping
-----Original Message-----
From: Xiao Yang <[email protected]>
Sent: 2023年8月10日 13:40
To: [email protected]; [email protected]
Cc: [email protected]; Yang, Xiao/杨 晓 <[email protected]>
Subject: [NDCTL PATCH 1/2] daxctl: Don't check param.no_movable when param.no_online is set
param.no_movable is used to online memory in ZONE_NORMAL but param.no_online is used to not online memory. So it's unnecessary to check param.no_movable when param.no_online is set.
--- daxctl/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
daxctl/device.c +1 -1
@@ -711,7 +711,7 @@ static int reconfig_mode_system_ram(struct daxctl_dev *dev)const char *devname =daxctl_dev_get_devname (dev);int rc, skip_enable =0 ; -if (param.no_online || !param.no_movable) { +if (param.no_online) {if (!param.force &&daxctl_dev_will_auto_online_memory (dev)) { fprintf(stderr, "%s: error: kernel policy will auto-online memory, aborting\n",
--
2.40.1
Hi All,
Ping, is there any feedback on this patchset?
Best Regards,
Xiao Yang
Quoted 31 lines · Xiao/杨 晓
Ping
-----Original Message-----
From: Xiao Yang <[email protected]>
Sent: 2023年8月10日 13:40
To: [email protected]; [email protected]
Cc: [email protected]; Yang, Xiao/杨 晓 <[email protected]>
Subject: [NDCTL PATCH 1/2] daxctl: Don't check param.no_movable when param.no_online is setparam.no_movable is used to online memory in
ZONE_NORMALbut param.no_online is used to not online memory. So it's unnecessary to check param.no_movable when param.no_online is set.Signed-off-by Xiao Yang <[email protected]>--- daxctl/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)daxctl/device.c +1
-2@@ -711,7 +711,7 @@ static int reconfig_mode_system_ram(struct daxctl_dev *dev)const char *devname =daxctl_dev_get_devname (dev);int rc, skip_enable =0 ; -if (param.no_online || !param.no_movable) { +if (param.no_online) {if (!param.force &&daxctl_dev_will_auto_online_memory (dev)) { fprintf(stderr, "%s: error: kernel policy will auto-online memory, aborting\n", --2.40.1
Hey, apologies for the delay here, and appreciate the pings.
Quoted 14 lines · Xiao Yang
param.no_movable is used to online memory in
ZONE_NORMALbut param.no_online is used to not online memory. So it's unnecessary to check param.no_movable when param.no_online is set.Signed-off-by Xiao Yang <[email protected]>--- daxctl/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)daxctl/device.c +0
-0
daxctl/device.c static int reconfig_mode_system_ram(struct daxctl_dev *dev) · line 714
Quoted 5 lines
daxctl/device.c +1
-1@@ -711,7 +711,7 @@ static int reconfig_mode_system_ram(struct daxctl_dev *dev)const char *devname =daxctl_dev_get_devname (dev);int rc, skip_enable =0 ; -if (param.no_online || !param.no_movable) { +if (param.no_online) {
I agree that if daxctl is not going to online the memory then it does not matter what no_movable is set to. However, part of what is happening here is to communicate when daxctl options collide with kernel policy.
I.e. consider the case where no_movable is set and the kernel policy is set to online_movable, then daxctl should communicate:
"error: kernel policy will auto-online memory, aborting"
Maybe the fix here is to split the no-online vs "online or online_movable" kernel policy, and the no-movable vs "online_movable" kernel policy.