Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp293732ybg; Sun, 26 Jul 2020 04:53:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUANFc0BGigcp4CGIV0F0BIxuOLO51UvIng6HwXWbjuAzLHy3BVpvOUzJlW16mGxZJ3GFY X-Received: by 2002:a17:906:364a:: with SMTP id r10mr16549791ejb.122.1595764424726; Sun, 26 Jul 2020 04:53:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595764424; cv=none; d=google.com; s=arc-20160816; b=NoudwbWgvEWuAU7PXrwJHaWCgsrhwGx2Val5cYeKVyIY/Vcc4OiSaE+lKXUEE9I7RR ZXW96ZsA404/o0V9ke2G6WhhOOqnwShgeh1QYtqngSuPBvP5AwBySdOmpaASQ3Q/BPrO aSnhA97fLOrGq7xh1QOm8pMQIwmH86w17X6eNzTSk1kkAUlRgxdKBANlPR7CLQUJwmOa MNp+m2C4y3fWKN/zfV81k8uMnnZQeNhLGbh1RJJKyzveFDK+j2M0sfqI9rfc7lwcYM1H neLZAk/GQFandCPXxoxPjPxbuIwRG7Czsy3pfKmU1y836vCrlUWUpLD40tWgCA//UIcu aaPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=KjnRKLEHDr8Ifsf9arCUZI0KOq8oLtgssys0oHriYEo=; b=fq+xqzHhtmtXuJ5I6/hN+pfyJe5w3Sf5SBKVDZPrPZrFIuEwdqczf0P0z0MDEb1yBz YDsUt8UqTq28yD2ecAeKRCZ00+dviRs1YovDCrsZw9WXqy9RBbT938OGY80q4/yyIneL N+0OnkhAHfCzNkmNkM/tndkO0mJSa5GH0qojEamxhhKXJoZGWBrL9nqiBikSo7Rgmnjo J7dpLyGMDAJ7xyCc+iGpHdoLEuCENQ06de6hCB/Zj5MUZYc5fiWLIbjHsf4YHmsS86b5 jfrbIkHgzbeyBDBIJckwXyLlu5B7BqCylX4NdDoFL3AtG9remW0CefUDaFW6fPoQeW4E PvOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=2TtrIcN2; 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 t22si3798101edr.571.2020.07.26.04.53.22; Sun, 26 Jul 2020 04:53:44 -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=@infradead.org header.s=merlin.20170209 header.b=2TtrIcN2; 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 S1727091AbgGZLww (ORCPT + 99 others); Sun, 26 Jul 2020 07:52:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725972AbgGZLww (ORCPT ); Sun, 26 Jul 2020 07:52:52 -0400 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D782BC0619D2 for ; Sun, 26 Jul 2020 04:52:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=KjnRKLEHDr8Ifsf9arCUZI0KOq8oLtgssys0oHriYEo=; b=2TtrIcN2jOiRX3Q/kYQ11GmmlL WYx+GA09hXwgczIdN8KelbmcJK2ULiU7Ni1+sCobXjmuRtUBzmcs8CqTx3LnsjLQ6yGZklkMcuLOX mYH6xES74KhqiWQVVpZBBpSYPzjN3/lFBFabJWWG8gJ+dOVw5vW8SkRoPq82hnJ4yn69OtOD1ar3E OawOJoranHOkFWeHr2TLrLdDFXdqOpCOQ0WztALrMCHP7bG6yCllPPjjmf7Yy70ndXeZFX47u206H rZIfuuxzZcShaxu6KIHptWPMZvzKYB8HgDj8q2TyY8mloimv+Im7wno4Y524zY/0mWcuQdaYBJwBb bIKMnybQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jzfCv-00086M-D6; Sun, 26 Jul 2020 11:52:45 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id D0C1A301AC6; Sun, 26 Jul 2020 13:52:42 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 279DC2141FBAD; Sun, 26 Jul 2020 13:52:42 +0200 (CEST) Date: Sun, 26 Jul 2020 13:52:42 +0200 From: peterz@infradead.org To: "Paul E. McKenney" Cc: Marco Elver , Andrey Konovalov , Alexander Potapenko , Dmitry Vyukov , kasan-dev , LKML , jakub@redhat.com, hjl.tools@gmail.com Subject: Re: [PATCH] kcsan: Add option to allow watcher interruptions Message-ID: <20200726115242.GA119549@hirez.programming.kicks-ass.net> 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> <20200725220750.GC9247@paulmck-ThinkPad-P72> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200725220750.GC9247@paulmck-ThinkPad-P72> 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 03:07:50PM -0700, Paul E. McKenney wrote: > 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? Jakub perhaps?, Cc'ed > > 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. https://godbolt.org/z/rP8rYM