Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2648454pxb; Tue, 23 Feb 2021 11:57:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJyXP7ajE1X3PXpFYt4G6p1dUXTLLJB6gnkKoxrWVKW7X2Y0HpBIjj9zkkmD+koEGEdfzPS2 X-Received: by 2002:aa7:c308:: with SMTP id l8mr30153534edq.366.1614110264558; Tue, 23 Feb 2021 11:57:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614110264; cv=none; d=google.com; s=arc-20160816; b=ElFPBnG8430kzZLcP2YVyYvm1Q62ODd/4QpRQMM0z6xHRprCIvvo5PdVazTioJWU8j 4IbYUnWGn7arYSZhx1vEn9Esa6L67CEbJ8PtbT4rbbwh742ApsCTohMJ0CwQERPFwN5f iEL1K0l1Qgh5noRWGIMZAh2QpfTvlQkFIsUbMSfwHQExl7fP9uRNrFiT2KRzzpypUxHz 2SUjKUpPso3Ba+QqtQ9jSovk3gIZ1I9MYwPFylZxT7rMDxGB5w4OYKH4Wma1V1lSCQKU vuLJMEAtMPTpp6LpuDjeIPAQ+LYD6m7QdKqRkKmqKvPO3rNdHDYoA7bO044eV4XKM1CZ 2mHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature :dkim-signature:date; bh=teDU304o4orU9wi3x1wUaMwyYWDTSBXOaHNrx5ClT0w=; b=fO9NdDqRSaXw4jlg/G116er7Hb460IrULV8Nnx+WPGdolPHsotdWH4iEFi3B3CAzG/ 0sirm2A/F8lMGQJcZa0m1oHCPiYZrrgFbCr5P83QzPZ0L6vKZGms9vzuC/Xgpgpxxmvn t24zXrAEomyprgC3uwXqweBTMBrlKOy4ezHUeg6jr1/4MHcoHFpaWpPLjrZGmMYb4dEO qU9cXZ4Yt/kIYvBt+Juiyw46iUTT3Oql03xz9pyYEiRl53gCeXjTULOHlTnc43hKGvVU dBlTBMRzUiBlcoWEKmyN/KBepnNMgXuFup9FUZIj6I8K4XZfEF1E2KLyc88vghTop5gd obAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=2ZFBXIkV; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i12si5645728edr.277.2021.02.23.11.57.21; Tue, 23 Feb 2021 11:57:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=2ZFBXIkV; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232440AbhBWOWH (ORCPT + 99 others); Tue, 23 Feb 2021 09:22:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232533AbhBWOWC (ORCPT ); Tue, 23 Feb 2021 09:22:02 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C5E1C061574; Tue, 23 Feb 2021 06:21:21 -0800 (PST) Date: Tue, 23 Feb 2021 15:21:18 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1614090080; 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=teDU304o4orU9wi3x1wUaMwyYWDTSBXOaHNrx5ClT0w=; b=2ZFBXIkVYYN+nfCFMhN/kFjRVgHW8puY2SXmz4LEKGGgLUncGkXWOrZSwoCghFhYtR+0B+ WtPmbg5RS4xdWq4hxg1404dlLYeX8B1nl0sqxT/iSdGPS8B9+EQX6bJrSz60txeX1elHLY UJuc7DdwyciRZtLdZ7N2eL0hXxoiKyZFSWSOa+CpigNZAQxC6YaEfZPpDLl4v/qWuEXt75 hQJzYWVPVm0s4qW06fwuBPD49s1CfD4EOueDsOPESr9YTIyMw7koMtkWSNCgwafaW+0GHl qIGWtjJp/HvT7g0wY3dOI9iiT82sEd1QG7g7UFBrvA7otZ+CLf2L64NjiYndRA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1614090080; 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=teDU304o4orU9wi3x1wUaMwyYWDTSBXOaHNrx5ClT0w=; b=4c33A1S2mV08nn7HeTxSpQILp2jnu0Nz6hii5AhOHt0Qbh5Zt3CCoH3QqXLLwQn84Nitl1 HnqJztvf+r2WUzCg== From: Sebastian Andrzej Siewior To: Juri Lelli Cc: linux-rt-users , LKML , "Ahmed S. Darwish" , Peter Zijlstra , Thomas Gleixner Subject: Re: [RT v5.11-rt7] WARNING at include/linux/seqlock.h:271 nft_counter_eval Message-ID: <20210223142118.u22yhw3ku4ttx5hq@linutronix.de> References: <20210223110015.ybl7feu43wvtjoqu@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-02-23 14:53:40 [+0100], Juri Lelli wrote: > > So, I'm a bit confused and I'm very likely missing details (still > digesting the seqprop_ magic), but write_seqcount_being() has > > if (seqprop_preemptible(s)) > preempt_disable(); > > which in this case (no lock associated) is defined to return false, > while it should return true on RT (or in some occasions)? Or maybe this > is what you are saying already. write_seqcount_begin() has seqprop_assert() at the very beginning which ends in __seqprop_assert() in your case (seqcount_t). Your warning. > Also, the check for preemption been disabled happens before we can > actually potentially disable it, no? That seqprop_preemptible() is true for !RT for mutex/ww_mutex locks. On RT it is always false since it does lock()+unlock() of the lock that is part of the seqcount. But back to the original issue: at write_seqcount_begin() preemption is disabled !RT implicit by local_bh_disable(). Therefore no warning. On RT local_bh_disable() disables BH on the CPUs so locking wise (since it is a per-CPU seqcount it should work. Preemption remains enabled so we have a warning. I have no idea what annotation would be best here. Having a local_bh_disable() type of a lock and the seqcount is not part of the data structure it protects is less than ideal. However, if I understand this correct then this nft_counter_percpu_priv exists once per nft rule. The seqcount exists once per-CPU since it is unlikely to modify two counters at once on a single CPU :) So there is that. While looking at it, there is nft_counter_reset() which modifies the values without a seqcount write lock. This might be okay. > Thanks for the quick reply! > > Best, > Juri Sebastian