On Mon, 2023-10-30 at 14:41 +0800, Cao, Quanquan/曹 全全 wrote:
>
[..]
> After investigation, it was found that when disabling the region and
> attempting to disable the same region again, the message "cxl region:
> cmd_disable_region: disabled 1 region" is still returned.
> I consider this to be unreasonable.
>
>
> Test Example:
>
> [root@fedora-37-client memory]# cxl list
> [
> {
> "memdevs":[
> {
> "memdev":"mem0",
> "ram_size":1073741824,
> "serial":0,
> "host":"0000:0d:00.0"
> }
> ]
> },
> {
> "regions":[
> {
> "region":"region0",
> "resource":27111981056,
> "size":1073741824,
> "type":"ram",
> "interleave_ways":1,
> "interleave_granularity":256,
> "decode_state":"commit"
> }
> ]
> }
> ]
>
> [root@fedora-37-client ~]# cxl disable-region region0
> cxl region: cmd_disable_region: disabled 1 region
> [root@fedora-37-client ~]# cxl disable-region region0
> cxl region: cmd_disable_region: disabled 1 region
>
> expectation:cmd_disable_region: disabled 0 region
This is by design, I think it would be more confusing if the user asks
to disable-region, the response is "disabled 0 regions", and then finds
that the region is actually in the disabled state.
There is also precedent for this, as all disable-<foo> commands in
ndctl and cxl-cli behave the same way.
Perhaps a clarification in the man page makes sense noting this
behavior?