Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1171677ybg; Wed, 29 Jul 2020 07:35:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwY37Vnsb0ueTn5fqpvllyGjG3tIxmVC0dFgv6hQykwHSkgXrKMI+ZCkHUS4KH0lKuolHq7 X-Received: by 2002:a17:906:743:: with SMTP id z3mr30390963ejb.216.1596033335715; Wed, 29 Jul 2020 07:35:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596033335; cv=none; d=google.com; s=arc-20160816; b=Gu8C1kHzKc3sPHIgbpXHeoplYHfZfxX1zuvf86lw8cdizcWPLFWzcyJqrC8oWdMyCC gCNmyJd/8QhDKpIKehzwbthUlMl1q1a+zYGi7sW9VawMelV3aP7JgvrqGAyCYSDH2bbH 6E1bVwjePca6tC6hUHr1ITIgUH5A42LdBSTVjwkyVszuN9lFbFCa8F823JcWNNE+LByZ V9kJq9bRFcrZNWrjwLSE+Dt62R4sn5z20R14z8N7XFVW7REHuYYDSNXqlBbdzCrl0Cfa UPKQhe7nusdEOe8frdXD+hboqcD+9z0Bm8jcd/mVWRP/wXlnre2anEyAYHbsHmHY7aCT 2sUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:dkim-signature :dkim-signature:date; bh=+21/d33zSJQzOrFuH9hDP7UKKlTattNthwOTTDKc/Z0=; b=I+bG6drQB5/upKpGy7KN9EGgVFZ6RKDL97nU2nZlyboEUkjnUzwf2A6PW2hZS8C1YN oTPssFDo6E1Fm0nuyjLS4l72oFs1+btZG3XUmJgekOzdWymbYD497leCOB88URfMQpTU Yi9GUXmKAr4wteE4jINDcx/hiaHGGirUNhLlX7iUVuPwyh4lShT7PZdiy4squ64DFk/a QF08zQcVuLzB9xuFGmUoUIcM1naql/ZKDBdYGvymB9RQjSLVxZpozaSGTQ22lfX2/XZI DvQ3OGdzNx4U8iBdiUsYtsiTr5X2iP73IMlJ3iMniuOsQxC9mfrIpBQHlDRKf47kpj/E pXTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=MLvWqUUn; dkim=neutral (no key) header.i=@vger.kernel.org header.s=2020e header.b=2gJ0v1qS; 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=fail (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 p22si372021eds.169.2020.07.29.07.35.12; Wed, 29 Jul 2020 07:35:35 -0700 (PDT) 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=fail header.i=@linutronix.de header.s=2020 header.b=MLvWqUUn; dkim=neutral (no key) header.i=@vger.kernel.org header.s=2020e header.b=2gJ0v1qS; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727113AbgG2Odm (ORCPT + 99 others); Wed, 29 Jul 2020 10:33:42 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:42938 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726971AbgG2Odg (ORCPT ); Wed, 29 Jul 2020 10:33:36 -0400 Date: Wed, 29 Jul 2020 14:33:33 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1596033213; h=from:from:sender:sender:reply-to: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=+21/d33zSJQzOrFuH9hDP7UKKlTattNthwOTTDKc/Z0=; b=MLvWqUUnGhEtzsxIqWVpWYz3GHrA2SIoArx4KdgGNIjxiRofnbmFhzXUlV5ci5gd+zc0ix KzC9fOjxMgMorvdCSrYTkCGlwh6fkoCuDHSM/TdDvMC+E6ea5N7wmdZ5CS3fdN+wummEDj 5lT5c6BqHrGPB03wl2pm8sjzIgRWItJuTu31zWf+EsmLELnSDDrHMleK49J9AGW8f3tHcm oTWGjpgiXgJ3anQuIaIW0TpiIYqwutkSrL7sBZ5xpnqhQPWwyCq+1314EZpBvEDxh2gjrJ tYkNk8kIspQ8huRmnpiYVz4fZXzChgVOsDQ90ecMmr1OdgesE0fASCg14aB3mA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1596033213; h=from:from:sender:sender:reply-to: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=+21/d33zSJQzOrFuH9hDP7UKKlTattNthwOTTDKc/Z0=; b=2gJ0v1qSuRsBDL/G4fw3Zs7KFpwocLsWGzErJyY/K6Cb+1d2QEZf2SFYpmFcdozE8dk2N0 QnVZ/p7gc+8cptDA== From: "tip-bot2 for Ahmed S. Darwish" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/core] netfilter: nft_set_rbtree: Use sequence counter with associated rwlock Cc: "Ahmed S. Darwish" , "Peter Zijlstra (Intel)" , x86 , LKML In-Reply-To: <20200720155530.1173732-16-a.darwish@linutronix.de> References: <20200720155530.1173732-16-a.darwish@linutronix.de> MIME-Version: 1.0 Message-ID: <159603321315.4006.14315455150696649562.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the locking/core branch of tip: Commit-ID: b901892b51317b321c7bc96e2ccd2f522d1380ee Gitweb: https://git.kernel.org/tip/b901892b51317b321c7bc96e2ccd2f522d1380ee Author: Ahmed S. Darwish AuthorDate: Mon, 20 Jul 2020 17:55:21 +02:00 Committer: Peter Zijlstra CommitterDate: Wed, 29 Jul 2020 16:14:26 +02:00 netfilter: nft_set_rbtree: Use sequence counter with associated rwlock A sequence counter write side critical section must be protected by some form of locking to serialize writers. A plain seqcount_t does not contain the information of which lock must be held when entering a write side critical section. Use the new seqcount_rwlock_t data type, which allows to associate a rwlock with the sequence counter. This enables lockdep to verify that the rwlock used for writer serialization is held when the write side critical section is entered. If lockdep is disabled this lock association is compiled out and has neither storage size nor runtime overhead. Signed-off-by: Ahmed S. Darwish Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20200720155530.1173732-16-a.darwish@linutronix.de --- net/netfilter/nft_set_rbtree.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/netfilter/nft_set_rbtree.c b/net/netfilter/nft_set_rbtree.c index b6aad3f..4b2834f 100644 --- a/net/netfilter/nft_set_rbtree.c +++ b/net/netfilter/nft_set_rbtree.c @@ -18,7 +18,7 @@ struct nft_rbtree { struct rb_root root; rwlock_t lock; - seqcount_t count; + seqcount_rwlock_t count; struct delayed_work gc_work; }; @@ -523,7 +523,7 @@ static int nft_rbtree_init(const struct nft_set *set, struct nft_rbtree *priv = nft_set_priv(set); rwlock_init(&priv->lock); - seqcount_init(&priv->count); + seqcount_rwlock_init(&priv->count, &priv->lock); priv->root = RB_ROOT; INIT_DEFERRABLE_WORK(&priv->gc_work, nft_rbtree_gc);