@@ -264,8 +264,10 @@ static int cpus_mon_write(struct rdtgroup *rdtgrp, cpumask_var_t newmask,
264
264
265
265
/* Check whether cpus belong to parent ctrl group */
266
266
cpumask_andnot (tmpmask , newmask , & prgrp -> cpu_mask );
267
- if (cpumask_weight (tmpmask ))
267
+ if (cpumask_weight (tmpmask )) {
268
+ rdt_last_cmd_puts ("can only add CPUs to mongroup that belong to parent\n" );
268
269
return - EINVAL ;
270
+ }
269
271
270
272
/* Check whether cpus are dropped from this group */
271
273
cpumask_andnot (tmpmask , & rdtgrp -> cpu_mask , newmask );
@@ -317,8 +319,10 @@ static int cpus_ctrl_write(struct rdtgroup *rdtgrp, cpumask_var_t newmask,
317
319
cpumask_andnot (tmpmask , & rdtgrp -> cpu_mask , newmask );
318
320
if (cpumask_weight (tmpmask )) {
319
321
/* Can't drop from default group */
320
- if (rdtgrp == & rdtgroup_default )
322
+ if (rdtgrp == & rdtgroup_default ) {
323
+ rdt_last_cmd_puts ("Can't drop CPUs from default group\n" );
321
324
return - EINVAL ;
325
+ }
322
326
323
327
/* Give any dropped cpus to rdtgroup_default */
324
328
cpumask_or (& rdtgroup_default .cpu_mask ,
@@ -383,8 +387,10 @@ static ssize_t rdtgroup_cpus_write(struct kernfs_open_file *of,
383
387
}
384
388
385
389
rdtgrp = rdtgroup_kn_lock_live (of -> kn );
390
+ rdt_last_cmd_clear ();
386
391
if (!rdtgrp ) {
387
392
ret = - ENOENT ;
393
+ rdt_last_cmd_puts ("directory was removed\n" );
388
394
goto unlock ;
389
395
}
390
396
@@ -393,13 +399,16 @@ static ssize_t rdtgroup_cpus_write(struct kernfs_open_file *of,
393
399
else
394
400
ret = cpumask_parse (buf , newmask );
395
401
396
- if (ret )
402
+ if (ret ) {
403
+ rdt_last_cmd_puts ("bad cpu list/mask\n" );
397
404
goto unlock ;
405
+ }
398
406
399
407
/* check that user didn't specify any offline cpus */
400
408
cpumask_andnot (tmpmask , newmask , cpu_online_mask );
401
409
if (cpumask_weight (tmpmask )) {
402
410
ret = - EINVAL ;
411
+ rdt_last_cmd_puts ("can only assign online cpus\n" );
403
412
goto unlock ;
404
413
}
405
414
0 commit comments