Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1306268rdb; Mon, 19 Feb 2024 10:37:32 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV+6Wz/bmEDY9I0s5zUtedAZRuTGS6k8+M0cohtELN0dtMNdfF/1AHe2AMUdN3Llup6l8Kv2cxXoXpSdddYU4PyUDYWDK2TpAytKZle3g== X-Google-Smtp-Source: AGHT+IFfgOyyGOXTI0Me+sh34ArNhV2/BcMeIRvDTE9ivsSL05taDod2MGaLcE77PLzzpK1MMc8W X-Received: by 2002:a17:902:6841:b0:1db:28dd:a428 with SMTP id f1-20020a170902684100b001db28dda428mr11850233pln.23.1708367852695; Mon, 19 Feb 2024 10:37:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708367852; cv=pass; d=google.com; s=arc-20160816; b=ofabN8A8dcpj6QbaXi/SBEQlnkXBWbJmmIRaBJcO5cdI1i4fo3K3qhPjcGTzM2Z/zt DhQCx9YbN9j3nRq6UfS5qCAXshAV2aRxvoo6ufd3Mnd08GV5gFKTs5A8KtKfB6TFHqY4 Py6/NvFq8CtyWkcEM8Nm/DUbpeUW7SNq1/WnY/1Yl+vwEIF5igeeEbnXk4cdFX82XZIY V/Ru2Y6halDeARZX2hEi5Pyi3XvyG4l3Nz+ch/pJIOuytIzEP0kyvkIfjnoUFBgQqlGa KDVMYRYnF9pWXNDbZwDpxmyJpzuZL8+936I4ppqZn1mfvWbEPgp6FmMaLQs1P528LWwG Xxpw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=HbRZkDz5HwZVrDpQMCIZgrb24WkaZc28u6WKZpX157g=; fh=n4H4sG50U6DIdypz596/kRWdpMDl152Oh9U3Sp1nb/I=; b=qPniuitnosYYWuwRnZrTpY0dJrWNhWKVU0D4GcHlg2v5rc+1dhZ/4n7rtnSau7M/XG yCD/lPZGpJTNoPV4pYZzvNdV/R4GSSPyw/nizDrwmMN6Be4bUMfcsimRuhnQz/fRLhL2 5U3w5FIg7Z+5RC7PjJO65VToQouHHAsejglgo06y5QtT9SUp1SwfDCF7HkM1MHvhGEvQ Sn+4yODc3xyiIxzXmAskpKKOtHv9gg/ZuzsdBExS04Mv9U9aohs6LjP08Qz2jCfxtEX3 TzRSHqXX1O8kyOR5TApBMb4AKPXxR8UbH1nvwF/9L0lu9lzpHSAbmNuUC9NsA981YU2h VZfg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=yw4+WRy3; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-71813-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71813-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d8-20020a170902cec800b001d6f295bc53si4799061plg.204.2024.02.19.10.37.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 10:37:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71813-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=yw4+WRy3; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-71813-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71813-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 65ED3282C53 for ; Mon, 19 Feb 2024 18:37:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C278D2E408; Mon, 19 Feb 2024 18:37:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="yw4+WRy3"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="5piZHYX/" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 2C1E22E3F0; Mon, 19 Feb 2024 18:37:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708367846; cv=none; b=emOKNlDaIotxclLDK36IW38ajucBCV2EKN1uFjTSmoxfoYpV8Tbc5Bek5gi2oQmoVMQU6r9yR4y1D7Lj3ESN8ZkjqjRoMTpqnfmZHbHMm9F0ZdGlsrE3LqYmqQZTk/wdtA/iyRmB4nKgu1+vr1rLFvV44C0y2gByIisWUVvYAYQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708367846; c=relaxed/simple; bh=CsHF8smg0stJA6YPRQRzSA8JXwe+Of6W6x+aRxIpMUs=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=vDBjudkn4VTP2zclHLXxjphdCeOa2mg9C9qLLFDyL6yCWDZsyat8dwcdCbOKQcO0fOgrZRqXVmeG08skZPAG3/mclm67rD3gfA36R6GWnMdeb6q58aAHWovD5xzKgtEaiyUBJ7X/e1Fk+HwHdR+bVIN5HEmH9JMYfoYSQrl3KIU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=yw4+WRy3; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=5piZHYX/; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Mon, 19 Feb 2024 18:37:22 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1708367843; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HbRZkDz5HwZVrDpQMCIZgrb24WkaZc28u6WKZpX157g=; b=yw4+WRy33U0ZyMVyN2JCXWqakMKUIbSkDYDsPmK0XcggF9ZE6A1XhjelgKbfFPBIKKuTpN BZ/f3Ma1Knq5whPYI6H4L7I7SSQa6lh4KYF+v3uH2Ip/APMdbOiAfcMyzMacnsRPQzHNTu cFcTMtf5mSvtbeEhydBLtAG2m44cq+K0trVigOnEXhPqrZhRkTYqaK8QvQTatp6QwhYqsl zH425C2EwH+Xo2cErzg21Z6sxgvdxnsVPLUTV0Yir8d3+M4B3ZvKF4s4VG3bpH4Ii/Klai UUo6XUoPDS0HbkyGfReQ8AkthsoNmT3x3xxFLNuhxJ7s54smYfuCSlt80hONzw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708367843; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HbRZkDz5HwZVrDpQMCIZgrb24WkaZc28u6WKZpX157g=; b=5piZHYX/seFwLICjKOfx2E+cvVFDoHUmmOZ7Wg3tc09yfVAnBYOYsVoHEKpUdEh2vcPVBd AU8vUPlp9F5yshAA== From: "tip-bot2 for James Morse" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/cache] x86/resctrl: Move domain helper migration into resctrl_offline_cpu() Cc: James Morse , "Borislav Petkov (AMD)" , Shaopeng Tan , Reinette Chatre , Babu Moger , Peter Newman , Carl Worth , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240213184438.16675-24-james.morse@arm.com> References: <20240213184438.16675-24-james.morse@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170836784227.398.16507056859148393452.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the x86/cache branch of tip: Commit-ID: eeff1d4f118bdf0870227fee5a770f03056e3adc Gitweb: https://git.kernel.org/tip/eeff1d4f118bdf0870227fee5a770f03056e3adc Author: James Morse AuthorDate: Tue, 13 Feb 2024 18:44:37 Committer: Borislav Petkov (AMD) CommitterDate: Fri, 16 Feb 2024 19:18:33 +01:00 x86/resctrl: Move domain helper migration into resctrl_offline_cpu() When a CPU is taken offline the resctrl filesystem code needs to check if it was the CPU nominated to perform the periodic overflow and limbo work. If so, another CPU needs to be chosen to do this work. This is currently done in core.c, mixed in with the code that removes the CPU from the domain's mask, and potentially free()s the domain. Move the migration of the overflow and limbo helpers into the filesystem code, into resctrl_offline_cpu(). As resctrl_offline_cpu() runs before the architecture code has removed the CPU from the domain mask, the callers need to be told which CPU is being removed, to avoid picking it as the new CPU. This uses the exclude_cpu feature previously added. Signed-off-by: James Morse Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Shaopeng Tan Reviewed-by: Reinette Chatre Reviewed-by: Babu Moger Tested-by: Shaopeng Tan Tested-by: Peter Newman Tested-by: Babu Moger Tested-by: Carl Worth # arm64 Link: https://lore.kernel.org/r/20240213184438.16675-24-james.morse@arm.com Signed-off-by: Borislav Petkov (AMD) --- arch/x86/kernel/cpu/resctrl/core.c | 16 ---------------- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c index 4aedefa..b03a6c6 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -580,22 +580,6 @@ static void domain_remove_cpu(int cpu, struct rdt_resource *r) return; } - - if (r == &rdt_resources_all[RDT_RESOURCE_L3].r_resctrl) { - if (is_mbm_enabled() && cpu == d->mbm_work_cpu) { - cancel_delayed_work(&d->mbm_over); - /* - * temporary: exclude_cpu=-1 as this CPU has already - * been removed by cpumask_clear_cpu()d - */ - mbm_setup_overflow_handler(d, 0, RESCTRL_PICK_ANY_CPU); - } - if (is_llc_occupancy_enabled() && cpu == d->cqm_work_cpu && - has_busy_rmid(d)) { - cancel_delayed_work(&d->cqm_limbo); - cqm_setup_limbo_handler(d, 0, RESCTRL_PICK_ANY_CPU); - } - } } static void clear_closid_rmid(int cpu) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 5bd3d8f..777e9f6 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -4029,7 +4029,9 @@ static void clear_childcpus(struct rdtgroup *r, unsigned int cpu) void resctrl_offline_cpu(unsigned int cpu) { + struct rdt_resource *l3 = &rdt_resources_all[RDT_RESOURCE_L3].r_resctrl; struct rdtgroup *rdtgrp; + struct rdt_domain *d; lockdep_assert_held(&rdtgroup_mutex); @@ -4039,6 +4041,22 @@ void resctrl_offline_cpu(unsigned int cpu) break; } } + + if (!l3->mon_capable) + return; + + d = get_domain_from_cpu(cpu, l3); + if (d) { + if (is_mbm_enabled() && cpu == d->mbm_work_cpu) { + cancel_delayed_work(&d->mbm_over); + mbm_setup_overflow_handler(d, 0, cpu); + } + if (is_llc_occupancy_enabled() && cpu == d->cqm_work_cpu && + has_busy_rmid(d)) { + cancel_delayed_work(&d->cqm_limbo); + cqm_setup_limbo_handler(d, 0, cpu); + } + } } /*