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 215183328EB; Fri, 17 Oct 2025 18:51:27 +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=1760727089; cv=none; b=GfhYCTHP/lIUMDfLuIK10VkDYAFOo6XyyiQY6hgEng+0IBkHNZeW6O8fligIPF2F33uFUHaoQFphC1Buq0sPq6ptndlQU3U7Dea2QH36/mKoK0XfQhoebxNnilKO1SINjJGMRUevx7653iY+NUxqq2oR7gn72XqS7osvNEKLHZY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760727089; c=relaxed/simple; bh=lleXYRsqTTGOg7HyySH/E8d/rbkRXFSammjebf7Er2Q=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=nOo9UWHbTwd8NNebXonMmqr3iO9OYJ7lg9FWLeORMg/QmRk5/amQzfO2Z2Z0W4Y0US1ppbZHpVroenYOdpCE2Z4jIuvlDyFfdRNj+nV4oKYgU3hbbQVz5mcX1dDT98rHDAUkIv6Tl+QIruzj66JHZvRk9z0PmtlkVqJ9+rdYxUM= 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 74B1B1595; Fri, 17 Oct 2025 11:51:19 -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 A3F1B3F6A8; Fri, 17 Oct 2025 11:51:21 -0700 (PDT) Message-ID: Date: Fri, 17 Oct 2025 19:51:19 +0100 Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 08/29] arm_mpam: Add the class and component structures for firmware described ris To: Markus Elfring , linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: LKML , Amit Singh Tomar , Baisheng Gao , Baolin Wang , Ben Horgan , Carl Worth , Catalin Marinas , D Scott Phillips , Danilo Krummrich , Dave Martin , David Hildenbrand , Drew Fustini , Fenghua Yu , Greg Kroah-Hartman , Hanjun Guo , Jamie Iles , Jonathan Cameron , Koba Ko , Len Brown , Linu Cherian , Lorenzo Pieralisi , Peter Newman , "Rafael J. Wysocki" , Rob Herring , Rohit Mathew , Shanker Donthineni , Sudeep Holla , Shaopeng Tan , Wang ShaoBo , Will Deacon , Xin Hao References: <20250910204309.20751-9-james.morse@arm.com> <5a80cb91-6095-4f44-b576-53badc4575f5@web.de> <88f45c7f-9769-478b-9abd-749ec8f8d43b@arm.com> Content-Language: en-GB From: James Morse In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi Markus, On 26/09/2025 19:15, Markus Elfring wrote: >>> … >>>> +++ b/drivers/resctrl/mpam_devices.c >>> … >>>>> +int mpam_ris_create(struct mpam_msc *msc, u8 ris_idx, >>>> + enum mpam_class_types type, u8 class_id, int component_id) >>>> +{ >>>> + int err; >>>> + >>>> + mutex_lock(&mpam_list_lock); >>>> + err = mpam_ris_create_locked(msc, ris_idx, type, class_id, >>>> + component_id); >>>> + mutex_unlock(&mpam_list_lock); >>> … >>> >>> Under which circumstances would you become interested to apply a statement >>> like “guard(mutex)(&mpam_list_lock);”? >>> https://elixir.bootlin.com/linux/v6.17-rc5/source/include/linux/mutex.h#L228 >> >> None! The bit of this you cut out is a call to mpam_free_garbage() which calls >> synchronize_srcu(). That may sleep for a while. The whole point of the deferred free-ing >> is it does not happen under the lock. The 'guard' magic means the compiler gets to choose >> when to call unlock. > > How does this feedback fit to the proposed addition of a mutex_lock()/mutex_unlock() > call combination (which might be achievable also with another programming interface)? Right - I've muddled the horde of "must use guard srcu" with the horde of "must use guard mutex". In this case I'd still prefer we don't spuriously hold the write side lock when doing the deferred free-ing. Thanks, James