Received: by 2002:a05:7208:3003:b0:81:def:69cd with SMTP id f3csp829980rba; Wed, 27 Mar 2024 13:06:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV3YAMqTM9w6hb0e3YEQaBOHLTjLiZQq/+Ly1Pn6gzetouGiwTSJu8YLfzXSMvBelzfshesQiu/m2cIgqZD9BaSi3hr+VIQNH40rs2WXQ== X-Google-Smtp-Source: AGHT+IGgDpQbHp2d4p96SrNhBXika8KNFuHvqjtgUon18A/VqsMlGHZmSu4jQNB6tAGxR85mjxas X-Received: by 2002:ac8:584f:0:b0:431:61f9:a38b with SMTP id h15-20020ac8584f000000b0043161f9a38bmr525961qth.33.1711570009426; Wed, 27 Mar 2024 13:06:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711570009; cv=pass; d=google.com; s=arc-20160816; b=wIe07VqQNvbi0SK0nriNXEnshO6wLB8p4ImbPVgqv4QMttrtHPCh3JOOGixkJLnSc0 D0baJPWPtHmHBJmnzCPiGHEe9gURu3/IxiXnJNVC4jBhgatuqv7PvXFPZUjaSQDAvpvY Mla+BCm/n8B5Reef3/sxZW2c3RFVwlfTFXefaqZnJUgtPYSJoTe4easVutwD3y9Wb2sm YfahETrROXJz2pQBWcYrbira9mDKxzKwKE7NXU/tZbttC/8N998YqIT+aKXpn6zf55kP S9adlJdCdJgYNR3xO9PuDL+YkS1lGQiR3dWDTGosDFR2BEOjtU2KZ1hqew4uqijHZzqS D70A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=eZ3SzpGJoWHZl28z0jPf71HSfKzPM0WhY4fyYdcy5XY=; fh=H9/+fk2Ete/Gzpx6dba0TKFidU7mNxuKLM/h3KEx+fQ=; b=HTVcyIU6LbfGvy+11h33QG7V7zJSY2RIfPllu4WIDrKpd1Anw+g4kelKwsD4Mbqgdd 0bikDMuKPxl1gSGq+v64jJDn2dxEmzgF8n4JjXbYKhB6P3zKNblHKCiJ0QYn55yrWHou Shktb12VIA96wIlzZLWPfELJnM2ML+0xJszgRk7krYCGV7oVnkjMLY+5cR1ApXWx4SFy ybqP/AUaHOCmPI41yp3vPnW14jvVbOyVxKgj/k5oFVIItRozIczKgBlbyVwl7gpeJPap YnV695kbOo0XePpoiSM2KZgR7H6A1L8pQvA4ykc8KArtqdciYR5Z28DsHlaEKtAFXyyM AXPQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jyHLOP04; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-121956-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-121956-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id hg1-20020a05622a610100b00430d4cdebc4si10078413qtb.289.2024.03.27.13.06.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 13:06:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-121956-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jyHLOP04; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-121956-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-121956-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9851E1C35051 for ; Wed, 27 Mar 2024 20:06:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C798C153BD1; Wed, 27 Mar 2024 20:04:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="jyHLOP04" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD90C153566 for ; Wed, 27 Mar 2024 20:04:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711569849; cv=none; b=oynUIWVOVwWci6dEoG9nEMVABTWacIVoXicj2+BEG1nLLKehQV6P7JKTglBWeCNvtG35hfM1EckLttFiAh3MHp9aCCju8JYuRu36a9ZEeregsglPFCA9PP03/srZhS2uHzh/vE+xjrLXfqR6z3ZXgpi5m7ILGKMCjOFfGyIGqQ0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711569849; c=relaxed/simple; bh=GqHADRWSK9k2kWQziCyKzMojosS7K/TvpaCs77T6KdU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=f0tCXcb+gviKlHnYHAZv3RFQELpnO7ETDqY7QJ0JyCwDvoxpdy1kDPcXlGEdAqDV+Kjbnovoczx5bLIadMUFG42O42whlEYI3LBiBCY9TQkAid5j7d3E3aVk2GahpF6pf2lE6Ymi2ztrGnbnLgHm1ab1pj+0KlHMeYvuD/mQVMo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=jyHLOP04; arc=none smtp.client-ip=198.175.65.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711569848; x=1743105848; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GqHADRWSK9k2kWQziCyKzMojosS7K/TvpaCs77T6KdU=; b=jyHLOP0445bVCpk3qaO1t2+DCiWKhDYKuCZOQoNuRWGEi1Pe7sjU+RTe tE/y703V9EkQdub/KNU3oLR1GvAY80qMbozZlnEykpfF/zXAehjrcChdC UNf57taGKei6lsxfC+t0uadyjTvOzjwvhCtx2u18GPUt2a7kTCc6/H0q3 U/NndsYUem4pROT/XmcfBEcAUJzt6W41HpdKlL5VJVCJ0S6ysBfKgWZew FI512y9xQTI1hkcMqJfoQnSIzgAZuSrNAy80Pch83U6XK+emxFuTggMb2 AK0z+LkQdYUjrs4FqrYAbd+pVllZ+WHlrY1jYi8aHHzWtd7wvlpYF9LyY Q==; X-CSE-ConnectionGUID: 54Ry8GBST/K/+62+FZQCmw== X-CSE-MsgGUID: 729fafhyQqKxT3jfucC0XA== X-IronPort-AV: E=McAfee;i="6600,9927,11026"; a="18133006" X-IronPort-AV: E=Sophos;i="6.07,159,1708416000"; d="scan'208";a="18133006" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2024 13:04:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,159,1708416000"; d="scan'208";a="16246133" Received: from agluck-desk3.sc.intel.com ([172.25.222.105]) by orviesa010-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Mar 2024 13:04:03 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini Cc: x86@kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH 07/10] x86/resctrl: Update rmdir_mondata_subdir_allrdtgrp() for Sub-NUMA domains Date: Wed, 27 Mar 2024 13:03:49 -0700 Message-ID: <20240327200352.236835-8-tony.luck@intel.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240327200352.236835-1-tony.luck@intel.com> References: <20240327200352.236835-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Old code could simply remove the mon_L3_XX directory with all contents when a domain was taken offline. With Sub-NUMA cluster enabled this becomes a multi-stage process. While the parent L3 domain is still online the offline process for a SUBL3 domain removes just one directory from mon_L3_XX. When the last such domain goes offline the whole mon_L3_XX must be removed. Signed-off-by: Tony Luck --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 46 ++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 22effd8dc207..399dc3175292 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -3012,17 +3012,49 @@ static int mon_addfile(struct kernfs_node *parent_kn, const char *name, * and monitor groups with given domain id. */ static void rmdir_mondata_subdir_allrdtgrp(struct rdt_resource *r, - unsigned int dom_id) + struct rdt_domain *d) { struct rdtgroup *prgrp, *crgrp; - char name[32]; + char pname[32], name[32]; + bool remove_all = false; + struct kernfs_node *kn; + struct rdt_domain *pd; + + sprintf(name, "mon_%s_%02d", r->name, d->id); + + if (!r->parent) { + list_for_each_entry(prgrp, &rdt_all_groups, rdtgroup_list) { + kernfs_remove_by_name(prgrp->mon.mon_data_kn, name); + + list_for_each_entry(crgrp, &prgrp->mon.crdtgrp_list, mon.crdtgrp_list) + kernfs_remove_by_name(crgrp->mon.mon_data_kn, name); + } + return; + } + + sprintf(pname, "mon_%s_%02d", r->parent->name, d->parent); + pd = get_parent_domain(r, d); + if (!pd) + remove_all = true; list_for_each_entry(prgrp, &rdt_all_groups, rdtgroup_list) { - sprintf(name, "mon_%s_%02d", r->name, dom_id); - kernfs_remove_by_name(prgrp->mon.mon_data_kn, name); + if (remove_all) { + kernfs_remove_by_name(prgrp->mon.mon_data_kn, pname); + } else { + kn = kernfs_find_and_get_ns(prgrp->mon.mon_data_kn, pname, NULL); + if (kn) + kernfs_remove_by_name(kn, name); + } - list_for_each_entry(crgrp, &prgrp->mon.crdtgrp_list, mon.crdtgrp_list) - kernfs_remove_by_name(crgrp->mon.mon_data_kn, name); + list_for_each_entry(crgrp, &prgrp->mon.crdtgrp_list, mon.crdtgrp_list) { + if (remove_all) { + kernfs_remove_by_name(crgrp->mon.mon_data_kn, pname); + } else { + kn = kernfs_find_and_get_ns(crgrp->mon.mon_data_kn, pname, NULL); + if (kn) + kernfs_remove_by_name(kn, name); + } + } } } @@ -3979,7 +4011,7 @@ void resctrl_offline_domain(struct rdt_resource *r, struct rdt_domain *d) * per domain monitor data directories. */ if (resctrl_mounted && resctrl_arch_mon_capable()) - rmdir_mondata_subdir_allrdtgrp(r, d->id); + rmdir_mondata_subdir_allrdtgrp(r, d); if (is_mbm_enabled()) cancel_delayed_work(&d->mbm_over); -- 2.44.0