Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1214pxb; Wed, 1 Sep 2021 19:59:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4jrLHWho1P5Drxlxyk1MjOAyyAMNYyRifsIM8EAX5NQGhHen9gsZzR2xE03D0fzVHMTYd X-Received: by 2002:a17:907:1c1f:: with SMTP id nc31mr1188069ejc.371.1630551553025; Wed, 01 Sep 2021 19:59:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630551553; cv=none; d=google.com; s=arc-20160816; b=Dizj7kHpqOXnqmA/b+ofHT4Im8MYpHbHbpPGTGhnhLKT3SCjL76jB2YQPnoCeWE4Hz Doz58ERtdUdjBV0UjVPFC9nGqPbb6QomvJmjUN2Z/XzPKY31oyno/gl+jWUw0/aVFIVQ 91n7ePrOIpIvScc2UZbtrTMaAXtSk2fNz+N7EyKiSf6ibk0U1dL93KZKvacsz5kLX13f VGmFv/XJWZld7SPDcXpfrQ+Jo72bE0D41r0zgu3/0wlGLJgn8X526ydxoir2raI5T6Du P8t0ULruS1BSXUd9qPlJfcByAmDmdpk7T3PZEsy8r/nhUT28Kg2axbEuBm5NcJa2/J6Y 2KoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=QgMOwm7NKew0J4RmeQauoc1vUVslFplE2WjbejP4Sjc=; b=NhlfsF7RrCoyqE/a1/lK7vpp7YN0ZEWnHyFuSPbHfkRXlxTXIF48uNNrwZsGTZ4uHf hqHOWHd2oCkY83N+Lw9UGjnvDd+2c3DZHdcTv5M/fExrOLgr7ultGzEar/7NKVwXEd04 cT/tUKt6Gy27lkdxGD6/RgMGKbsj4E6MrMKnqIZPR5/CyX4WWvyMOW/at3wSlN+vmMQF A+SfTf/1SqYM5CMK6SIid2DebPSrVSQBvZwoKl07tC6etq1D332Z3l2yVLTF9i2DOXyg PHmM8DqEd051nGkgW4g1EJ1hZ0wv48J9IxgZs5HXCBM/PvCeYPWqO4gzPkwIlBDsQPzn 7oWA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e10si980176edj.222.2021.09.01.19.58.32; Wed, 01 Sep 2021 19:59:13 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232949AbhIBCSK (ORCPT + 99 others); Wed, 1 Sep 2021 22:18:10 -0400 Received: from smtp21.cstnet.cn ([159.226.251.21]:37760 "EHLO cstnet.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232666AbhIBCSJ (ORCPT ); Wed, 1 Sep 2021 22:18:09 -0400 Received: from localhost.localdomain (unknown [124.16.138.128]) by APP-01 (Coremail) with SMTP id qwCowAB3WHEKNDBhDMs2AQ--.59037S2; Thu, 02 Sep 2021 10:16:43 +0800 (CST) From: jiasheng To: linux-kernel@vger.kernel.org Cc: jiasheng Subject: [PATCH 10/10] seqlock: Add do_read_seqcount_retry() in front of seqcount_lockdep_reader_access() in read_seqbegin() Date: Thu, 2 Sep 2021 02:16:40 +0000 Message-Id: <1630549000-3731606-1-git-send-email-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.7.4 X-CM-TRANSID: qwCowAB3WHEKNDBhDMs2AQ--.59037S2 X-Coremail-Antispam: 1UD129KBjvJXoW7tFy5ArWDJFW8Xry5uFWDtwb_yoW8JF43pw 1kury8Kr4FkF1xuayDJ39FvFyrtwn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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We have found that in the complied files seqcount_lockdep_reader_access() appear more than 20 times, and under at least 90% circumstances that do_read_seqcount_retry() and seqcount_lockdep_reader_access() appear in pairs. For example, they appear together in the irqfd_wakeup() of the file complie from 'virt/kvm/eventfd.c'. But we have found that in the read_seqbegin(), there is only seqcount_lockdep_reader_access() instead of the pair. Therefore, we consider that the do_read_seqcount_retry() might be forgotten. Signed-off-by: jiasheng --- include/linux/seqlock.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h index f61e34f..14169ce 100644 --- a/include/linux/seqlock.h +++ b/include/linux/seqlock.h @@ -837,8 +837,10 @@ typedef struct { */ static inline unsigned read_seqbegin(const seqlock_t *sl) { - unsigned ret = read_seqcount_begin(&sl->seqcount); - + unsigned int ret; + + if (read_seqcount_retry(&sl->seqcount, ret)) + ret = read_seqcount_begin(&sl->seqcount); kcsan_atomic_next(0); /* non-raw usage, assume closing read_seqretry() */ kcsan_flat_atomic_begin(); return ret; -- 2.7.4