All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: "Joel Fernandes (Google)" <joel@joelfernandes.org>
Cc: Nishanth Aravamudan <naravamudan@digitalocean.com>,
	Julien Desfossez <jdesfossez@digitalocean.com>,
	Tim Chen <tim.c.chen@linux.intel.com>,
	Vineeth Pillai <viremana@linux.microsoft.com>,
	Aaron Lu <aaron.lwe@gmail.com>,
	Aubrey Li <aubrey.intel@gmail.com>,
	tglx@linutronix.de, linux-kernel@vger.kernel.org,
	mingo@kernel.org, torvalds@linux-foundation.org,
	fweisbec@gmail.com, keescook@chromium.org,
	Phil Auld <pauld@redhat.com>,
	Valentin Schneider <valentin.schneider@arm.com>,
	Mel Gorman <mgorman@techsingularity.net>,
	Pawan Gupta <pawan.kumar.gupta@linux.intel.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	vineeth@bitbyteword.org, Chen Yu <yu.c.chen@intel.com>,
	Christian Brauner <christian.brauner@ubuntu.com>,
	Agata Gruza <agata.gruza@intel.com>,
	Antonio Gomez Iglesias <antonio.gomez.iglesias@intel.com>,
	graf@amazon.com, konrad.wilk@oracle.com, dfaggioli@suse.com,
	rostedt@goodmis.org, benbjiang@tencent.com,
	Alexandre Chartre <alexandre.chartre@oracle.com>,
	James.Bottomley@hansenpartnership.com, OWeisse@umich.edu,
	Dhaval Giani <dhaval.giani@oracle.com>,
	chris.hyser@oracle.com, Josh Don <joshdon@google.com>,
	Hao Luo <haoluo@google.com>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	dhiatt@digitalocean.com, Tejun Heo <tj@kernel.org>
Subject: Re: [PATCH resend 5/8] sched: cgroup cookie API for core scheduling
Date: Tue, 30 Mar 2021 11:26:46 +0200	[thread overview]
Message-ID: <YGLu1swpZPq4nhJk@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <YGLt/ltwa92lfCDK@hirez.programming.kicks-ass.net>


*sigh*, +tj

