linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Fenghua Yu" <fenghua.yu@intel.com>
To: "Thomas Gleixner" <tglx@linutronix.de>
Cc: "H. Peter Anvin" <h.peter.anvin@intel.com>,
	"Ingo Molnar" <mingo@elte.hu>, "Tony Luck" <tony.luck@intel.com>,
	"Ravi V Shankar" <ravi.v.shankar@intel.com>,
	"Sai Prakhya" <sai.praneeth.prakhya@intel.com>,
	"Vikas Shivappa" <vikas.shivappa@linux.intel.com>,
	"linux-kernel" <linux-kernel@vger.kernel.org>,
	"x86" <x86@kernel.org>, "Fenghua Yu" <fenghua.yu@intel.com>
Subject: [PATCH 2/3] x86/intel_rdt: Return state to default on umount
Date: Fri, 11 Nov 2016 17:02:37 -0800	[thread overview]
Message-ID: <1478912558-55514-2-git-send-email-fenghua.yu@intel.com> (raw)
In-Reply-To: <1478912558-55514-1-git-send-email-fenghua.yu@intel.com>

From: Fenghua Yu <fenghua.yu@intel.com>

All CPUs in a rdtgroup are given back to the default rdtgroup
before the rdtgroup is removed during umount. After umount,
the default rdtgroup contains all online CPUs.

cpu_closid needs to be cleared for each cpu in root rdtgroup
during umount. Otherwise, PQR_ASSOC will be written to the
non-zero value stored in cpu_closid after next mount.

Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
---
 arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
index cff286e..416b95e 100644
--- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
+++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
@@ -801,6 +801,7 @@ static void rmdir_all_sub(void)
 {
 	struct rdtgroup *rdtgrp, *tmp;
 	struct task_struct *p, *t;
+	int cpu;
 
 	/* move all tasks to default resource group */
 	read_lock(&tasklist_lock);
@@ -819,10 +820,19 @@ static void rmdir_all_sub(void)
 		/* Remove each rdtgroup other than root */
 		if (rdtgrp == &rdtgroup_default)
 			continue;
+
+		/* Give any CPUs back to the default group */
+		cpumask_or(&rdtgroup_default.cpu_mask,
+			   &rdtgroup_default.cpu_mask, &rdtgrp->cpu_mask);
+
 		kernfs_remove(rdtgrp->kn);
 		list_del(&rdtgrp->rdtgroup_list);
 		kfree(rdtgrp);
 	}
+
+	for_each_cpu(cpu, &rdtgroup_default.cpu_mask)
+		per_cpu(cpu_closid, cpu) = 0;
+
 	kernfs_remove(kn_info);
 }
 
-- 
2.5.0

  reply	other threads:[~2016-11-12  1:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-12  1:02 [PATCH 1/3] x86/intel_rdt: Fix kernfs_to_rdtgroup to know about "info/*" directories Fenghua Yu
2016-11-12  1:02 ` Fenghua Yu [this message]
2016-11-15 13:35   ` [PATCH 2/3] x86/intel_rdt: Return state to default on umount Thomas Gleixner
2016-11-15 17:28     ` Thomas Gleixner
2016-11-15 17:44   ` [tip:x86/cache] x86/intel_rdt: Reset per cpu closids on unmount tip-bot for Fenghua Yu
2016-11-12  1:02 ` [PATCH 3/3] x86/intel_rdt: Update closid in PQR_ASSOC registers in synchronous mode when changing "cpus" Fenghua Yu
2016-11-15 13:43   ` Thomas Gleixner
2016-11-15 14:00   ` Thomas Gleixner
2016-11-15 16:40     ` Thomas Gleixner
2016-11-15 17:44   ` [tip:x86/cache] x86/intel_rdt: Update percpu closid immeditately on CPUs affected by changee tip-bot for Fenghua Yu
2016-11-15 17:42 ` [tip:x86/cache] x86/intel_rdt: Protect info directory from removal tip-bot for Fenghua Yu

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=1478912558-55514-2-git-send-email-fenghua.yu@intel.com \
    --to=fenghua.yu@intel.com \
    --cc=h.peter.anvin@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=ravi.v.shankar@intel.com \
    --cc=sai.praneeth.prakhya@intel.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=vikas.shivappa@linux.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;
as well as URLs for NNTP newsgroup(s).