Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp3208821ybh; Sat, 25 Jul 2020 15:10:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtYaCNTJ0MsN58NUyHg35VsBHN8/d4Kf1UwmLLW7iQ1zlBKy83WKxEahKQTIQtZH6XF5Rw X-Received: by 2002:a17:906:3ac4:: with SMTP id z4mr14119176ejd.65.1595715026312; Sat, 25 Jul 2020 15:10:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595715026; cv=none; d=google.com; s=arc-20160816; b=BiuXJvxzrdpdk9gsVqoQ1XxZMvw/L6N3I373gReqrgdIdGuBDvy/PJYjeB/MP10O/d QPoJ2ZUH1d/qRVm1nyswV2n9SiN9iOY+jGLpNKdv8BTlEoXoNnOXZRnFFzlYY8XIViMA DXE8c19ugVz9B1aJTPJxWUUlmz4cCjit2CP5XS0hzBwGpQ57g6oeYIN+gRaKod+mcYoo sqww6rl/5+/+v0HKWOP6jsJB6pv/hygK8sSM4lm3nEH1qiSQOYiSC9oLOGEmpSxC1mVW u5ZosZ/tgysruQldYkDHT9CIJBKu4e5REPm0YJJCb9Y7i+V0cwyQFBceJy9zYVPlSt8+ gjWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=6C0F6wmLKV8+bswy9QMLQsjcbgQUJc1tcHq4/eNHgVs=; b=lH1cmRAWLryrIY8LBtEgQEixEEUqY5i578uNRwIe2rkPse7ovyyVucqPH1XwfGAWNj BrN21D+6o/k2DcygIqcOo/TjhHCzQDe7aW/OIFlsQhr82NkskVImUJ1WRHtYX3E1ADvL 4Pg5Z7g8KrfNmLwJMlk05LR9h51G8CRyLNgQv7cHEkP6d72XlQjaxMzQfByZ0eszU2IF Of9JQWYu6J0mwv9JXkayXmDIpSScAr3asRvvpzoWLzlj3xFaALRjNh7o0XaxVJ84GLpq nXjV4mcOuff7WJ9flPHK96EkYA3HIjuOu58+JQjLbvOqykt4kXrqpWbYk3yKSn+v7Gbv YP/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=efq8CSlT; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bx8si2815915edb.170.2020.07.25.15.10.03; Sat, 25 Jul 2020 15:10:26 -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=pass header.i=@kernel.org header.s=default header.b=efq8CSlT; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727957AbgGYWHv (ORCPT + 99 others); Sat, 25 Jul 2020 18:07:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:51914 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726926AbgGYWHv (ORCPT ); Sat, 25 Jul 2020 18:07:51 -0400 Received: from paulmck-ThinkPad-P72.home (50-39-111-31.bvtn.or.frontiernet.net [50.39.111.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 758AC20663; Sat, 25 Jul 2020 22:07:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595714870; bh=AlMyIIkUYdkMEf9k/MgUwkj3Brxoh7KvszXwKDV1774=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=efq8CSlTgBFCRntwHutc9xUTzBypUSo8HSNxGPySj1yWeFPRQKWzPe6cjctCFMOR4 Pv0cTU1pqBF22dVZkp28B6x7WLs6AuE3XXslgX8/zDzijVD0zkM0Lg9e5pCpOMdA1/ O6W0mUCe7XGXx4ZrutPB/7RzyhddqagNsXpv3aqc= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id 427EE3522767; Sat, 25 Jul 2020 15:07:50 -0700 (PDT) Date: Sat, 25 Jul 2020 15:07:50 -0700 From: "Paul E. McKenney" To: peterz@infradead.org Cc: Marco Elver , Andrey Konovalov , Alexander Potapenko , Dmitry Vyukov , kasan-dev , LKML Subject: Re: [PATCH] kcsan: Add option to allow watcher interruptions Message-ID: <20200725220750.GC9247@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20200220141551.166537-1-elver@google.com> <20200220185855.GY2935@paulmck-ThinkPad-P72> <20200220213317.GA35033@google.com> <20200725145623.GZ9247@paulmck-ThinkPad-P72> <20200725174430.GH10769@hirez.programming.kicks-ass.net> <20200725193909.GB9247@paulmck-ThinkPad-P72> <20200725201013.GZ119549@hirez.programming.kicks-ass.net> <20200725202131.GM43129@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200725202131.GM43129@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 25, 2020 at 10:21:31PM +0200, peterz@infradead.org wrote: > On Sat, Jul 25, 2020 at 10:10:13PM +0200, peterz@infradead.org wrote: > > On Sat, Jul 25, 2020 at 12:39:09PM -0700, Paul E. McKenney wrote: > > > > This gets me the following for __rcu_read_lock(): > > > > > > 00000000000000e0 <__rcu_read_lock>: > > > e0: 48 8b 14 25 00 00 00 mov 0x0,%rdx > > > e7: 00 > > > e8: 8b 82 e0 02 00 00 mov 0x2e0(%rdx),%eax > > > ee: 83 c0 01 add $0x1,%eax > > > f1: 89 82 e0 02 00 00 mov %eax,0x2e0(%rdx) > > > f7: c3 retq > > > f8: 0f 1f 84 00 00 00 00 nopl 0x0(%rax,%rax,1) > > > ff: 00 > > > > > > One might hope for a dec instruction, but this isn't bad. We do lose > > > a few instructions compared to the C-language case due to differences > > > in address calculation: > > > > > > 00000000000000e0 <__rcu_read_lock>: > > > e0: 48 8b 04 25 00 00 00 mov 0x0,%rax > > > e7: 00 > > > e8: 83 80 e0 02 00 00 01 addl $0x1,0x2e0(%rax) > > > ef: c3 retq > > > > Shees, that's daft... I think this is one of the cases where GCC is > > perhaps overly cautious when presented with 'volatile'. > > > > It has a history of generating excessively crap code around volatile, > > and while it has improved somewhat, this seems to show there's still > > room for improvement... > > > > I suppose this is the point where we go bug a friendly compiler person. Sounds very good! Do you have someone specific in mind? > Having had a play with godbolt.org, it seems clang isn't affected by > this particular flavour of crazy, but GCC does indeed refuse to fuse the > address calculation and the addition. So there is hope, then! And even GCC's current state is an improvement. Last I messed with this, the ACCESS_ONCE()++ approach generated a load, a register increment, and a store. Do you still have the godbolt.org URLs? I would be happy to file a bugzilla. Thanx, Paul