Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp964507lqt; Tue, 19 Mar 2024 08:54:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUMSSapJUMFtO/JabibzQXATCalxynLhxaKJpCop66r3JVPDN/p9rIOATyKRMxAbpgOMEDV75UBelX3HaG/D2GidyTsEzu+iKokdruNCw== X-Google-Smtp-Source: AGHT+IEy4UxsJN+E8j/HX5RkAOgxMqn4+6kHHbuYo+Js2NVXs6I01GEhKc3PqVPytx21Am60WxkN X-Received: by 2002:a1f:fe4b:0:b0:4d1:34a1:c892 with SMTP id l72-20020a1ffe4b000000b004d134a1c892mr10046848vki.13.1710863661111; Tue, 19 Mar 2024 08:54:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710863661; cv=pass; d=google.com; s=arc-20160816; b=vet+1WgOcMKJ6RC1RALMqE5k8r+ufvPCYreIG/JmLTw8B1zZg1c7191Zw6MX9fiMEB b7jSAjKo5vUwaICuIuDPfVp8vXXQc4CvS5XwEwrO1LosH51vW/z4OSMXz9OsTaQ8mkQ9 tbNezFvT/6jOPgJ98S8iDufuaxa0B9LRoWLT14CQXeU31TKT8BdOM3+wcR3k++7HgOuy /i6cwyrBgLUUUAZ2t0T67zabo4kuHoMQ4sIeRa04t/GHwOHtHGmphhrX4VGcmhRzJ8Ph 5lKrRq7+vXwW2lRLFmUA9l10aXscwLZmP09yBIMVBfQ3hNJRIH2pmupWYv14U+4djamZ 0spA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=Ko9D6jNCbeVAgprQATdARtgHSvmfZlnh+pwV+XTC6LU=; fh=B577EqioUI2jI/+Wzsl78eyS0Skxk3+MU3PrL+9o8mY=; b=Nr6mL5tMSWLsvArZiV0tD7COjsKWMNwqne1XuiZn8To44kfg4j4lrCA/YYwQLU7BZW sC7ubzOZmv6hBt7YHT5vqEtRDRjK0cEMveWZUfv9Nw4t97LlJKyWNsYxipAQQGyzZwdw 33oIXwqETgtP/4URD6d0m8Uko4Cg/WmOWlbTaJg2/5ENE7AxEomBKwPRvT/RfDWQft7A 9pJcAfoiIP0ojGGcSFbgcuMCFsszv4K3bJsllqb3ZYm+WI8DWpFpt6qa2cKLfpKweYqt Cr5dI9ovnqTIYkMQvdNDn9MaaSkPS99rO7/VAXiSuNll5QnQ0ilyrx+ia5FILDtO6qk4 ov6Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gcYDTijV; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-107748-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107748-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id fo9-20020ad45f09000000b006903ca2ae9fsi11284378qvb.273.2024.03.19.08.54.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 08:54:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-107748-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gcYDTijV; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-107748-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107748-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id CF4661C22C8C for ; Tue, 19 Mar 2024 15:54:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AD1EB65BAA; Tue, 19 Mar 2024 15:54:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="gcYDTijV" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 4296B657BA for ; Tue, 19 Mar 2024 15:54:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710863642; cv=none; b=WbQOdlfOphRVg3WOJrrPqV2YESRqcfdHtYJS6SAKjW0mDha1WIn5wnsChb1UUe7vL0kgEQHCQtTbL34hMc+Pvv6JACZ6I4HYXci9mjQeuRvK6Eem81XhIRPwd4iOIyUApkdJw+4TtfZApK+NPbrgmvTgr7PhQNWtJ4QQEpZiWDk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710863642; c=relaxed/simple; bh=paSWeKBIFxB+F/AXMlOAQl6P1bEPAiBsLyGlr2J3chs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=K/5WOjljey+/fJXZ0X+68rwUfaYvv8Eo7QnQcj3jF86cXkxEgX4fnuqvzGm4hRilaZACSjlp2uERNOsuK6tpSeY40itbB4QlBCPLQpopl22NyuAEfbN15hOww6Si8h+QKirMMJN8cmSAW70iDpQMu+lds7VhyRyFr3uDII6QhI4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=gcYDTijV; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710863640; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Ko9D6jNCbeVAgprQATdARtgHSvmfZlnh+pwV+XTC6LU=; b=gcYDTijVM6RpkRLGRAL5e2N6YQchIZjHELMa+Q4Rj7yxyY3mFMiHRIqdA1XYC/EmZ2HxRo k4h+/IP71TX9bTbQpVnraQq/t0EixYAgciGAMpQrWYGYYlUnkjvDLBUg0tf/trCuHw3sle sXT8lYH9LEs+4Q9F2ZpYgn6uyPy0rpY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-616-zfuj1Uq-N6GFgh1hIK-5Tw-1; Tue, 19 Mar 2024 11:53:55 -0400 X-MC-Unique: zfuj1Uq-N6GFgh1hIK-5Tw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6784D800266; Tue, 19 Mar 2024 15:53:55 +0000 (UTC) Received: from [10.22.10.159] (unknown [10.22.10.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id F06D01121306; Tue, 19 Mar 2024 15:53:54 +0000 (UTC) Message-ID: <9b4f3dac-779a-4eef-945b-3ca1455c0dfe@redhat.com> Date: Tue, 19 Mar 2024 11:53:50 -0400 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: [PATCH] Locking: Let PREEMPT_RT compile again with new rwsem asserts. Content-Language: en-US To: Sebastian Andrzej Siewior , Matthew Wilcox Cc: linux-kernel@vger.kernel.org, Boqun Feng , Ingo Molnar , Peter Zijlstra , Thomas Gleixner , Will Deacon , Clark Williams References: <20240319070550.ws_uO21-@linutronix.de> <20240319141506.DUd9NKl4@linutronix.de> From: Waiman Long In-Reply-To: <20240319141506.DUd9NKl4@linutronix.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 On 3/19/24 10:15, Sebastian Andrzej Siewior wrote: > 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()? Just merge rwsem_held_write() into rwsem_assert_held_write_nolockdep() and we should be all set. Cheers, Longman >>> { >>> - 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 >