From: Reinette Chatre <reinette.chatre@intel.com>
To: James Morse <james.morse@arm.com>, <x86@kernel.org>,
<linux-kernel@vger.kernel.org>
Cc: Fenghua Yu <fenghua.yu@intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
H Peter Anvin <hpa@zytor.com>, Babu Moger <Babu.Moger@amd.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>,
David Hildenbrand <david@redhat.com>,
Rex Nie <rex.nie@jaguarmicro.com>,
Dave Martin <dave.martin@arm.com>
Subject: Re: [PATCH v4 15/39] x86/resctrl: Move monitor exit work to a resctrl exit call
Date: Tue, 13 Aug 2024 21:01:33 -0700 [thread overview]
Message-ID: <c4807d24-10ea-4baf-8477-4d876deff4c1@intel.com> (raw)
In-Reply-To: <20240802172853.22529-16-james.morse@arm.com>
Hi James,
On 8/2/24 10:28 AM, James Morse wrote:
> rdt_put_mon_l3_config() is called via the architecture's
> resctrl_arch_exit() call, and appears to free the rmid_ptrs[]
> and closid_num_dirty_rmid[] arrays. In reality this code is marked
> __exit, and is removed by the linker as resctrl can't be built
> as a module.
>
> To separate the filesystem and architecture parts of resctrl,
> this free()ing work needs to be triggered by the filesystem,
> as these structures belong to the filesystem code.
>
> Rename rdt_put_mon_l3_config() resctrl_mon_resource_exit()
> and call it from resctrl_exit(). The kfree() is currently
> dependent on r->mon_capable.
>
> Signed-off-by: James Morse <james.morse@arm.com>
> Tested-by: Carl Worth <carl@os.amperecomputing.com> # arm64
> ---
> Changes since v3:
> * Moved r->mon_capable check under the lock.
> * Dropped references to resctrl_mon_resource_init() from the commit message.
> * Fixed more resctrl typos,
>
> Changes since v2:
> * Dropped __exit as needed in the next patch.
Is this still relevant? It is unclear to me why __exit is dropped here.
>
> Change since v1:
> * [Commit message only] Typo fixes:
> s/restrl/resctrl/g
> s/resctl/resctrl/g
>
> * [Commit message only] Reword second paragraph to remove reference to
> the MPAM error interrupt, which provides background rationale for a
> later patch rather than for this patch, and so it is not really
> relevant here.
> ---
> arch/x86/kernel/cpu/resctrl/core.c | 5 -----
> arch/x86/kernel/cpu/resctrl/internal.h | 2 +-
> arch/x86/kernel/cpu/resctrl/monitor.c | 12 +++++++++---
> arch/x86/kernel/cpu/resctrl/rdtgroup.c | 2 ++
> 4 files changed, 12 insertions(+), 9 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
> index 4a0dbdc2da4d..9d4d64b4e357 100644
> --- a/arch/x86/kernel/cpu/resctrl/core.c
> +++ b/arch/x86/kernel/cpu/resctrl/core.c
> @@ -1101,14 +1101,9 @@ late_initcall(resctrl_arch_late_init);
>
> static void __exit resctrl_arch_exit(void)
> {
> - struct rdt_resource *r = &rdt_resources_all[RDT_RESOURCE_L3].r_resctrl;
> -
> cpuhp_remove_state(rdt_online);
>
> resctrl_exit();
> -
> - if (r->mon_capable)
> - rdt_put_mon_l3_config();
> }
>
> __exitcall(resctrl_arch_exit);
> diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h
> index d355aa676158..3fdeca6e3d21 100644
> --- a/arch/x86/kernel/cpu/resctrl/internal.h
> +++ b/arch/x86/kernel/cpu/resctrl/internal.h
> @@ -579,7 +579,7 @@ void closid_free(int closid);
> int alloc_rmid(u32 closid);
> void free_rmid(u32 closid, u32 rmid);
> int rdt_get_mon_l3_config(struct rdt_resource *r);
> -void __exit rdt_put_mon_l3_config(void);
> +void resctrl_mon_resource_exit(void);
> bool __init rdt_cpu_has(int flag);
> void mon_event_count(void *info);
> int rdtgroup_mondata_show(struct seq_file *m, void *arg);
> diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c
> index 9cdca9d2bbde..afbda09aacf5 100644
> --- a/arch/x86/kernel/cpu/resctrl/monitor.c
> +++ b/arch/x86/kernel/cpu/resctrl/monitor.c
> @@ -1044,10 +1044,13 @@ static int dom_data_init(struct rdt_resource *r)
> return err;
> }
>
> -static void __exit dom_data_exit(void)
> +static void dom_data_exit(struct rdt_resource *r)
> {
> mutex_lock(&rdtgroup_mutex);
>
> + if (!r->mon_capable)
> + goto out_unlock;
> +
> if (IS_ENABLED(CONFIG_RESCTRL_RMID_DEPENDS_ON_CLOSID)) {
> kfree(closid_num_dirty_rmid);
> closid_num_dirty_rmid = NULL;
> @@ -1056,6 +1059,7 @@ static void __exit dom_data_exit(void)
> kfree(rmid_ptrs);
> rmid_ptrs = NULL;
>
> +out_unlock:
> mutex_unlock(&rdtgroup_mutex);
> }
>
> @@ -1238,9 +1242,11 @@ int __init rdt_get_mon_l3_config(struct rdt_resource *r)
> return 0;
> }
>
> -void __exit rdt_put_mon_l3_config(void)
> +void resctrl_mon_resource_exit(void)
> {
> - dom_data_exit();
> + struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_L3);
> +
> + dom_data_exit(r);
> }
>
> void __init intel_rdt_mbm_apply_quirk(void)
> diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> index 1597add37b97..576f6b183980 100644
> --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> @@ -4291,4 +4291,6 @@ void __exit resctrl_exit(void)
> debugfs_remove_recursive(debugfs_resctrl);
> unregister_filesystem(&rdt_fs_type);
> sysfs_remove_mount_point(fs_kobj, "resctrl");
> +
> + resctrl_mon_resource_exit();
> }
Reinette
next prev parent reply other threads:[~2024-08-14 4:02 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-02 17:28 [PATCH v4 00/39] x86/resctrl: Move the resctrl filesystem code to /fs/resctrl James Morse
2024-08-02 17:28 ` [PATCH v4 01/39] x86/resctrl: Fix allocation of cleanest CLOSID on platforms with no monitors James Morse
2024-08-02 17:28 ` [PATCH v4 02/39] x86/resctrl: Add a helper to avoid reaching into the arch code resource list James Morse
2024-08-02 17:28 ` [PATCH v4 03/39] x86/resctrl: Remove fflags from struct rdt_resource James Morse
2024-08-14 3:53 ` Reinette Chatre
2024-08-02 17:28 ` [PATCH v4 04/39] x86/resctrl: Use schema type to determine how to parse schema values James Morse
2024-08-14 3:56 ` Reinette Chatre
2024-09-06 18:06 ` James Morse
2024-09-16 22:33 ` Reinette Chatre
2024-09-30 16:42 ` James Morse
2024-08-02 17:28 ` [PATCH v4 05/39] x86/resctrl: Use schema type to determine the schema format string James Morse
2024-08-14 3:57 ` Reinette Chatre
2024-08-02 17:28 ` [PATCH v4 06/39] x86/resctrl: Move data_width to be a schema property James Morse
2024-08-14 3:59 ` Reinette Chatre
2024-09-13 18:07 ` James Morse
2024-08-02 17:28 ` [PATCH v4 07/39] x86/resctrl: Add max_bw to struct resctrl_membw James Morse
2024-08-14 4:00 ` Reinette Chatre
2024-08-02 17:28 ` [PATCH v4 08/39] x86/resctrl: Generate default_ctrl instead of sharing it James Morse
2024-08-14 4:00 ` Reinette Chatre
2024-09-13 18:07 ` James Morse
2024-09-16 22:34 ` Reinette Chatre
2024-08-02 17:28 ` [PATCH v4 09/39] x86/resctrl: Add helper for setting CPU default properties James Morse
2024-08-02 17:28 ` [PATCH v4 10/39] x86/resctrl: Remove rdtgroup from update_cpu_closid_rmid() James Morse
2024-08-02 17:28 ` [PATCH v4 11/39] x86/resctrl: Export resctrl fs's init function James Morse
2024-08-14 4:01 ` Reinette Chatre
2024-08-02 17:28 ` [PATCH v4 12/39] x86/resctrl: Wrap resctrl_arch_find_domain() around rdt_find_domain() James Morse
2024-08-02 17:28 ` [PATCH v4 13/39] x86/resctrl: Move resctrl types to a separate header James Morse
2024-08-02 17:28 ` [PATCH v4 14/39] x86/resctrl: Add a resctrl helper to reset all the resources James Morse
2024-08-02 17:28 ` [PATCH v4 15/39] x86/resctrl: Move monitor exit work to a resctrl exit call James Morse
2024-08-14 4:01 ` Reinette Chatre [this message]
2024-09-30 16:42 ` James Morse
2024-08-02 17:28 ` [PATCH v4 16/39] x86/resctrl: Move monitor init work to a resctrl init call James Morse
2024-08-02 17:28 ` [PATCH v4 17/39] x86/resctrl: Rewrite and move the for_each_*_rdt_resource() walkers James Morse
2024-08-15 6:43 ` Shaopeng Tan (Fujitsu)
2024-09-30 16:42 ` James Morse
2024-08-02 17:28 ` [PATCH v4 18/39] x86/resctrl: Export the is_mbm_*_enabled() helpers to asm/resctrl.h James Morse
2024-08-02 17:28 ` [PATCH v4 19/39] x86/resctrl: Add resctrl_arch_is_evt_configurable() to abstract BMEC James Morse
2024-08-14 4:01 ` Reinette Chatre
2024-08-02 17:28 ` [PATCH v4 20/39] x86/resctrl: Change mon_event_config_{read,write}() to be arch helpers James Morse
2024-08-14 4:02 ` Reinette Chatre
2024-10-02 16:58 ` James Morse
2024-08-02 17:28 ` [PATCH v4 21/39] x86/resctrl: Move mbm_cfg_mask to struct rdt_resource James Morse
2024-08-02 17:28 ` [PATCH v4 22/39] x86/resctrl: Add resctrl_arch_ prefix to pseudo lock functions James Morse
2024-08-02 17:28 ` [PATCH v4 23/39] x86/resctrl: Allow an architecture to disable pseudo lock James Morse
2024-08-14 4:02 ` Reinette Chatre
2024-08-02 17:28 ` [PATCH v4 24/39] x86/resctrl: Make prefetch_disable_bits belong to the arch code James Morse
2024-08-02 17:28 ` [PATCH v4 25/39] x86/resctrl: Make resctrl_arch_pseudo_lock_fn() take a plr James Morse
2024-08-02 17:28 ` [PATCH v4 26/39] x86/resctrl: Move thread_throttle_mode_init() to be managed by resctrl James Morse
2024-08-02 17:28 ` [PATCH v4 27/39] x86/resctrl: Move get_config_index() to a header James Morse
2024-08-02 17:28 ` [PATCH v4 28/39] x86/resctrl: Claim get_{mon,ctrl}_domain_from_cpu() helpers for resctrl James Morse
2024-08-02 17:28 ` [PATCH v4 29/39] x86/resctrl: Describe resctrl's bitmap size assumptions James Morse
2024-08-02 17:28 ` [PATCH v4 30/39] x86/resctrl: Rename resctrl_sched_in() to begin with "resctrl_arch_" James Morse
2024-08-02 17:28 ` [PATCH v4 31/39] x86/resctrl: resctrl_exit() teardown resctrl but leave the mount point James Morse
2024-08-02 17:28 ` [PATCH v4 32/39] x86/resctrl: Drop __init/__exit on assorted symbols James Morse
2024-08-02 17:28 ` [PATCH v4 33/39] x86/resctrl: Move is_mba_sc() out of core.c James Morse
2024-08-02 17:28 ` [PATCH v4 34/39] x86/resctrl: Add end-marker to the resctrl_event_id enum James Morse
2024-08-02 17:28 ` [PATCH v4 35/39] x86/resctrl: Remove a newline to avoid confusing the code move script James Morse
2024-08-02 17:28 ` [PATCH v4 36/39] x86/resctrl: Split trace.h James Morse
2024-08-02 17:28 ` [PATCH v4 37/39] fs/resctrl: Add boiler plate for external resctrl code James Morse
2024-08-14 4:04 ` Reinette Chatre
2024-08-02 17:28 ` [PATCH v4 38/39] x86/resctrl: Move the filesystem bits to headers visible to fs/resctrl James Morse
2024-08-02 17:28 ` [PATCH v4 39/39] x86/resctrl: Add python script to move resctrl code to /fs/resctrl James Morse
2024-08-06 7:13 ` [PATCH v4 00/39] x86/resctrl: Move the resctrl filesystem " Shaopeng Tan (Fujitsu)
2024-08-15 7:04 ` Shaopeng Tan (Fujitsu)
2024-10-02 16:58 ` 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=c4807d24-10ea-4baf-8477-4d876deff4c1@intel.com \
--to=reinette.chatre@intel.com \
--cc=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=dave.martin@arm.com \
--cc=david@redhat.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=rex.nie@jaguarmicro.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