[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1609082212440.5454@nanos>
Date: Thu, 8 Sep 2016 22:25:06 +0200 (CEST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Fenghua Yu <fenghua.yu@...el.com>
cc: "H. Peter Anvin" <h.peter.anvin@...el.com>,
Ingo Molnar <mingo@...e.hu>, Tony Luck <tony.luck@...el.com>,
Peter Zijlstra <peterz@...radead.org>,
Tejun Heo <tj@...nel.org>, Borislav Petkov <bp@...e.de>,
Stephane Eranian <eranian@...gle.com>,
Marcelo Tosatti <mtosatti@...hat.com>,
David Carrillo-Cisneros <davidcc@...gle.com>,
Shaohua Li <shli@...com>,
Ravi V Shankar <ravi.v.shankar@...el.com>,
Vikas Shivappa <vikas.shivappa@...ux.intel.com>,
Sai Prakhya <sai.praneeth.prakhya@...el.com>,
linux-kernel <linux-kernel@...r.kernel.org>, x86 <x86@...nel.org>
Subject: Re: [PATCH v2 28/33] x86/intel_rdt_rdtgroup.c: Read and write cpus
On Thu, 8 Sep 2016, Fenghua Yu wrote:
> Normally each task is associated with one rdtgroup and we use the schema
> for that rdtgroup whenever the task is running. The user can designate
> some cpus to always use the same schema, regardless of which task is
> running. To do that the user write a cpumask bit string to the "cpus"
> file.
Is that just a left over of the previous series or am I completely confused
by now?
> +static int cpus_validate(struct cpumask *cpumask, struct rdtgroup *rdtgrp)
> +{
> + int old_cpumask_bit, new_cpumask_bit;
> + int cpu;
> +
> + for_each_online_cpu(cpu) {
> + old_cpumask_bit = cpumask_test_cpu(cpu, &rdtgrp->cpu_mask);
> + new_cpumask_bit = cpumask_test_cpu(cpu, cpumask);
> + /* Cannot clear a "cpus" bit in a rdtgroup. */
> + if (old_cpumask_bit == 1 && new_cpumask_bit == 0)
> + return -EINVAL;
> + }
> +
> + /* If a cpu is not online, cannot set it. */
> + for_each_cpu(cpu, cpumask) {
> + if (!cpu_online(cpu))
> + return -EINVAL;
> + }
cpumask_intersects() exists for a reason. And how is this protected against
cpu hotplug?
> + list_for_each(l, &rdtgroup_lists) {
> + r = list_entry(l, struct rdtgroup, rdtgroup_list);
> + if (r == rdtgrp)
> + continue;
> +
> + for_each_cpu_and(cpu, &r->cpu_mask, cpumask)
> + cpumask_clear_cpu(cpu, &r->cpu_mask);
This code clearly predates the invention of cpumask_andnot()
Thanks,
tglx
Powered by blists - more mailing lists