From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 724EE30B50A; Tue, 30 Sep 2025 17:06:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759252011; cv=none; b=oYM2MiZqXN1s82RWFvbLdXp1mR/qkR/dPtohLn5wAZgknv6Eb3BtiRP9afLerJfJTfdkrHJZLR83r9U1g7lCv2QQ8FDfIChnkcyDhx+H/BofAxDc6BOwB9G29ar5lDOX7fxzk90y3CkeL+2nCwRfeEmOo+V4bVtONkAlTqrmh+c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759252011; c=relaxed/simple; bh=SFznz0JiL0nczxwM1nMt9/UtD3k3rWFHVz532gREW8U=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=YjLS+3kK0TUKzybMBKUuQMivau52u+U4ht++JWjFXRB6zt+a7YiMdw/nFURkx9gwls0fcYrjU30tm8VwC39Q8oW2vHhhDoUbUTw9QWb/pxsDTGGBtSY1FUsE++iKk7T/5QaRdjNEmGKn9b1FeOPtd+gRofce2WYyhIJOYtXlk7A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D72BF267F; Tue, 30 Sep 2025 10:06:40 -0700 (PDT) Received: from [10.1.197.69] (eglon.cambridge.arm.com [10.1.197.69]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D00833F59E; Tue, 30 Sep 2025 10:06:43 -0700 (PDT) Message-ID: <137ca3de-2572-4edf-b10c-67b690f84128@arm.com> Date: Tue, 30 Sep 2025 18:06:29 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 15/29] arm_mpam: Reset MSC controls from cpu hp callbacks To: Jonathan Cameron Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, D Scott Phillips OS , carl@os.amperecomputing.com, lcherian@marvell.com, bobo.shaobowang@huawei.com, tan.shaopeng@fujitsu.com, baolin.wang@linux.alibaba.com, Jamie Iles , Xin Hao , peternewman@google.com, dfustini@baylibre.com, amitsinght@marvell.com, David Hildenbrand , Dave Martin , Koba Ko , Shanker Donthineni , fenghuay@nvidia.com, baisheng.gao@unisoc.com, Rob Herring , Rohit Mathew , Rafael Wysocki , Len Brown , Lorenzo Pieralisi , Hanjun Guo , Sudeep Holla , Catalin Marinas , Will Deacon , Greg Kroah-Hartman , Danilo Krummrich References: <20250910204309.20751-1-james.morse@arm.com> <20250910204309.20751-16-james.morse@arm.com> <20250912125535.0000151c@huawei.com> Content-Language: en-GB From: James Morse In-Reply-To: <20250912125535.0000151c@huawei.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi Jonathan, On 12/09/2025 12:55, Jonathan Cameron wrote: > On Wed, 10 Sep 2025 20:42:55 +0000 > James Morse wrote: > >> When a CPU comes online, it may bring a newly accessible MSC with >> it. Only the default partid has its value reset by hardware, and >> even then the MSC might not have been reset since its config was >> previously dirtyied. e.g. Kexec. >> >> Any in-use partid must have its configuration restored, or reset. >> In-use partids may be held in caches and evicted later. >> >> MSC are also reset when CPUs are taken offline to cover cases where >> firmware doesn't reset the MSC over reboot using UEFI, or kexec >> where there is no firmware involvement. >> >> If the configuration for a RIS has not been touched since it was >> brought online, it does not need resetting again. >> >> To reset, write the maximum values for all discovered controls. > Just one trivial passing comment from me. >> diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c >> index cd8e95fa5fd6..0353313cf284 100644 >> --- a/drivers/resctrl/mpam_devices.c >> +++ b/drivers/resctrl/mpam_devices.c >> @@ -818,6 +921,20 @@ static int mpam_discovery_cpu_online(unsigned int cpu) >> >> static int mpam_cpu_offline(unsigned int cpu) >> { >> + int idx; >> + struct mpam_msc *msc; >> + >> + idx = srcu_read_lock(&mpam_srcu); > Might be worth using > guard(srcu)(&mpam_srcu); > here but only real advantage it bring is in hiding the local idx variable > away. Sure. I did that in a few other places, it looks like I either missed this, or thought it got more complicated later... Thanks, James