From: Peter Newman <peternewman@google.com>
To: Reinette Chatre <reinette.chatre@intel.com>,
Fenghua Yu <fenghua.yu@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H . Peter Anvin" <hpa@zytor.com>,
Babu Moger <babu.moger@amd.com>,
James Morse <james.morse@arm.com>,
Shaopeng Tan <tan.shaopeng@fujitsu.com>,
Tony Luck <tony.luck@intel.com>,
linux-kernel@vger.kernel.org, eranian@google.com,
Peter Newman <peternewman@google.com>
Subject: [PATCH v2] x86/resctrl: Disallow mongroup rename on MPAM
Date: Thu, 5 Dec 2024 16:38:45 +0100 [thread overview]
Message-ID: <20241205153845.394714-1-peternewman@google.com> (raw)
Moving a monitoring group to a different parent control assumes that the
monitors will not be impacted. This is not the case on MPAM where the
PMG is an extension of the PARTID.
Detect this situation by requiring the change in CLOSID not to affect
the result of resctrl_arch_rmid_idx_encode(), otherwise return
-EOPNOTSUPP.
Signed-off-by: Peter Newman <peternewman@google.com>
---
v1->v2:
- separated out from earlier series
- fixed capitalization in error message
[v1] https://lore.kernel.org/lkml/20240325172707.73966-4-peternewman@google.com/
---
arch/x86/kernel/cpu/resctrl/rdtgroup.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
index d906a1cd84917..8c77496b090cd 100644
--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
+++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
@@ -3888,6 +3888,19 @@ static int rdtgroup_rename(struct kernfs_node *kn,
goto out;
}
+ /*
+ * If changing the CLOSID impacts the RMID, this operation is not
+ * supported.
+ */
+ if (resctrl_arch_rmid_idx_encode(rdtgrp->mon.parent->closid,
+ rdtgrp->mon.rmid) !=
+ resctrl_arch_rmid_idx_encode(new_prdtgrp->closid,
+ rdtgrp->mon.rmid)) {
+ rdt_last_cmd_puts("Changing parent control group not supported\n");
+ ret = -EOPNOTSUPP;
+ goto out;
+ }
+
/*
* If the MON group is monitoring CPUs, the CPUs must be assigned to the
* current parent CTRL_MON group and therefore cannot be assigned to
base-commit: 40384c840ea1944d7c5a392e8975ed088ecf0b37
--
2.47.0.338.g60cca15819-goog
next reply other threads:[~2024-12-05 15:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-05 15:38 Peter Newman [this message]
2024-12-07 0:25 ` 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=20241205153845.394714-1-peternewman@google.com \
--to=peternewman@google.com \
--cc=babu.moger@amd.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=eranian@google.com \
--cc=fenghua.yu@intel.com \
--cc=hpa@zytor.com \
--cc=james.morse@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=reinette.chatre@intel.com \
--cc=tan.shaopeng@fujitsu.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
all inboxes | Powered by JetHome®