Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp900383lqt; Tue, 19 Mar 2024 07:15:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUUtIC81QU3t8a4w7ZuUb6yYBDlgB7gH2zbi6kVnkwe2X0rBt/+jiVxdLkSaHULaOzXFIcDK/Td2VarCGRh+hI/9Goc3rQ8/Fq87ZKWkQ== X-Google-Smtp-Source: AGHT+IERJmxg5OWCbL593jStP5flX0PYj7zxUKnR3veLShSJUNopvv1I0kaxWTVOYlk0wapkhWbG X-Received: by 2002:a17:906:ef03:b0:a46:c01d:b595 with SMTP id f3-20020a170906ef0300b00a46c01db595mr4657557ejs.53.1710857727628; Tue, 19 Mar 2024 07:15:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710857727; cv=pass; d=google.com; s=arc-20160816; b=Gkn5Qq0NePJ/8PoiwVRQQDOMl14CXr6uw0Jc/7orlfzlSk2uOvclfZ3oegTJ0LnFHz 5Fw2a5jwyy7x1Zf9wsV7CtoTneis2hi3FQIi1cDJrdwHUgNwJ86+8JUiSg6U0pBZ+twU 0xRKwTpxqnc2RE9H3BxQPvs/M83lUYnyVMRXPKH3M0aUj6C+A8gOAqSynXOHjYVz55On owfG3VsFLM80vaBj7cI0tIihqM8GGChXP8sGN0+H6X4rrAJmH12xf5I6MoGzsd5142l2 LLyQCXQ3B5sXP0CJKICmDm7lHeweZmtDG8EYHmTw9ohcmTGbc37mq5gaOolDl6txCYnd ZaJg== 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:dkim-signature:dkim-signature:date; bh=pJN0PTyH0UKoPFa7kTYFWKIZEIxZksQ2C3Toyqp2Wnk=; fh=a9+oBNf9l5mHzGPRTQihyTVxgvL0grf7xy2Ty7EWR5A=; b=GEKBoeOfu8lAt+Vjef/sGWiqG3BKruogOeZa54cC20y7yLZm0KgxBDMOrEq4UyuQyI C4JAUFkJ1zxl9uf9YWsrBjmfyVOldHyaW4UeTThGEI1bWXDIGsovwmGECD32ZdQeX4YS yNmkzuumUhyUBTr5C0/tpSQoTeeb7efPZsm9ek/T0uPTIW4DPB/TIM+rm4/YjSENnpc+ bcGZsUWxLrtLrBXVAR+Nf+6lSxE8ud+Iio5Jabjm9KTOlg5cSf+09l8p+gJyVeYpTPmh UA4o+u6DHJKJKjRZJST/5s5SuYIbTVBWs218VV2Sr0h1rhtszchZuPqetK/Y7MZ5RVFo UAYw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=wmiLTtQJ; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-107631-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107631-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id lf12-20020a170907174c00b00a4642a02ccesi5352672ejc.840.2024.03.19.07.15.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 07:15:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-107631-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=@linutronix.de header.s=2020 header.b=wmiLTtQJ; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-107631-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107631-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 563271F238F4 for ; Tue, 19 Mar 2024 14:15:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F18858173B; Tue, 19 Mar 2024 14:15:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="wmiLTtQJ"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="sAPXVYcL" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 AAEEF81748 for ; Tue, 19 Mar 2024 14:15:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710857710; cv=none; b=hm28KLHUNVMi8ANG4JTrOM6IxjjJKs340O4Rt6yUBhfVuAmAw+lUcTecinFamK27sE0E/rdn6Hhmyr8zE/wf0/0DkVh8NVIC+Cdo5eOk7RsdEgOGXgl46hnLqveCOBmmzOnXat6Ekea9j3OTo2wgObiYnt1mqiX1tpUJcxwNQdE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710857710; c=relaxed/simple; bh=sXw/hen6coo9Y4mQg0v3PJdb45MkVSydX+eSXvbsNOQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=P8qtDrLdRvPT/OAO4I7xWlttczhVPa4aiNSvEeUjVF7JR/cGJcg8tbF7CDGGgido0lVvSJwkqrzeQUZpNa72MIbOjtQUNic1WbwO1PD/05MT9xMinHWgD+XC7B31ZJLbNpk3gW6c6+Oq8xpEfPEn94vmls8EcRkvJp7G57/sFwo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=wmiLTtQJ; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=sAPXVYcL; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Tue, 19 Mar 2024 15:15:06 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1710857706; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=pJN0PTyH0UKoPFa7kTYFWKIZEIxZksQ2C3Toyqp2Wnk=; b=wmiLTtQJqCc+rjcXTU23R8Pfq8MoQ2XY8xBpT4qhA7qyU5PbOG9FsD0dagLI0BXjP8H4cN JdTp6UOarDNSPEDDSQB0bjWOp3ChSsw76zAmUpAH45NSRiQkkuyLgh29BAaVYbQ+UlmFrZ sWCu8uMM3IPX3UF0QA3RAIFsU1clrS43szRWO7COZjzfqhPpJT4m1VZOTVuAPnINHVWkop 4/AptIa7trdgFxf9zq2IXWBl6NRCSmEbuJZZp7KkUW/VFI29lggrJrSXpxXNIa0fc6+CR3 ZH2mVS1gu7AIS5NzScaN7A13pb6BWuNmq2yKGhMhV4cUjTsXGr+qWuNPoT+bJQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1710857706; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=pJN0PTyH0UKoPFa7kTYFWKIZEIxZksQ2C3Toyqp2Wnk=; b=sAPXVYcL2PqmbaXWIkv4+xx/IqtaHQrE3Sar6jJuP2HFGUFHTv3ZIUzgrhvcKJuhat3VAK t5KVaPfC7tm9OFDQ== From: Sebastian Andrzej Siewior To: Matthew Wilcox 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: <20240319141506.DUd9NKl4@linutronix.de> 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=utf-8 Content-Disposition: inline In-Reply-To: On 2024-03-19 13:38:06 [+0000], Matthew Wilcox wrote: > 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! What do you refer to? The inline vs __always_inline or rwsem_held_write() should not exists and it should invoke directly rw_base_is_write_locked()? > > { > > - 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) Sebastian