Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp874286lqt; Tue, 19 Mar 2024 06:38:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVmC3Fo0aCaqvSmoQ28LzXjxYAhvfanc6JERoAaHmUCXrvtWPi/2CRu4B3Xmzrbyopz7ABdlMs1wWxRuCvOyXKx+JmD59L+IqbAsTDq4Q== X-Google-Smtp-Source: AGHT+IGpEVUMvxUddi1rlBrrJrI7HFiyknlNu7YryLBQN4Q1gVK4lyfhCal5lbyJRRONcvvRBk7y X-Received: by 2002:a17:906:d8c:b0:a46:181f:c1c3 with SMTP id m12-20020a1709060d8c00b00a46181fc1c3mr9457402eji.70.1710855498273; Tue, 19 Mar 2024 06:38:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710855498; cv=pass; d=google.com; s=arc-20160816; b=HWx9rVBYYkkU6C6qgHT2jXmjJGvPIgPqwD59A3spkn7YgMgrSSKS7en9GwWZI+vr2s Alg4pEeDYq/H6xJq03jsL+xn0nAJClOVglP5OFwUjjlrFjXsHDuPXjg4OTlxgYNVdH3t 7xi0EfZLjvbhipetU211OLg32TCBmEDq8fHDZ5GkftIzv08nxn5A8ClFHUXHOBmd21lP GfFom7nsmw6xNF4RmmvRVZAnogCu/6gbW70KkmqtGLE6oaBEqtSQnrM6m3HD2WfQL89U XJ1HdDRA8gFtPWdwAPy+zwfcMspMQ+MqBgyNjTqwf+PIb7KKJLm/YSkqf5wGBZlxGBx4 TCnQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=AHNy8s6ZrHehAjXb/cw60DwcMUbPfB3PEodeOCrE1Bo=; fh=IycyatD8G++MwFoNnfqq+wyLymd0ARFN7hI7l/Byq9w=; b=D9aGCmEXzvl+c4cDfXPUR3q8FEb81pkF9qDFFCd/0i6pwgSS1yeLTcDTp7TmxU15nc BjJG8AT2liWpvf42Axf5DKy4FmMxDSqehJzjO76kuONBsG4mUInqSRl+QGC7kejLLE/J 1g3HIy5lzMYxgiV2MBLJPNuFvC5zY6hf9htSGHDlAuQT653LYZh803vveQgwvZb5vcxD AqxEvLhpUByWjJuwBVBHXrbN9tjf5hPo8xOKG60JesCwMg7NLoiuyG+DocWolBhUKn41 RkoEAiHMbj4Pg/VbxIAkpVDarR5ubCBQR+BsblHMbmTqQ2GuKVdKtyDsXrIOyoN8w8c3 0TLA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=gYd8uPut; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-107598-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107598-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id v9-20020a170906338900b00a4677788684si4882680eja.551.2024.03.19.06.38.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 06:38:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-107598-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=gYd8uPut; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-107598-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107598-linux.lists.archive=gmail.com@vger.kernel.org" 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 00BFC1F25BCF for ; Tue, 19 Mar 2024 13:38:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E38F58060B; Tue, 19 Mar 2024 13:38:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="gYd8uPut" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 B6ADA7F471 for ; Tue, 19 Mar 2024 13:38:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710855490; cv=none; b=mYi0wZmqV6qs5aXEp9TNI3PohFbhjxmLgrfWrkuU+KsnDozTGCBL0Sph90izt9Ma17uTKSGuv/AvzWdJTcZRPCfrt/IvipMj3If+pZzE5fT8vHo/P2KNFhLZtYmuc4db8Ec+O+dNtMwx3fAn/Ljd+vuGcmLGDjTAa9HCwbX1ugs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710855490; c=relaxed/simple; bh=o/6gOedeKupUsZdMk2WoQJQXGAXsC7pO0bndXDxVQKM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=aQCC2q7nwgd6QhZXxOutn9bI259qHI6MlBSN5k9FXpfB+X66XiA4dL3rZ77QTpSRCxv7KOOY1RR4skFA6dL+3MNROCc7b8GY9dRFpFnDfsRQ20xAj5sm2j+vdw+mufg21PFfvIZcs+h+uqoqf35lNeaspvTEoIR2WZRBpsMX3GE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=gYd8uPut; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=AHNy8s6ZrHehAjXb/cw60DwcMUbPfB3PEodeOCrE1Bo=; b=gYd8uPutBI/6Y7n9awDf8GMkwS R+Oiyb+4sgiFlC1HFyRVtsKriNPeLyoyE0yS324AA6JRc2kK+RI7GiivMpOHE0RvRIUIK1VfAwgRY 7x5MxGr7EZof3TlfqqVQ8DzO++QvW2khbJOirOy26wpDjXRGoc0aj9US74oSc8rk7b81htUS3ergI +f4JgqMulhxKQ9Vy8Swop5QEjTlz7fz7yYQC/nof72TyOm8eI5f4ls3KANQ+EFdNAhnib7FZyLrsM AE53q4ZxQIrZc56YYg4D7BLbVI0y/SzcerlPxa9yaCJ4H4xZOC8Sztmy+yup/R04yQX9/Gegm8via 6NH0Dmog==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rmZfK-000000022AA-2y7C; Tue, 19 Mar 2024 13:38:06 +0000 Date: Tue, 19 Mar 2024 13:38:06 +0000 From: Matthew Wilcox To: Sebastian Andrzej Siewior Cc: linux-kernel@vger.kernel.org, Boqun Feng , Ingo Molnar , Peter Zijlstra , Thomas Gleixner , Waiman Long , Will Deacon , Clark Williams Subject: Re: [PATCH] Locking: Let PREEMPT_RT compile again with new rwsem asserts. Message-ID: References: <20240319070550.ws_uO21-@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240319070550.ws_uO21-@linutronix.de> On Tue, Mar 19, 2024 at 08:05:50AM +0100, Sebastian Andrzej Siewior wrote: > -static inline void rwsem_assert_held_write_nolockdep(const struct rw_semaphore *sem) > +static __always_inline bool rwsem_held_write(const struct rw_semaphore *sem) The locking maintainers were very clear that this predicate Should Not Exist. It encourages people to write bad code. Assertions only! > { > - rw_base_assert_held_write(sem); > + return rw_base_is_write_locked(&sem->rwbase); > +} > + > +static __always_inline void rwsem_assert_held_write_nolockdep(const struct rw_semaphore *sem) > +{ > + WARN_ON(!rwsem_held_write(sem)); > } > > static __always_inline int rwsem_is_contended(struct rw_semaphore *sem) > -- > 2.43.0 >