public inbox for patches@lists.linux.dev
 help / color / mirror / Atom feed
From: Reinette Chatre <reinette.chatre@intel.com>
To: tony.luck@intel.com, james.morse@arm.com, Dave.Martin@arm.com,
	babu.moger@amd.com, bp@alien8.de, tglx@linutronix.de,
	dave.hansen@linux.intel.com
Cc: x86@kernel.org, hpa@zytor.com, ben.horgan@arm.com,
	fustini@kernel.org, fenghuay@nvidia.com, peternewman@google.com,
	linux-kernel@vger.kernel.org, patches@lists.linux.dev,
	reinette.chatre@intel.com
Subject: [PATCH v3 00/13] x86,fs/resctrl: Improve resctrl quality and consistency
Date: Tue,  7 Apr 2026 09:01:57 -0700	[thread overview]
Message-ID: <cover.1775576382.git.reinette.chatre@intel.com> (raw)

Changes since v2:
- v2: https://lore.kernel.org/lkml/cover.1774043709.git.reinette.chatre@intel.com/
- Rebased on top of tip/master with pending resctrl selftest changes,
  https://lore.kernel.org/lkml/cover.1775266384.git.reinette.chatre@intel.com/,
  applied on top to support testing with latest kernel that has pending resctrl
  changes merged.
- Drop "fs/resctrl: Use stricter checks on input to cpus/cpus_list file"
  that ended up being too strict and removed one use case. (Chris)
- max_threshold_occ_write() switch to guard(). (Chenyu)
- Add more detail to one return value description.
- Add tags.
- No opinions so far on needing to update last_cmd_status on success of all read
  commands. At this time last_cmd_status will continue to return previous
  failure message (if any) after a read command accessing static data succeeds.

Changes since v1:
- v1: https://lore.kernel.org/lkml/cover.1772476561.git.reinette.chatre@intel.com/
- To simplify tracking, include patch to MAINTAINERS submitted separately:
  https://lore.kernel.org/lkml/4274c478922c01f9ceebc805acf991f10a95519f.1771442788.git.reinette.chatre@intel.com/
- Follow recent upstream changes to add reference to tip tree handbook in
  MAINTAINERS entry.
- Use new pattern in resctrl to enable looping over all entries of an enum
  while making adding new enum entries more clear all while avoiding warnings
  when compiling with -Wswitch. (Ben)
- Add another last_cmd_status enhancement that appends "[truncated]" to
  output of info/last_cmd_status if the backing buffer overflowed.
- Please see patch changelogs for details of changes.
- Add tags.

Hi Everybody,

This is a collection of resctrl cleanups assembled together for convenience
and simpler tracking. I'd be happy to split them up if it makes review and/or
handling easier.

Summary of changes:

- Let resctrl pass stricter checks from various tools to provide a cleaner
  baseline with the goal to promote healthier contributions:
  - ./tools/docs/kernel-doc -Wall -v <files>
  - Build with W=12
  - ./scripts/coccicheck
  - Static checkers

- Use accurate and consistent type for all uses of resource ID.

- In the unlikely scenario that resctrl picked a wrong CPU to read an event
  from, pass the error through to user space instead of claiming to succeed
  and returning a (wrong) result.

- Since inception of last_cmd_status feature there have been mismatches
  between resctrl file operation failures and the contents of
  info/last_cmd_status. This pattern keeps propagating with each new resctrl
  feature. Establish a new baseline with a new pattern that ensures
  info/last_cmd_status contains an accurate failure description that matches
  the most recent resctrl file operation failure.

One potential open:

There remains an inconsistency between resctrl file operations that do/can
_not_ fail and the contents of info/last_cmd_status. If a resctrl
file operation fails and an informational error is printed to last_cmd_status
then a subsequent reading of a resctrl file (specifically most of the files
found in info/) may succeed while info/last_cmd_status may or may not return
the error from previous failure.

Ensuring last_cmd_status is reset on every read carries the cost of taking
rdtgroup_mutex on several more user space initiated paths and thus increase
contention on rdtgroup_mutex. I opted to not make this change and instead
focus this work on ensuring that last_cmd_status is accurate whenever there is
a failure during any resctrl file operation. Please let me know if you have
opinions in this regard.

