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 7BB2A22B8D0 for ; Fri, 8 Aug 2025 07:16:52 +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=1754637413; cv=none; b=fFwu7MYR00CBSQQxF3gRz9CYYG9pSKk7qIySc4IDHL48ePPrmZVJyG0NrIHfVFBOCjX2wZiPRx8R/2+UmfMRr3IFyy4+yhX2Ag2ZrlLqa9Fy8kkzH60xqqAPH2t8Ioirt1V76MR+RCw75gxJ7/inuqrne9qhzakAmtOSSWgJ54g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754637413; c=relaxed/simple; bh=/MxKZXeJ6aRyXJfx0tIrEDUUhgRLvNaLJ5sKnWlhy7g=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=lV55K5Ex38AIS+BePzeOxkwt+aB4cuZTbLbKpxeufGg+FQrGyjoArSlChRUSxvu9O9aPJnkaj05Xkj/V4oShR4it356dqnzdenQxK0EIrgiDKfiHu9yfERAqzeiOFT8hbTrHCMjx+pROHDkkX2qYMiKFU/W+V0Huan9+6jYCeS4= 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 A621216F8; Fri, 8 Aug 2025 00:16:43 -0700 (PDT) Received: from [10.57.5.99] (unknown [10.57.5.99]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 61F043F673; Fri, 8 Aug 2025 00:16:45 -0700 (PDT) Message-ID: <5dcfd6e1-fa09-4381-8c32-a2276f41ac8d@arm.com> Date: Fri, 8 Aug 2025 08:16:42 +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: [RFC PATCH 27/36] arm_mpam: Allow configuration to be applied and restored during cpu online To: Dave Martin , Ben Horgan Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Rob Herring , Rohit Mathew , Shanker Donthineni , Zeng Heng , Lecopzer Chen , Carl Worth , shameerali.kolothum.thodi@huawei.com, D Scott Phillips OS , 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 , Rex Nie , Koba Ko References: <20250711183648.30766-1-james.morse@arm.com> <20250711183648.30766-28-james.morse@arm.com> <7ab40c09-3922-4e0c-85dd-00ff05be4ce6@arm.com> Content-Language: en-US From: James Morse In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Dave, Ben, On 28/07/2025 16:34, Dave Martin wrote: > Although it may look like the globals are read all over the place after > probing, I think this actually only happens during resctrl initialision > (which is basically single-threaded). > > The only place where they are read after probing and without mediation > via resctrl is on the CPU hotplug path. (and the mpam driver gets the first go a cpuhp, then it calls into resctrl). > Adding locking would ensure that an unstable value is never read, but > this is not sufficient by itself to sure that the _final_ value of a > variable is read (for some definition of "final"). And, if there is a > well-defined notion of final value and there is sufficient > synchronisation to ensure that this is the value read by a particular > read, then by construction an unstable value cannot be read. > > > I think that this kind of pattern is not that uncommon in the kernel, > though it is a bit painful to reason about. As it's sparked some discussion, I've added a mpam_assert_partid_sizes_fixed() that documents this, and will trigger a WARN_ON_ONCE() if these things are observed as happening in the wrong order. Thanks, James