On Tue, Mar 30, 2021 at 11:23:10AM +0200, Peter Zijlstra wrote:
> On Wed, Mar 24, 2021 at 05:40:17PM -0400, Joel Fernandes (Google) wrote:
> > From: Josh Don <joshdon@google.com>
> > 
> > This adds the API to set/get the cookie for a given cgroup. This
> > interface lives at cgroup/cpu.core_tag.
> > 
> > The cgroup interface can be used to toggle a unique cookie value for all
> > descendent tasks, preventing these tasks from sharing with any others.
> > See Documentation/admin-guide/hw-vuln/core-scheduling.rst for a full
> > rundown of both this and the per-task API.
> 
> I refuse to read RST. Life's too short for that.
> 
> > +u64 cpu_core_tag_read_u64(struct cgroup_subsys_state *css,
> > +			  struct cftype *cft)
> > +{
> > +	return !!css_tg(css)->core_tagged;
> > +}
> > +
> > +int cpu_core_tag_write_u64(struct cgroup_subsys_state *css, struct cftype *cft,
> > +			   u64 val)
> > +{
> > +	static DEFINE_MUTEX(sched_core_group_mutex);
> > +	struct task_group *tg = css_tg(css);
> > +	struct cgroup_subsys_state *css_tmp;
> > +	struct task_struct *p;
> > +	unsigned long group_cookie;
> > +	int ret = 0;
> > +
> > +	if (val > 1)
> > +		return -ERANGE;
> > +
> > +	if (!static_branch_likely(&sched_smt_present))
> > +		return -EINVAL;
> > +
> > +	mutex_lock(&sched_core_group_mutex);
> > +
> > +	if (!tg->core_tagged && val) {
> > +		/* Tag is being set. Check ancestors and descendants. */
> > +		if (cpu_core_get_group_cookie(tg) ||
> > +		    cpu_core_check_descendants(tg, true /* tag */)) {
> > +			ret = -EBUSY;
> > +			goto out_unlock;
> > +		}
> 
> So the desired semantics is to only allow a single tag on any upwards
> path? Isn't that in conflict with the cgroup requirements?
> 
> TJ?
> 
> > +	} else if (tg->core_tagged && !val) {
> > +		/* Tag is being reset. Check descendants. */
> > +		if (cpu_core_check_descendants(tg, true /* tag */)) {
> 
> I'm struggling to understand this. If, per the above, you cannot set
> when either a parent is already set or a child is set, then how can a
> child be set to refuse clearing?
> 
> > +			ret = -EBUSY;
> > +			goto out_unlock;
> > +		}
> > +	} else {
> > +		goto out_unlock;
> > +	}
> 
> 

  reply	other threads:[~2021-03-30  9:31 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-24 21:40 [PATCH resend 0/8] Core sched remaining patches rebased Joel Fernandes (Google)
2021-03-24 21:40 ` [PATCH resend 1/8] sched: migration changes for core scheduling Joel Fernandes (Google)
2021-03-24 21:40 ` [PATCH resend 2/8] sched: core scheduling tagging infrastructure Joel Fernandes (Google)
2021-03-27  0:09   ` Peter Zijlstra
2021-03-27  3:19     ` Josh Don
2021-03-29  9:55       ` Peter Zijlstra
2021-03-30 21:29         ` Josh Don
2021-03-31  7:11           ` Peter Zijlstra
2021-04-01 13:46             ` Peter Zijlstra
2021-03-24 21:40 ` [PATCH resend 3/8] sched: prctl() cookie manipulation for core scheduling Joel Fernandes (Google)
2021-03-24 21:40 ` [PATCH resend 4/8] kselftest: Add test for core sched prctl interface Joel Fernandes (Google)
2021-03-24 21:40 ` [PATCH resend 5/8] sched: cgroup cookie API for core scheduling Joel Fernandes (Google)
2021-03-30  9:23   ` Peter Zijlstra
2021-03-30  9:26     ` Peter Zijlstra [this message]
2021-03-30 21:19       ` Josh Don
2021-03-24 21:40 ` [PATCH resend 6/8] kselftest: Add tests for core-sched interface Joel Fernandes (Google)
2021-03-24 21:40 ` [PATCH resend 7/8] Documentation: Add core scheduling documentation Joel Fernandes (Google)
2021-03-24 21:40 ` [PATCH resend 8/8] sched: Debug bits Joel Fernandes (Google)

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=YGLu1swpZPq4nhJk@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=OWeisse@umich.edu \
    --cc=aaron.lwe@gmail.com \
    --cc=agata.gruza@intel.com \
    --cc=alexandre.chartre@oracle.com \
    --cc=antonio.gomez.iglesias@intel.com \
    --cc=aubrey.intel@gmail.com \
    --cc=benbjiang@tencent.com \
    --cc=chris.hyser@oracle.com \
    --cc=christian.brauner@ubuntu.com \
    --cc=dfaggioli@suse.com \
    --cc=dhaval.giani@oracle.com \
    --cc=dhiatt@digitalocean.com \
    --cc=fweisbec@gmail.com \
    --cc=graf@amazon.com \
    --cc=haoluo@google.com \
    --cc=jdesfossez@digitalocean.com \
    --cc=joel@joelfernandes.org \
    --cc=joshdon@google.com \
    --cc=keescook@chromium.org \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@techsingularity.net \
    --cc=mingo@kernel.org \
    --cc=naravamudan@digitalocean.com \
    --cc=pauld@redhat.com \
    --cc=pawan.kumar.gupta@linux.intel.com \
    --cc=pbonzini@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=thomas.lendacky@amd.com \
    --cc=tim.c.chen@linux.intel.com \
    --cc=tj@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=valentin.schneider@arm.com \
    --cc=vineeth@bitbyteword.org \
    --cc=viremana@linux.microsoft.com \
    --cc=yu.c.chen@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.