From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756432AbdAIV5N (ORCPT ); Mon, 9 Jan 2017 16:57:13 -0500 Received: from mga14.intel.com ([192.55.52.115]:58768 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751331AbdAIV5L (ORCPT ); Mon, 9 Jan 2017 16:57:11 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,341,1477983600"; d="scan'208";a="51318604" Date: Mon, 9 Jan 2017 13:56:00 -0800 From: Fenghua Yu To: Shaohua Li Cc: linux-kernel@vger.kernel.org, Fenghua Yu , Thomas Gleixner Subject: Re: [PATCH] x86/intel_rdt: reinitialize cbm for new group allocation Message-ID: <20170109215558.GA7138@linux.intel.com> References: <91a513378542f2d81e39baf954d8f8c447fd1943.1483747472.git.shli@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <91a513378542f2d81e39baf954d8f8c447fd1943.1483747472.git.shli@fb.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 06, 2017 at 04:05:19PM -0800, Shaohua Li wrote: > rdtgroup_rmdir deletes a group and frees the closid, but doesn't > reiniaialize domain's cbm to default for the closid. Next time the > closid is allocated again, 'schemata' will show old cbm. We can do the > reinitialization at free/alloc closid, but sounds doing it at alloc is > more nartual. > > Cc: Fenghua Yu > Cc: Thomas Gleixner > Signed-off-by: Shaohua Li > --- > arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c > index 8af04af..7e81527 100644 > --- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c > +++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c > @@ -78,12 +78,21 @@ static void closid_init(void) > int closid_alloc(void) > { > int closid = ffs(closid_free_map); > + struct rdt_resource *r; > + struct rdt_domain *dom; > > if (closid == 0) > return -ENOSPC; > closid--; > closid_free_map &= ~(1 << closid); > > + for_each_enabled_rdt_resource(r) { > + if (closid >= r->num_closid) > + continue; > + list_for_each_entry(dom, &r->domains, list) > + dom->cbm[closid] = r->max_cbm; > + } > + This only changes the date stored in kernel software. But The cbm MSR registers are not updated by the max_cbm. You need to call rdt_cbm_update to update registers. > return closid; > } > > -- > 2.9.3 > I actually had a patch to fix this before but didn't send it out. I thought this won't impact any functionality other than user may see some unexpected schemata values, but user will always change schemata anyway following mkdir. But since you come here now, I would think reseting the CBM in closid_free() is better. The reason is user can see "right" max_cbm even through rdmsr after rmdir, ie no gap for cbm values between rmdir and the next mkdir. Thanks. -Fenghua