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 00A4230CD81 for ; Fri, 8 May 2026 16:24:00 +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=1778257442; cv=none; b=aaW6f6nOcl++PAZCFcBHFpL0NKdBAzTC6vvJBAsIaqyVWo3oB5Sec0xzz38tOGmzsBJcZZoXwKdb89iqJI0Gh5qxhs2fATNJZR7vhSnjbsZaxvYADwDJHdFT0JOQoB64DQhj5epEcnjZRafKXjtrw0Jpkhzw1dhrOsPJjULhUaE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778257442; c=relaxed/simple; bh=/UBLQNQv/jESKVCey7P8WZJaGnOhYl64JzXcUuHLQyc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fVcc5ji2P8r/MaOTojyTZv8AUNfI6N3D2OFDV2lE4unEcV8yDPLON31pQSGuIh4aq0TPXgYQ1qtQqfeMJEciIX+GSvwANvsoGawyuPzyW2sGsp/2K0+Vn1Gde5fuG2PqR0Xrbeo4XxKWDIVev7BeMobOXUeTqgPkCg9LK1mZlEU= 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; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=U9In9eVz; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="U9In9eVz" 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 23B2C1E5E; Fri, 8 May 2026 09:23:55 -0700 (PDT) Received: from eglon.cambridge.arm.com (eglon.cambridge.arm.com [10.1.196.96]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7ECBF3F763; Fri, 8 May 2026 09:23:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1778257440; bh=/UBLQNQv/jESKVCey7P8WZJaGnOhYl64JzXcUuHLQyc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U9In9eVzRoyWBnl/EdZ/eBCvm3lpoZfcWCHQN4ev0L4+Ug8VqM8tpEGUUDon/UnV0 p8eCYtPD6rbrxpkpEMCeRAcGAikvWdWEAPN3sDbqvB+MMjBnmuiYWzORDhQfllSEUZ 9KivCJVDol8B3ZdxF27DQflk1uTSS1Dn4WHkMMmM= From: James Morse To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, zengheng4@huawei.com Cc: wangkefeng.wang@huawei.com, xry111@xry111.site, catalin.marinas@arm.com, yang@os.amperecomputing.com, reinette.chatre@intel.com, will@kernel.org, thuth@redhat.com, ben.horgan@arm.com, mrigendra.chaubey@gmail.com, fenghuay@nvidia.com, ahmed.genidi@arm.com Subject: [PATCH v3 1/4] arm_mpam: Fix false positive assert failure during mpam_disable() Date: Fri, 8 May 2026 17:23:38 +0100 Message-ID: <20260508162341.3762549-2-james.morse@arm.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260508162341.3762549-1-james.morse@arm.com> References: <20260508162341.3762549-1-james.morse@arm.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 mpam_assert_partid_sizes_fixed() is used to document that the caller doesn't expect the discovered PARTID size to change while it is walking a list sized by PARTID. Typically the MSC state is not written to until all the MSC have been discovered and this value is set. However, if discovering the MSC fails and schedules mpam_disable(), then the MSC state is written to reset it. In this case the discovered PARTID size may be become smaller - but only PARTID 0 will be used once resctrl_exit() has been called. Skip the WARN_ON_ONCE() if mpam_disable_reason has been set. Fixes: 3bd04fe7d807bb ("arm_mpam: Extend reset logic to allow devices to be reset at any time") Signed-off-by: James Morse --- drivers/resctrl/mpam_devices.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c index 41b14344b16f..bef5e9e9e844 100644 --- a/drivers/resctrl/mpam_devices.c +++ b/drivers/resctrl/mpam_devices.c @@ -164,11 +164,17 @@ static void mpam_free_garbage(void) /* * Once mpam is enabled, new requestors cannot further reduce the available * partid. Assert that the size is fixed, and new requestors will be turned - * away. + * away. This is needed when walking over structures sized by PARTID. + * + * During mpam_disable() these structures are not fixed, but the MSC state + * is still reset using whatever sizes have been discovered so far. As only + * PARTID 0 will be used after mpam_disable(), any race would be benign. + * Skip the check if a mpam_disable_reason has been set. */ static void mpam_assert_partid_sizes_fixed(void) { - WARN_ON_ONCE(!partid_max_published); + if (!mpam_disable_reason) + WARN_ON_ONCE(!partid_max_published); } static u32 __mpam_read_reg(struct mpam_msc *msc, u16 reg) -- 2.53.0