Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp4583647pxt; Wed, 11 Aug 2021 09:11:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwD3TQ8RqeQls0IZVY94wW/VRx+pRfdZlTxhpzYYYZPGcuCNPwL1i0nElrwOJ0s1obtRO5u X-Received: by 2002:a02:7348:: with SMTP id a8mr32785320jae.116.1628698312014; Wed, 11 Aug 2021 09:11:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628698312; cv=none; d=google.com; s=arc-20160816; b=JwUevW/erAy0KtQwEV48/gr8yqyeZKj+ZK1OCGoiopyl+h1m0luwlc3eNHlXh9usyP zFd+7OgerNSW3Kfm3uWyGuCr8H9p06KisHsfYxVyH3OdkB+bLLUER3+t1W54w9HtVfxs SphAk8hBB/Op8sKRmRmZpr3Ympc2JR/29n5XoplrlnWI+ucKEcJpvbKAOixPwbAizb68 D8CZp7yQMH95uOqfyJSxYUCF6oJllnG6ABeUMim1IdsUhIyK0c3CjCjYNDVop/NZNoWL LsM7AlUnbq5sEGUzBdqu2wUmuuxLcsbzoQIByEfUjrhltlDLouLGpQkdS6dNrim/Oo7G 7PyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Wny9vyhe7x9w1XyyXnqMYIBIFak+X9iPgGD7ibd1xHI=; b=i7TMoX5EpdEyy66b3vux0+vSic/spPGHBTGVFK6fH8i2jnW4jMuZFRmSQ3Jc4e4SvQ obKv9WCpQggXTh3i+pAKbZ+7Vz5h2kJSwThcc2M1cMV0Zyzq7QDsKmTaGb2DwQOrxMxQ hYsxFGQLw4FCjtVpjGcoIwS+Kq6/rBw7aValpcKsXO5lsbRop0LC8SzS2dqJLZatyF6J sU7T/8lEOzRJgg6LasQNrztVzyis7lfQqbMKYzrd8YHo6PfjZaVVA/Lqe6DFL3yOabkk 1a4on/PMGVIJsJunx4/AKDFkP8ogbCwFYuOOPoonNx1zWsEeY7QXFfaCCs1p+v4jZ7O6 s/VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=hQlBIBS5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j10si29644107ils.18.2021.08.11.09.11.35; Wed, 11 Aug 2021 09:11:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=hQlBIBS5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229589AbhHKQLI (ORCPT + 99 others); Wed, 11 Aug 2021 12:11:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229571AbhHKQLG (ORCPT ); Wed, 11 Aug 2021 12:11:06 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02CB8C061765 for ; Wed, 11 Aug 2021 09:10:43 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 203-20020a1c00d40000b02902e6a4e244e4so2365121wma.4 for ; Wed, 11 Aug 2021 09:10:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Wny9vyhe7x9w1XyyXnqMYIBIFak+X9iPgGD7ibd1xHI=; b=hQlBIBS5XXJxLYFxtmr0+EFj0Kdl8fP8sLheKRFbhlyJithKgMxkS9x3/wlgDODdAI 9H56yqCc8SK0zAs7mVIjwLi44P+o/lLwgcHLgzumzrnf1MhlzPzt4ygOSpurrO15f6Xc JY2pP7LPY/xP3oOoJiOhdhMQ47tVn83fn4ELN6m9FVJVYfKATOS6sRYF4ZtwgRZ9qvEp uZ2QBXZn7EGLIPFp3i1jn1ZGSAv5Q1Zq+HlxWzmREJ0mrV36DxlZeYbbInd+g/bUXCYp z7yI5TrQl92Jdc4adoaMH5v/RuU/9sCdMqlFKoBOV5jD4UN5TO9vPfiP3FahuJgr1QOy iUiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Wny9vyhe7x9w1XyyXnqMYIBIFak+X9iPgGD7ibd1xHI=; b=hRefLDDrUCMpmV9w6hNG6cptCVaXqKy4ULazS/8q9AjKp27+oCAOjZXjHmq9yiyKfB 5L6pPEnXEQs06RHkZrFbtBqRnL++AzvGoLzaEdMlvG7AOLb287QO/1jHfNpV3pRUXS5F CYJrizM6bPiSnZ9tl+pLcafSl3MSbkmMY/g+dmjxPCnsilbmEKmBOACEprLAtn5K50sA 80HGwPIkscPHSw5JsbuMM5c93yT6CA6ZQ1hT9sP+74F3H/ZJUOKXY5xk7jQ/K7UpIbaV oXy8UhdZE92afnv5hJDRGyMJU81miMp1eU+csAXjhESSEb4KLB3C2NtcjvoJ7P/McRHk HX7A== X-Gm-Message-State: AOAM533NmyoLIiLolwV3OsKXfL8hLdCQx1YlMeV7vw5vJYVFKLMlISjS MG78RT9YBosa9/LInjZ0S91Lfw== X-Received: by 2002:a7b:c958:: with SMTP id i24mr9495111wml.42.1628698241505; Wed, 11 Aug 2021 09:10:41 -0700 (PDT) Received: from localhost ([82.44.17.50]) by smtp.gmail.com with ESMTPSA id x9sm6734498wmj.41.2021.08.11.09.10.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Aug 2021 09:10:40 -0700 (PDT) Date: Wed, 11 Aug 2021 17:10:39 +0100 From: Jamie Iles To: James Morse Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Fenghua Yu , Reinette Chatre , Thomas Gleixner , Ingo Molnar , Borislav Petkov , H Peter Anvin , Babu Moger , shameerali.kolothum.thodi@huawei.com, Jamie Iles , D Scott Phillips OS , lcherian@marvell.com, bobo.shaobowang@huawei.com Subject: Re: [PATCH v1 04/20] x86/resctrl: Add domain offline callback for resctrl work Message-ID: References: <20210729223610.29373-1-james.morse@arm.com> <20210729223610.29373-5-james.morse@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210729223610.29373-5-james.morse@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi James, On Thu, Jul 29, 2021 at 10:35:54PM +0000, James Morse wrote: > Because domains are exposed to user-space via resctrl, the filesystem > must update its state when cpu hotplug callbacks are triggered. > > Some of this work is common to any architecture that would support > resctrl, but the work is tied up with the architecture code to > free the memory. > > Move the monitor subdir removal and the cancelling of the mbm/limbo > works into a new resctrl_offline_domain() call. > > Signed-off-by: James Morse > --- > arch/x86/kernel/cpu/resctrl/core.c | 24 +--------------- > arch/x86/kernel/cpu/resctrl/internal.h | 2 -- > arch/x86/kernel/cpu/resctrl/rdtgroup.c | 39 +++++++++++++++++++++++--- > include/linux/resctrl.h | 1 + > 4 files changed, 37 insertions(+), 29 deletions(-) ... > diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c > index e1af1d81b924..cf0db0b7a5d0 100644 > --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c > +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c ... > @@ -3229,6 +3227,39 @@ static int __init rdtgroup_setup_root(void) > return ret; > } > > +void resctrl_offline_domain(struct rdt_resource *r, struct rdt_domain *d) > +{ > + lockdep_assert_held(&rdtgroup_mutex); // the arch code took this for us > + > + if (!r->mon_capable) > + return; > + > + /* > + * If resctrl is mounted, remove all the > + * per domain monitor data directories. > + */ > + if (static_branch_unlikely(&rdt_mon_enable_key)) > + rmdir_mondata_subdir_allrdtgrp(r, d->id); > + > + if (r->mon_capable && is_mbm_enabled()) > + cancel_delayed_work(&d->mbm_over); There's a redundant r->mon_capable check here. > + if (is_llc_occupancy_enabled() && has_busy_rmid(r, d)) { > + /* > + * When a package is going down, forcefully > + * decrement rmid->ebusy. There is no way to know > + * that the L3 was flushed and hence may lead to > + * incorrect counts in rare scenarios, but leaving > + * the RMID as busy creates RMID leaks if the > + * package never comes back. > + */ > + __check_limbo(d, true); > + cancel_delayed_work(&d->cqm_limbo); > + } > + bitmap_free(d->rmid_busy_llc); > + kfree(d->mbm_total); > + kfree(d->mbm_local); > +} Thanks, Jamie