Commit 7da4480
cxl/list: show region locked status to user
A region is not allowed to be destroyed if it is in locked status.
cxl destroy-region command will fail and ask user to try it again as
root, but it is not the real reason and it will confuse user if user is
already a root user. This patch will show the region locked status in
region information and output an explicit log to user that operation is
not permitted like below.
Before the patch:
cxl list -ir region0
[
{
"region":"region0",
"resource":53955526656,
"size":536870912,
"type":"ram",
"interleave_ways":2,
"interleave_granularity":256,
"decode_state":"commit",
"state":"disabled",
"qos_class_mismatch":true
}
]
cxl destroy-region region0
libcxl: write_attr: failed to write 0
to /sys/bus/cxl/devices/root0/decoder0.0/region0/commit: Operation not permitted hint: try running as root or using sudo
cxl region: destroy_region: region0: failed to reset decode: Operation not permitted
cxl region: decoder_region_action: region0: failed: Operation not permitted
cxl region: region_action: one or more failures, last failure: Operation not permitted
cxl region: cmd_destroy_region: destroyed 0 regions
After the patch:
cxl list -ir region0
[
{
"region":"region0",
"resource":53955526656,
"size":536870912,
"type":"ram",
"interleave_ways":2,
"interleave_granularity":256,
"decode_state":"commit",
"state":"disabled",
"locked":true,
"qos_class_mismatch":true
}
]
cxl destroy-region region0
cxl region: destroy_region: region0: Cannot destroy a locked region.
cxl region: decoder_region_action: region0: failed: Operation not permitted
cxl region: region_action: one or more failures, last failure: Operation not permitted
cxl region: cmd_destroy_region: destroyed 0 regions
[ as: return enum cxl_region_locked_state from accessor,
map sysfs values explicitly to enum states,
replace enum-to-bool conversion with explicit enum comparisons ]
Signed-off-by: Li Ming <ming.li@zohomail.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Tested-by: Alison Schofield <alison.schofield@intel.com>
Link: https://lore.kernel.org/r/20260403050459.2236-1-ming.li@zohomail.com
Signed-off-by: Alison Schofield <alison.schofield@intel.com>1 parent 38068a5 commit 7da4480
6 files changed
+42
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1007 | 1007 | | |
1008 | 1008 | | |
1009 | 1009 | | |
| 1010 | + | |
1010 | 1011 | | |
1011 | 1012 | | |
1012 | 1013 | | |
| |||
1077 | 1078 | | |
1078 | 1079 | | |
1079 | 1080 | | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
1080 | 1088 | | |
1081 | 1089 | | |
1082 | 1090 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
472 | 472 | | |
473 | 473 | | |
474 | 474 | | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
475 | 481 | | |
476 | 482 | | |
477 | 483 | | |
| |||
689 | 695 | | |
690 | 696 | | |
691 | 697 | | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
692 | 705 | | |
693 | 706 | | |
694 | 707 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| 192 | + | |
192 | 193 | | |
193 | 194 | | |
194 | 195 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
354 | 354 | | |
355 | 355 | | |
356 | 356 | | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
357 | 366 | | |
358 | 367 | | |
359 | 368 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
837 | 837 | | |
838 | 838 | | |
839 | 839 | | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
840 | 846 | | |
841 | 847 | | |
842 | 848 | | |
| |||
0 commit comments