Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp808657ybk; Wed, 13 May 2020 13:44:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxVocWdxNNfdus8qDaB2xo1ad854cZ7/c7FT2B2bMs1AbLry2b6cl92Tw+QJeCY4ogUdsU X-Received: by 2002:a05:6402:1f6:: with SMTP id i22mr1344451edy.271.1589402687243; Wed, 13 May 2020 13:44:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589402687; cv=none; d=google.com; s=arc-20160816; b=gyp14OKPMWltEJPOwUewYX1eXrKcyXdQSp5WWAuuuPng+mr9yqKcwFIkwHc6WMEAfA 5gYaQDUOgjxmz5k9sYSJvdtQRtZEQ9e88ct7GakcXvCrZSSgLhux23zOh7Am2wz5kNqH 3xnCeHcn8Ign/mg5DGFDv/aOEBz4WH8VnFJYIy9Lmg/K6WeNZ3RAI+/RD+OVS3zTe70V VxnOFBs3C4ea0ZpP3+NuWjAKQLvTKf4p+QEowBgm4LNzncid7TrxjTxK0H/l4Yf3SvBO AL52eZfWSmSIfLyR3LW4+DVc8PhV5JyFBNjNUi23/2Ec9ezFIt5qM/dQ24rqXs51hWqI CEmw== 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=0A+CA41zwy6qhmtprl6gwc/xxp4FPDpIHB/1ri3llcQ=; b=vSEPqvXalhDavcaNk92hlRBL/T7HcNBZeMx8RF4AxJyRpWx1rpmBYVpfySttJLGg26 B/cYwJA+nU/tlwgUVwE9rKOtEvsNezzz06DVN987MUQPpbct58eqN2Ev2bUPR16isGlk R87FYJzEuyekJcDp1jGuCLPWf7MazaJbtUMN+rgZfHKU3JgxGHYivSDCtR5AUPrw/NpF 8QLQlm5zwkF4ZHwIlePn3Qw0GMBjFDHTbbMeeAYJbyGkvzg+8ooD6m1YIPdt7xH6DGDR QhgLWJU2utWW4hiO4u/gyiyTTcqQ5NnWYQVSF6oWJma/J2aocfDw2Ta8AVdaoGaBPLJV 2dyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="RxMSWSe/"; 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 h4si79890ejq.164.2020.05.13.13.44.25; Wed, 13 May 2020 13:44:47 -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=bombadil.20170209 header.b="RxMSWSe/"; 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 S2387554AbgEMNYu (ORCPT + 99 others); Wed, 13 May 2020 09:24:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733225AbgEMNYq (ORCPT ); Wed, 13 May 2020 09:24:46 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88F5AC061A0C for ; Wed, 13 May 2020 06:24:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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=0A+CA41zwy6qhmtprl6gwc/xxp4FPDpIHB/1ri3llcQ=; b=RxMSWSe/SQPWxkwYFAl/1GORyC XVZHwka/U74+TVDM6QOl2gzO0C/Fl7k99wrfLX/iwbqe272E/kO9o/J16mlbj2VKil2YaFmcUggEz OsYjAu2eSVyAik66f++0rIv8a73D5F6mWxPT0oPeqr4PnL8PjL1gGVqkb3oxEbTMQOPV21gdnLpJf iJajonJhkjbhxBljD+CNm0jYlNiaOHmE1Wh+KIIGSHDoANTCt1l33lfkl4Esno8oxlTveikdMa4h4 XGd2+nwoOQJzLOqU8zLEUNXG1zQjD1kg2rbrXposDmXddc14pXuwG17kod8diQaCuT1COG1lmhJ86 JIymcAbw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jYrNK-00020d-Sr; Wed, 13 May 2020 13:24:43 +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 972A7305EEF; Wed, 13 May 2020 15:24:40 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 7CE88285D660D; Wed, 13 May 2020 15:24:40 +0200 (CEST) Date: Wed, 13 May 2020 15:24:40 +0200 From: Peter Zijlstra To: Marco Elver Cc: Will Deacon , LKML , Thomas Gleixner , "Paul E. McKenney" , Ingo Molnar , Dmitry Vyukov Subject: Re: [PATCH v5 00/18] Rework READ_ONCE() to improve codegen Message-ID: <20200513132440.GN2978@hirez.programming.kicks-ass.net> References: <20200511204150.27858-1-will@kernel.org> <20200512081826.GE2978@hirez.programming.kicks-ass.net> <20200512190755.GL2957@hirez.programming.kicks-ass.net> <20200513111057.GN2957@hirez.programming.kicks-ass.net> <20200513123243.GO2957@hirez.programming.kicks-ass.net> <20200513124021.GB20278@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 13, 2020 at 03:15:55PM +0200, Marco Elver wrote: > So far so good, except: both __no_sanitize_or_inline and > __no_kcsan_or_inline *do* avoid KCSAN instrumenting plain accesses, it > just doesn't avoid explicit kcsan_check calls, like those in > READ/WRITE_ONCE if KCSAN is enabled for the compilation unit. That's > just because macros won't be redefined just for __no_sanitize > functions. Similarly, READ_ONCE_NOCHECK does work as expected, and its > access is unchecked. > > This will have the expected result: > __no_sanitize_or_inline void foo(void) { x++; } // no data races reported > > This will not work as expected: > __no_sanitize_or_inline void foo(void) { READ_ONCE(x); } // data > races are reported > > All this could be fixed if GCC devs would finally take my patch to > make -fsanitize=thread distinguish volatile [1], but then we have to > wait ~years for the new compilers to reach us. So please don't hold > your breath for this one any time soon. > [1] https://gcc.gnu.org/pipermail/gcc-patches/2020-April/544452.html Right, but that does not address the much larger issue of the attribute vs inline tranwreck :/ Also, could not this compiler instrumentation live as a kernel specific GCC-plugin instead of being part of GCC proper? Because in that case, we'd have much better control over it.