Any feedback is appreciated.

Regards,

Reinette

Reinette Chatre (13):
  MAINTAINERS: Update resctrl entry
  fs/resctrl: Add missing return value descriptions
  fs/resctrl: Avoid "may be used uninitialized" warning
  fs/resctrl: Use correct format specifier for printing error pointers
  x86/resctrl: Protect against bad shift
  fs/resctrl: Change pattern used to track number of entries in enum
  fs/resctrl: Use accurate type for rdt_resource::rid
  fs/resctrl: Pass error reading event through to user space
  fs/resctrl: Add last_cmd_status support for writes to
    max_threshold_occupancy
  fs/resctrl: Use accurate and symmetric exit flows
  fs/resctrl: Change last_cmd_status custom during input parsing
  fs/resctrl: Communicate resource group deleted error via
    last_cmd_status
  fs/resctrl: Inform user space when status buffer overflowed

 MAINTAINERS                        |   2 +
 arch/x86/kernel/cpu/resctrl/core.c |   4 +-
 fs/resctrl/ctrlmondata.c           |  70 +++++++++-------
 fs/resctrl/monitor.c               |  80 ++++++++++--------
 fs/resctrl/pseudo_lock.c           |   2 +-
 fs/resctrl/rdtgroup.c              | 126 ++++++++++++++++++-----------
 include/linux/resctrl.h            |  11 +--
 7 files changed, 180 insertions(+), 115 deletions(-)

-- 
2.50.1


             reply	other threads:[~2026-04-07 16:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-07 16:01 Reinette Chatre [this message]
2026-04-07 16:01 ` [PATCH v3 01/13] MAINTAINERS: Update resctrl entry Reinette Chatre
2026-04-07 16:01 ` [PATCH v3 02/13] fs/resctrl: Add missing return value descriptions Reinette Chatre
2026-04-07 16:02 ` [PATCH v3 03/13] fs/resctrl: Avoid "may be used uninitialized" warning Reinette Chatre
2026-04-07 18:55   ` Borislav Petkov
2026-04-07 20:50     ` Reinette Chatre
2026-04-07 22:19       ` Borislav Petkov
2026-04-07 22:56         ` Reinette Chatre
2026-04-07 16:02 ` [PATCH v3 04/13] fs/resctrl: Use correct format specifier for printing error pointers Reinette Chatre
2026-04-07 16:02 ` [PATCH v3 05/13] x86/resctrl: Protect against bad shift Reinette Chatre
2026-04-08 16:37   ` Reinette Chatre
2026-04-07 16:02 ` [PATCH v3 06/13] fs/resctrl: Change pattern used to track number of entries in enum Reinette Chatre
2026-04-07 16:02 ` [PATCH v3 07/13] fs/resctrl: Use accurate type for rdt_resource::rid Reinette Chatre
2026-04-07 16:02 ` [PATCH v3 08/13] fs/resctrl: Pass error reading event through to user space Reinette Chatre
2026-04-07 16:02 ` [PATCH v3 09/13] fs/resctrl: Add last_cmd_status support for writes to max_threshold_occupancy Reinette Chatre
2026-04-07 16:02 ` [PATCH v3 10/13] fs/resctrl: Use accurate and symmetric exit flows Reinette Chatre
2026-04-07 16:02 ` [PATCH v3 11/13] fs/resctrl: Change last_cmd_status custom during input parsing Reinette Chatre
2026-04-07 16:02 ` [PATCH v3 12/13] fs/resctrl: Communicate resource group deleted error via last_cmd_status Reinette Chatre
2026-04-07 16:02 ` [PATCH v3 13/13] fs/resctrl: Inform user space when status buffer overflowed Reinette Chatre

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1775576382.git.reinette.chatre@intel.com \
    --to=reinette.chatre@intel.com \
    --cc=Dave.Martin@arm.com \
    --cc=babu.moger@amd.com \
    --cc=ben.horgan@arm.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=fenghuay@nvidia.com \
    --cc=fustini@kernel.org \
    --cc=hpa@zytor.com \
    --cc=james.morse@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=peternewman@google.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox