From: "Moger, Babu" <babu.moger@amd.com>
To: James Morse <james.morse@arm.com>,
x86@kernel.org, linux-kernel@vger.kernel.org
Cc: Fenghua Yu <fenghua.yu@intel.com>,
Reinette Chatre <reinette.chatre@intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
H Peter Anvin <hpa@zytor.com>,
shameerali.kolothum.thodi@huawei.com,
D Scott Phillips OS <scott@os.amperecomputing.com>,
carl@os.amperecomputing.com, lcherian@marvell.com,
bobo.shaobowang@huawei.com, tan.shaopeng@fujitsu.com,
baolin.wang@linux.alibaba.com,
Jamie Iles <quic_jiles@quicinc.com>,
Xin Hao <xhao@linux.alibaba.com>,
peternewman@google.com, dfustini@baylibre.com,
amitsinght@marvell.com
Subject: Re: [PATCH v7 05/24] x86/resctrl: Track the closid with the rmid
Date: Thu, 9 Nov 2023 14:31:37 -0600 [thread overview]
Message-ID: <77d92d3e-7259-418f-8b3a-e245dbc3d259@amd.com> (raw)
In-Reply-To: <20231025180345.28061-6-james.morse@arm.com>
Hi James,
On 10/25/23 13:03, James Morse wrote:
> x86's RMID are independent of the CLOSID. An RMID can be allocated,
> used and freed without considering the CLOSID.
>
> MPAM's equivalent feature is PMG, which is not an independent number,
> it extends the CLOSID/PARTID space. For MPAM, only PMG-bits worth of
> 'RMID' can be allocated for a single CLOSID.
> i.e. if there is 1 bit of PMG space, then each CLOSID can have two
> monitor groups.
>
> To allow resctrl to disambiguate RMID values for different CLOSID,
> everything in resctrl that keeps an RMID value needs to know the CLOSID
> too. This will always be ignored on x86.
>
> Tested-by: Shaopeng Tan <tan.shaopeng@fujitsu.com>
> Tested-by: Peter Newman <peternewman@google.com>
> Reviewed-by: Shaopeng Tan <tan.shaopeng@fujitsu.com>
> Reviewed-by: Xin Hao <xhao@linux.alibaba.com>
> Signed-off-by: James Morse <james.morse@arm.com>
>
> ---
> Is there a better term for 'the unique identifier for a monitor group'.
> Using RMID for that here may be confusing...
>
> Changes since v1:
> * Added comment in struct rmid_entry
>
> Changes since v2:
> * Moved X86_RESCTRL_BAD_CLOSID from a subsequent patch
>
> Chances since v3:
> * Renamed X86_RESCTRL_BAD_CLOSID to EMPTY
> * Clarified a few comments and kernel-doc
>
> Changes since v5:
> * Use entry->closid from the iterator, instead of the parent control group.
> * Move the reserved defines into this patch to reduce the churn.
> * Added some kernel doc.
> * Renamed some arch closid parameters as 'unused'.
>
> Changes since v6:
> * Changes to comments.
> ---
> arch/x86/include/asm/resctrl.h | 7 +++
> arch/x86/kernel/cpu/resctrl/internal.h | 2 +-
> arch/x86/kernel/cpu/resctrl/monitor.c | 74 ++++++++++++++---------
> arch/x86/kernel/cpu/resctrl/pseudo_lock.c | 4 +-
> arch/x86/kernel/cpu/resctrl/rdtgroup.c | 12 ++--
> include/linux/resctrl.h | 16 ++++-
> 6 files changed, 77 insertions(+), 38 deletions(-)
>
> diff --git a/arch/x86/include/asm/resctrl.h b/arch/x86/include/asm/resctrl.h
> index 255a78d9d906..cc6e1bce7b1a 100644
> --- a/arch/x86/include/asm/resctrl.h
> +++ b/arch/x86/include/asm/resctrl.h
> @@ -7,6 +7,13 @@
> #include <linux/sched.h>
> #include <linux/jump_label.h>
>
> +/*
> + * This value can never be a valid CLOSID, and is used when mapping a
> + * (closid, rmid) pair to an index and back. On x86 only the RMID is
> + * needed. The index is a software defined value.
> + */
> +#define X86_RESCTRL_EMPTY_CLOSID ((u32)~0)
> +
> /**
> * struct resctrl_pqr_state - State cache for the PQR MSR
> * @cur_rmid: The cached Resource Monitoring ID
> diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h
> index f68c6aecfa66..c836e3294e12 100644
> --- a/arch/x86/kernel/cpu/resctrl/internal.h
> +++ b/arch/x86/kernel/cpu/resctrl/internal.h
> @@ -544,7 +544,7 @@ struct rdt_domain *get_domain_from_cpu(int cpu, struct rdt_resource *r);
> int closids_supported(void);
> void closid_free(int closid);
> int alloc_rmid(void);
> -void free_rmid(u32 rmid);
> +void free_rmid(u32 closid, u32 rmid);
> int rdt_get_mon_l3_config(struct rdt_resource *r);
> void __exit rdt_put_mon_l3_config(struct rdt_resource *r);
> bool __init rdt_cpu_has(int flag);
> diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c
> index 5d9864919f1c..2a0233cd0bc9 100644
> --- a/arch/x86/kernel/cpu/resctrl/monitor.c
> +++ b/arch/x86/kernel/cpu/resctrl/monitor.c
> @@ -24,7 +24,20 @@
>
> #include "internal.h"
>
> +/**
> + * struct rmid_entry - dirty tracking for all RMID.
> + * @closid: The CLOSID for this entry.
> + * @rmid: The RMID for this entry.
> + * @busy: The number of domains with cached data using this RMID.
> + * @list: Member of the rmid_free_lru list when busy == 0.
> + *
> + * Depending on the architecture the correct monitor is accessed using
> + * both @closid and @rmid, or @rmid only.
> + *
> + * Take the rdtgroup_mutex when accessing.
> + */
> struct rmid_entry {
> + u32 closid;
> u32 rmid;
> int busy;
> struct list_head list;
> @@ -136,7 +149,7 @@ static inline u64 get_corrected_mbm_count(u32 rmid, unsigned long val)
> return val;
> }
>
> -static inline struct rmid_entry *__rmid_entry(u32 rmid)
> +static inline struct rmid_entry *__rmid_entry(u32 closid, u32 rmid)
> {
> struct rmid_entry *entry;
>
> @@ -190,7 +203,8 @@ static struct arch_mbm_state *get_arch_mbm_state(struct rdt_hw_domain *hw_dom,
> }
>
> void resctrl_arch_reset_rmid(struct rdt_resource *r, struct rdt_domain *d,
> - u32 rmid, enum resctrl_event_id eventid)
> + u32 unused, u32 rmid,
> + enum resctrl_event_id eventid)
> {
> struct rdt_hw_domain *hw_dom = resctrl_to_arch_dom(d);
> struct arch_mbm_state *am;
> @@ -230,7 +244,8 @@ static u64 mbm_overflow_count(u64 prev_msr, u64 cur_msr, unsigned int width)
> }
>
> int resctrl_arch_rmid_read(struct rdt_resource *r, struct rdt_domain *d,
> - u32 rmid, enum resctrl_event_id eventid, u64 *val)
> + u32 unused, u32 rmid, enum resctrl_event_id eventid,
> + u64 *val)
> {
> struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r);
> struct rdt_hw_domain *hw_dom = resctrl_to_arch_dom(d);
> @@ -285,9 +300,9 @@ void __check_limbo(struct rdt_domain *d, bool force_free)
> if (nrmid >= r->num_rmid)
> break;
>
> - entry = __rmid_entry(nrmid);
> + entry = __rmid_entry(X86_RESCTRL_EMPTY_CLOSID, nrmid);// temporary
What is temporary means here? Can you please elaborate(or remove)?
Thanks
Babu Moger
next prev parent reply other threads:[~2023-11-09 20:32 UTC|newest]
Thread overview: 103+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-25 18:03 [PATCH v7 00/24] x86/resctrl: monitored closid+rmid together, separate arch/fs locking James Morse
2023-10-25 18:03 ` [PATCH v7 01/24] tick/nohz: Move tick_nohz_full_mask declaration outside the #ifdef James Morse
2023-10-25 18:03 ` [PATCH v7 02/24] x86/resctrl: kfree() rmid_ptrs from rdtgroup_exit() James Morse
2023-11-09 17:39 ` Reinette Chatre
2023-12-13 18:03 ` James Morse
2023-12-13 23:27 ` Reinette Chatre
2023-12-14 18:28 ` James Morse
2023-12-14 19:06 ` Reinette Chatre
2023-12-15 17:40 ` James Morse
2023-11-09 20:28 ` Moger, Babu
2023-12-13 18:03 ` James Morse
2023-10-25 18:03 ` [PATCH v7 03/24] x86/resctrl: Create helper for RMID allocation and mondata dir creation James Morse
2023-11-09 17:40 ` Reinette Chatre
2023-11-09 20:28 ` Moger, Babu
2023-12-13 18:03 ` James Morse
2023-10-25 18:03 ` [PATCH v7 04/24] x86/resctrl: Move rmid allocation out of mkdir_rdt_prepare() James Morse
2023-11-09 20:29 ` Moger, Babu
2023-12-13 18:03 ` James Morse
2023-10-25 18:03 ` [PATCH v7 05/24] x86/resctrl: Track the closid with the rmid James Morse
2023-11-09 17:41 ` Reinette Chatre
2023-12-13 18:03 ` James Morse
2023-11-09 20:31 ` Moger, Babu [this message]
2023-12-13 18:04 ` James Morse
2023-10-25 18:03 ` [PATCH v7 06/24] x86/resctrl: Access per-rmid structures by index James Morse
2023-10-31 7:43 ` [EXT] " Amit Singh Tomar
2023-12-11 14:33 ` James Morse
2024-01-21 10:27 ` Amit Singh Tomar
2024-01-22 18:07 ` James Morse
2023-11-09 17:42 ` Reinette Chatre
2023-12-13 18:04 ` James Morse
2023-11-09 20:32 ` Moger, Babu
2023-10-25 18:03 ` [PATCH v7 07/24] x86/resctrl: Allow RMID allocation to be scoped by CLOSID James Morse
2023-11-09 17:42 ` Reinette Chatre
2023-11-09 20:32 ` Moger, Babu
2023-10-25 18:03 ` [PATCH v7 08/24] x86/resctrl: Track the number of dirty RMID a CLOSID has James Morse
2023-11-09 17:43 ` Reinette Chatre
2023-12-13 18:04 ` James Morse
2023-11-09 20:38 ` Moger, Babu
2023-12-13 18:04 ` James Morse
2023-10-25 18:03 ` [PATCH v7 09/24] x86/resctrl: Use __set_bit()/__clear_bit() instead of open coding James Morse
2023-11-09 17:44 ` Reinette Chatre
2023-12-13 18:05 ` James Morse
2023-11-09 20:38 ` Moger, Babu
2023-12-13 18:05 ` James Morse
2023-10-25 18:03 ` [PATCH v7 10/24] x86/resctrl: Allocate the cleanest CLOSID by searching closid_num_dirty_rmid James Morse
2023-11-09 17:46 ` Reinette Chatre
2023-12-14 11:36 ` James Morse
2023-11-09 20:39 ` Moger, Babu
2023-12-14 11:37 ` James Morse
2023-10-25 18:03 ` [PATCH v7 11/24] x86/resctrl: Move CLOSID/RMID matching and setting to use helpers James Morse
2023-11-09 20:39 ` Moger, Babu
2023-12-14 11:37 ` James Morse
2023-11-09 20:39 ` Moger, Babu
2023-10-25 18:03 ` [PATCH v7 12/24] x86/resctrl: Add cpumask_any_housekeeping() for limbo/overflow James Morse
2023-11-09 17:46 ` Reinette Chatre
2023-11-09 20:40 ` Moger, Babu
2023-10-25 18:03 ` [PATCH v7 13/24] x86/resctrl: Queue mon_event_read() instead of sending an IPI James Morse
2023-11-09 17:46 ` Reinette Chatre
2023-11-09 20:40 ` Moger, Babu
2023-12-14 11:37 ` James Morse
2023-10-25 18:03 ` [PATCH v7 14/24] x86/resctrl: Allow resctrl_arch_rmid_read() to sleep James Morse
2023-11-09 17:47 ` Reinette Chatre
2023-12-14 11:37 ` James Morse
2023-12-14 18:52 ` Reinette Chatre
2023-11-09 20:42 ` Moger, Babu
2023-12-14 11:37 ` James Morse
2023-10-25 18:03 ` [PATCH v7 15/24] x86/resctrl: Allow arch to allocate memory needed in resctrl_arch_rmid_read() James Morse
2023-11-09 20:47 ` Moger, Babu
2023-12-14 11:38 ` James Morse
2023-10-25 18:03 ` [PATCH v7 16/24] x86/resctrl: Make resctrl_mounted checks explicit James Morse
2023-11-09 20:47 ` Moger, Babu
2023-12-14 11:38 ` James Morse
2023-10-25 18:03 ` [PATCH v7 17/24] x86/resctrl: Move alloc/mon static keys into helpers James Morse
2023-11-09 20:48 ` Moger, Babu
2023-10-25 18:03 ` [PATCH v7 18/24] x86/resctrl: Make rdt_enable_key the arch's decision to switch James Morse
2023-11-09 20:48 ` Moger, Babu
2023-10-25 18:03 ` [PATCH v7 19/24] x86/resctrl: Add helpers for system wide mon/alloc capable James Morse
2023-11-09 20:51 ` Moger, Babu
2023-12-14 11:38 ` James Morse
2023-10-25 18:03 ` [PATCH v7 20/24] x86/resctrl: Add CPU online callback for resctrl work James Morse
2023-11-09 20:51 ` Moger, Babu
2023-12-14 11:38 ` James Morse
2023-10-25 18:03 ` [PATCH v7 21/24] x86/resctrl: Allow overflow/limbo handlers to be scheduled on any-but cpu James Morse
2023-11-09 17:48 ` Reinette Chatre
2023-12-14 11:38 ` James Morse
2023-12-14 18:53 ` Reinette Chatre
2023-12-15 17:41 ` James Morse
2023-11-09 20:51 ` Moger, Babu
2023-12-14 11:38 ` James Morse
2023-10-25 18:03 ` [PATCH v7 22/24] x86/resctrl: Add CPU offline callback for resctrl work James Morse
2023-11-09 20:52 ` Moger, Babu
2023-12-14 11:39 ` James Morse
2023-10-25 18:03 ` [PATCH v7 23/24] x86/resctrl: Move domain helper migration into resctrl_offline_cpu() James Morse
2023-11-09 20:52 ` Moger, Babu
2023-10-25 18:03 ` [PATCH v7 24/24] x86/resctrl: Separate arch and fs resctrl locks James Morse
2023-11-09 17:48 ` Reinette Chatre
2023-12-14 11:39 ` James Morse
2023-11-09 20:52 ` Moger, Babu
2023-12-14 11:39 ` James Morse
2023-11-09 14:05 ` [PATCH v7 00/24] x86/resctrl: monitored closid+rmid together, separate arch/fs locking Moger, Babu
2023-12-14 11:39 ` James Morse
2023-11-13 1:54 ` Shaopeng Tan (Fujitsu)
2023-12-14 18:28 ` James Morse
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=77d92d3e-7259-418f-8b3a-e245dbc3d259@amd.com \
--to=babu.moger@amd.com \
--cc=amitsinght@marvell.com \
--cc=baolin.wang@linux.alibaba.com \
--cc=bobo.shaobowang@huawei.com \
--cc=bp@alien8.de \
--cc=carl@os.amperecomputing.com \
--cc=dfustini@baylibre.com \
--cc=fenghua.yu@intel.com \
--cc=hpa@zytor.com \
--cc=james.morse@arm.com \
--cc=lcherian@marvell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peternewman@google.com \
--cc=quic_jiles@quicinc.com \
--cc=reinette.chatre@intel.com \
--cc=scott@os.amperecomputing.com \
--cc=shameerali.kolothum.thodi@huawei.com \
--cc=tan.shaopeng@fujitsu.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=xhao@linux.alibaba.com \
/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