From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933774AbcJZSAB (ORCPT ); Wed, 26 Oct 2016 14:00:01 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:41196 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752263AbcJZR76 (ORCPT ); Wed, 26 Oct 2016 13:59:58 -0400 Date: Wed, 26 Oct 2016 19:57:11 +0200 (CEST) From: Thomas Gleixner To: Fenghua Yu cc: "H. Peter Anvin" , Ingo Molnar , Tony Luck , Peter Zijlstra , Stephane Eranian , Borislav Petkov , Dave Hansen , Nilay Vaish , Shaohua Li , David Carrillo-Cisneros , Ravi V Shankar , Sai Prakhya , Vikas Shivappa , linux-kernel , x86 Subject: Re: [PATCH v5 14/18] x86/intel_rdt: Add cpus file In-Reply-To: <1477142405-32078-15-git-send-email-fenghua.yu@intel.com> Message-ID: References: <1477142405-32078-1-git-send-email-fenghua.yu@intel.com> <1477142405-32078-15-git-send-email-fenghua.yu@intel.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 22 Oct 2016, Fenghua Yu wrote: > @@ -323,8 +325,11 @@ static int intel_rdt_online_cpu(unsigned int cpu) > struct rdt_resource *r; > > mutex_lock(&rdtgroup_mutex); > + per_cpu(cpu_closid, cpu) = 0; > for_each_capable_rdt_resource(r) > domain_add_cpu(cpu, r); > + /* The cpu is set in default rdtgroup after online. */ > + cpumask_set_cpu(cpu, &rdtgroup_default.cpu_mask); > state->closid = 0; > wrmsr(MSR_IA32_PQR_ASSOC, state->rmid, 0); > mutex_unlock(&rdtgroup_mutex); > @@ -334,11 +339,16 @@ static int intel_rdt_online_cpu(unsigned int cpu) > > static int intel_rdt_offline_cpu(unsigned int cpu) > { > + struct rdtgroup *rdtgrp; > struct rdt_resource *r; > > mutex_lock(&rdtgroup_mutex); > for_each_capable_rdt_resource(r) > domain_remove_cpu(cpu, r); > + list_for_each_entry(rdtgrp, &rdt_all_groups, rdtgroup_list) { > + if (cpumask_test_and_clear_cpu(cpu, &rdtgrp->cpu_mask)) > + break; > + } I think we should set cpu_closid to 0 here and cleanup the per cpu state / MSR as well. Thanks, tglx