Xiao Yang wrote:
> 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.

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.

> 
> 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", &param.mode, "mode", "mode to 
> switch the device to"), \
>  OPT_BOOLEAN('N', "no-online", &param.no_online, \
>       "don't auto-online memory sections"), \
>  OPT_BOOLEAN('f', "force", &param.force, \
> -             "attempt to offline memory sections before reconfiguration"), \
> +             "attempt to offline memory sections for reconfiguration"), \
>  OPT_BOOLEAN('C', "check-config", &param.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;

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.

Reply via email to