public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Reinette Chatre <reinette.chatre@intel.com>
To: Tony Luck <tony.luck@intel.com>,
	Fenghua Yu <fenghua.yu@intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Shaopeng Tan <tan.shaopeng@fujitsu.com>,
	Jamie Iles <quic_jiles@quicinc.com>,
	James Morse <james.morse@arm.com>,
	"Babu Moger" <babu.moger@amd.com>
Cc: <x86@kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH 3/7] x86/resctrl: Add driver callback when directories are removed
Date: Fri, 5 May 2023 16:19:29 -0700	[thread overview]
Message-ID: <54538ac1-c700-bd0b-2a1d-bcbe84067a0c@intel.com> (raw)
In-Reply-To: <20230420220636.53527-4-tony.luck@intel.com>

Hi Tony,

On 4/20/2023 3:06 PM, Tony Luck wrote:
> When a resctrl directory is removed, entities attached to that
> directory are reassigned with the CLOSID and RMID of the parent
> directory.

Could you please elaborate what you mean with "entities"? In
resctrl there are tasks needing to move but that is done in resctrl.
Would drivers be doing any manipulation of the tasks' closid/rmid?

> 
> Add a callback function so a driver can reset the CLOSID and RMID
> of any resources attached to the removed directory.

I expect this behavior to be different between the removal of
a monitoring group vs a control group (more later) ...


> @@ -3495,11 +3495,18 @@ static int rdtgroup_mkdir(struct kernfs_node *parent_kn, const char *name,
>  static int rdtgroup_rmdir_mon(struct rdtgroup *rdtgrp, cpumask_var_t tmpmask)
>  {
>  	struct rdtgroup *prdtgrp = rdtgrp->mon.parent;
> +	struct resctrl_driver *d;
>  	int cpu;
>  
>  	/* Give any tasks back to the parent group */
>  	rdt_move_group_tasks(rdtgrp, prdtgrp, tmpmask);
>  
> +	list_for_each_entry(d, &drivers, list) {
> +		if (d->rmdir)
> +			d->rmdir(rdtgrp->closid, rdtgrp->mon.rmid,
> +				 prdtgrp->closid, prdtgrp->mon.rmid);
> +	}
> +

This seems tricky ... if I understand correctly the API provides
limited properties directly to driver to keep things safe but at the
same time the properties need to accommodate all driver usages. All drivers
would need an update if something new is needed.

For example, this seems to ignore whether a resource group is exclusive
or not - could group removal trigger behavior that can circumvent this
restriction?

>  	/* Update per cpu rmid of the moved CPUs first */
>  	for_each_cpu(cpu, &rdtgrp->cpu_mask)
>  		per_cpu(pqr_state.default_rmid, cpu) = prdtgrp->mon.rmid;
> @@ -3535,6 +3542,7 @@ static int rdtgroup_ctrl_remove(struct rdtgroup *rdtgrp)
>  
>  static int rdtgroup_rmdir_ctrl(struct rdtgroup *rdtgrp, cpumask_var_t tmpmask)
>  {
> +	struct resctrl_driver *d;
>  	int cpu;
>  
>  	/* Give any tasks back to the default group */
> @@ -3544,6 +3552,11 @@ static int rdtgroup_rmdir_ctrl(struct rdtgroup *rdtgrp, cpumask_var_t tmpmask)
>  	cpumask_or(&rdtgroup_default.cpu_mask,
>  		   &rdtgroup_default.cpu_mask, &rdtgrp->cpu_mask);
>  
> +	list_for_each_entry(d, &drivers, list) {
> +		if (d->rmdir)
> +			d->rmdir(rdtgrp->closid, rdtgrp->mon.rmid, 0, 0);
> +	}
> +
>  	/* Update per cpu closid and rmid of the moved CPUs first */
>  	for_each_cpu(cpu, &rdtgrp->cpu_mask) {
>  		per_cpu(pqr_state.default_closid, cpu) = rdtgroup_default.closid;

... is the expectation that the driver would look at the latter parameters to
determine if a monitor or control group is removed? I think that may be troublesome
since API like this relies on driver needing to have a lot of insight into
internal implementation choices of resctrl (which could potentially change?).
If I understand correctly the driver makes assumptions like: (a) default control group
always is assigned closid 0 and rmid 0 and (b) default control group is never removed.
I think that it should not be required for drivers to have knowledge like this
(and then also risk that these assumptions may change).

Reinette

  reply	other threads:[~2023-05-05 23:19 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-20 22:06 [RFC PATCH 0/7] Add driver registration i/f to resctrl Tony Luck
2023-04-20 22:06 ` [RFC PATCH 1/7] x86/resctrl: Add register/unregister functions for driver to hook into resctrl Tony Luck
2023-05-05 23:17   ` Reinette Chatre
2023-04-20 22:06 ` [RFC PATCH 2/7] x86/resctrl: Add an interface to add/remove a new info/directory Tony Luck
2023-04-20 22:06 ` [RFC PATCH 3/7] x86/resctrl: Add driver callback when directories are removed Tony Luck
2023-05-05 23:19   ` Reinette Chatre [this message]
2023-04-20 22:06 ` [RFC PATCH 4/7] x86/resctrl: Add capability to driver registration to create control files Tony Luck
2023-05-05 23:20   ` Reinette Chatre
2023-04-20 22:06 ` [RFC PATCH 5/7] x86/resctrl: Enhance driver registration to hook into schemata files Tony Luck
2023-05-05 23:20   ` Reinette Chatre
2023-04-20 22:06 ` [RFC PATCH 6/7] x86/resctrl: Allow a device to override an existing schemata entry Tony Luck
2023-05-05 23:20   ` Reinette Chatre
2023-04-20 22:06 ` [RFC PATCH 7/7] x86/resctrl: Example resctrl driver Tony Luck
2023-05-05 23:17 ` [RFC PATCH 0/7] Add driver registration i/f to resctrl Reinette Chatre
2023-05-08 18:32   ` Luck, Tony
2023-05-09 21:34     ` Reinette Chatre
2023-05-09 23:35       ` Luck, Tony
2023-05-10  0:07         ` Reinette Chatre
2023-05-10  0:52           ` Luck, Tony
2023-05-11 20:35         ` Luck, Tony
2023-05-12 16:57           ` Reinette Chatre
2023-05-12 20:35             ` Luck, Tony
2023-05-12 21:08               ` 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=54538ac1-c700-bd0b-2a1d-bcbe84067a0c@intel.com \
    --to=reinette.chatre@intel.com \
    --cc=babu.moger@amd.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.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=quic_jiles@quicinc.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