Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1463577lqo; Sun, 12 May 2024 03:54:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXcJztYwjhSwEyYS9qGUCHGci8hbueFVOfHfQqtWQ42JZ1Os/k6kP4n81QuaPRd06WZnWHKtYX77Xx8YbIJ2cQXst6V86kskesbEU4fpQ== X-Google-Smtp-Source: AGHT+IGGowMrE3Aij9RVe2PdtE67oLihEcyTCjxbftjdXmtOve5Eyz0yhprFHMJOCE+hwrEFWgQ6 X-Received: by 2002:a05:6e02:19c9:b0:36c:c64d:6aa5 with SMTP id e9e14a558f8ab-36cc64d6aebmr71180385ab.12.1715511296635; Sun, 12 May 2024 03:54:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715511296; cv=pass; d=google.com; s=arc-20160816; b=UovtQRw//uZMSNAsU3n+Vgvcq42/xoOm+T2YK45xM3nEsndILoFoDCUeX2ar7sU9nA zma1baefzO68jULhjeRFWJd5igRU27bXwljmjLy7HdQGjh8JUHaUwA4RPOizJwKh/ZT2 IrR6vSMfUsrgDt5KOXL1z/RAuvTwm7uxtG40Awp8LYbrP7eA0X2kCd7yGDYTSPmleCtP 6w585wvzR1DEPzK+k2OsENeskTZM5DvQzXGT6RrFrcCrXHhyu6kSXy53Gm6szgpQ4k+J NLIado6lwmkyx4yGtvA3sDzV0brq4Nrn8BsCTqo3DwPJmpH/3EfglEJ60cnpbkx8S6h9 LpZw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=FgfZ7MMddRAMv9DIXeUM0DVSkJbLcO39LCEJxsq64jI=; fh=LMiQG8eTLzf1SyU4W+POK32JVDLYXD5v2M9mE6EPfzs=; b=VhWfA58rktMamGbetdFl7vKdwdOgySJix+5i2f8Ur04tIT1SBLQoDz7WU//793Z/ru dzheIkUiSkOez17/IGKpc6QDut1hmGVyY6E3WxCbwvh6kaKyGmQaMeHi+jAn+97h5zZM SbuBybJ0w8J+FwbACetgInZXqNN3DjKFFrQicq2axV0AayIOSnTkIDYfGlAwlevLDI92 N51zGAjCO5NUVsmlAu2fBqSr38bFdF09sf/dHBPBZ2bb8ZGo+gHzDU9XGvkokrKhWXoI kWkV1whLaP+vdsxg59HU7pCAxCrjXUs1PceDNy9HGDhYiJRtOhC8Wat7qcf66PcQgFwm xAUg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="eV8KnXU/"; 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-176854-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176854-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-63411530614si7751704a12.442.2024.05.12.03.54.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 May 2024 03:54:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-176854-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="eV8KnXU/"; 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-176854-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176854-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 5B616B20E42 for ; Sun, 12 May 2024 10:54:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2FA531CD2A; Sun, 12 May 2024 10:54:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="eV8KnXU/" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 A770A1C6AF for ; Sun, 12 May 2024 10:54:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715511285; cv=none; b=io1IoliXc2muMpZzXFatoFO+2ZuEd63twWCPXSvrwYDZB+45AnSoB8l9JRK8J4ZweXXhL93b0ZCr4XlXc0qxJ0MWlPNObwCDj8WJ5pwAf14si5yZTaBf3EpT7yd4gWrKYiGfIaHYNdKDdHz1l8oIRy9UBeFh6rtHsR0SJe37LAs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715511285; c=relaxed/simple; bh=Emhf6vrwUmC6hxGQSQMrHGanPXhs5hnepzdRayKbrIk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KugB72sCgqFgmSW1086ZXypDTl7k6QRIOvv1wzHvW22FFWFtkRulTY446Anx/E6pIripsnRdAdBLsU+jY9+G/wr2fems788JCy2aXt3vfsU7sYr4Kk6orZRAXZIpTc2ljuoR/x8PdPNG8Rlo3M2aDvxQvPV6GGq47RssUjmXVxs= 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=eV8KnXU/; arc=none smtp.client-ip=170.10.129.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=1715511282; 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=FgfZ7MMddRAMv9DIXeUM0DVSkJbLcO39LCEJxsq64jI=; b=eV8KnXU/q9y/P6+AiwvLvXgn5FsaAoLpHl2Gg2WqpFYrEbi58y0E+MFOfVNwOoErCwjUv7 Hk+GAEO0Iys66ATVJJO4HpHXg8fT9l89izubtg+CH4sjT/tMBG3GFCZCW+wI551nZ6Wr0m 72U25/KC9X6Io32+YL7TQH09R0mHvHY= 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-659-oMn9CDSXMs6qPNq8DMF9Jg-1; Sun, 12 May 2024 06:54:37 -0400 X-MC-Unique: oMn9CDSXMs6qPNq8DMF9Jg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (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 9DB84800206; Sun, 12 May 2024 10:54:36 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.224.31]) by smtp.corp.redhat.com (Postfix) with SMTP id 2643A966; Sun, 12 May 2024 10:54:32 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Sun, 12 May 2024 12:53:10 +0200 (CEST) Date: Sun, 12 May 2024 12:53:06 +0200 From: Oleg Nesterov To: "Paul E. McKenney" Cc: "Uladzislau Rezki (Sony)" , RCU , Neeraj upadhyay , Boqun Feng , Hillf Danton , Joel Fernandes , LKML , Oleksiy Avramchenko , Frederic Weisbecker , Peter Zijlstra Subject: Re: [PATCH 25/48] rcu: Mark writes to rcu_sync ->gp_count field Message-ID: <20240512105305.GB7541@redhat.com> References: <20240507093530.3043-1-urezki@gmail.com> <20240507093530.3043-26-urezki@gmail.com> <4c9e89b5-c981-4809-8bc2-247563ce04e9@paulmck-laptop> <20240509151312.GA22612@redhat.com> <20240510113149.GA24764@redhat.com> <8ca02df3-5034-4483-8e64-3fc22eb14431@paulmck-laptop> 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=us-ascii Content-Disposition: inline In-Reply-To: <8ca02df3-5034-4483-8e64-3fc22eb14431@paulmck-laptop> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.1 On 05/10, Paul E. McKenney wrote: > > On Fri, May 10, 2024 at 01:31:49PM +0200, Oleg Nesterov wrote: > > > Why is that? > > Because I run KCSAN on RCU using Kconfig options that cause KCSAN > to be more strict. Yes, I see now. > > but how can KCSAN detect that all accesses to X are properly marked? I see nothing > > KCSAN-related in the definition of WRITE_ONCE() or READ_ONCE(). > > The trick is that KCSAN sees the volatile cast that both READ_ONCE() > and WRITE_ONCE() use. Hmm. grep-grep-grep... I seem to understand, DEFINE_TSAN_VOLATILE_READ_WRITE. So __tsan_volatile_readX() will use KCSAN_ACCESS_ATOMIC. Thanks! > > And what does the "all accesses" above actually mean? The 2nd version does > > > > WRITE_ONCE(X, X+1); > > > > but "X + 1" is the plain/unmarked access? > > ... > > In that case, the "X+1" cannot be involved in a data race, so KCSAN > won't complain. Yes, yes, I understand now. Paul, thanks for your explanations! and sorry for wasting your time by provoking the unnecessarily long discussion. I am going to send the trivial patch which moves these WARN_ON()'s under spin_lock(), this looks more clean to me. But I won't argue if you prefer your original patch. Oleg.