Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp351196ybk; Fri, 15 May 2020 02:22:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgrvF0/1zdY9RkoDJkrbrijO9IPdEwPExZZzz6GkC4EwnyYDosoI/Ir1wRIv2/VY0A5wd8 X-Received: by 2002:aa7:dcd7:: with SMTP id w23mr1964993edu.300.1589534539541; Fri, 15 May 2020 02:22:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589534539; cv=none; d=google.com; s=arc-20160816; b=ZEC7uFIeiVJgON6TqCTo5uEINJwcsDmI4TA9oyD9cW5a54mHg4nSU0Xu2cyM8qapuY FejMVIK1xdT9kTa6tiFqIMnC5oHpdzW8sI+Hq2nVohFXs8gPAW1Anm3fz68c3kcKSL8I E4cLWF6J/ly4vDqvfxHSX+IYLMEZ7LkO0m8pd55xtTJ0f97Im99qfZGexOO5liL4SGmy j8P8xx3fJN193Auf0540CmFr/ZdsgoPnOnlOHISnZsmW3AFPjC/gLsyouPEN3zKdrsue VhfpEnPQiMLk8ewRdOI5JbTjsJJ1fNQhSp7gkp7iAPg+BPap48kwAeOvfuTxSaryJX5n WqcQ== 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=PwLPxTgU7MVgOEj1sQDsMs7u6MdEPxf7jvTyirXInfQ=; b=JHOBqAGqfwwcdlqYUrZlry8A/0/Sr5MBT7F17KjgrLzb+hdjA0OUbak2La6tgD5FXI 676Yk1WCRwdpoABRmtc+BaOa0h4wi48VbtXAm2muOkws4nBhcbH0w8xvZTAd/GUrf2UN 23+3eUqGzsFISMUFUHqe/d94e/nghWBWmtObXbLET9SeISn1HEv46+Qa0h51GEoB9Hbn KK2TdhI0/LAmgFEwTiBaOmELRkQGVUj+AdD8a9f0+FgQwA4+zLhPjkhEZoT4rZaeCNcv 5+PIB+ulXHxpMk7LPoDo3Jciq7IFgAICt2ItgFg1iAJrt8q5X+LvIFmU552PDb50FNtj XVEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=peGeYEPF; 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 ck13si796727ejb.403.2020.05.15.02.21.55; Fri, 15 May 2020 02:22:19 -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=peGeYEPF; 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 S1727910AbgEOJUP (ORCPT + 99 others); Fri, 15 May 2020 05:20:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727803AbgEOJUN (ORCPT ); Fri, 15 May 2020 05:20:13 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78720C061A0C for ; Fri, 15 May 2020 02:20:13 -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=PwLPxTgU7MVgOEj1sQDsMs7u6MdEPxf7jvTyirXInfQ=; b=peGeYEPFb/+g6JS0ALE7mDaYs6 4yCuDKhjmqdXuGgjsgxBsXSC7aZuzRZpNBmBuHlOlN5g6zRURkvP+nutuJn1i7cepMFMxqb8wxU2y EW2P4lGoWXTB71NFmVasUZ1tedkvj5Li9RHQKS8Y7QXw3jWp6ypN/QWJAwpEG1dVwUNs2AYDzxCdA tazMkyjyqFNkdX9cfix4ffq6ueT4jiXftB0VeWGh7rxXLh+LMrN2XnGLnQwsx7tdrozeZkVartpK/ nU+SJoFz+BhgWlBOdVkTjEIAKYlfXu7lrSYSlXvVXn0lyqK70t1lkNPYMdt7zeJoYEEFkIiRuFr4C 0Fpo0L0g==; 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 1jZWVh-0008Bs-SM; Fri, 15 May 2020 09:20:06 +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 6DF42300261; Fri, 15 May 2020 11:20:03 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 4C7D020267E66; Fri, 15 May 2020 11:20:03 +0200 (CEST) Date: Fri, 15 May 2020 11:20:03 +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: <20200515092003.GR2957@hirez.programming.kicks-ass.net> References: <20200513111057.GN2957@hirez.programming.kicks-ass.net> <20200513123243.GO2957@hirez.programming.kicks-ass.net> <20200513124021.GB20278@willie-the-truck> <20200513132440.GN2978@hirez.programming.kicks-ass.net> <20200514141344.GB2978@hirez.programming.kicks-ass.net> 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 Thu, May 14, 2020 at 04:20:42PM +0200, Marco Elver wrote: > On Thu, 14 May 2020 at 16:13, Peter Zijlstra wrote: > > > > On Wed, May 13, 2020 at 03:58:30PM +0200, Marco Elver wrote: > > > On Wed, 13 May 2020 at 15:24, Peter Zijlstra wrote: > > > > > > 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. > > > > > > I'd like it if we could make it a GCC-plugin for GCC, but how? I don't > > > see a way to affect TSAN instrumentation. FWIW Clang already has > > > distinguish-volatile support (unreleased Clang 11). > > > > Ah, I figured not use the built-in TSAN at all, do a complete > > replacement of the instrumentation with a plugin. AFAIU plugins are able > > to emit instrumentation, but this isn't something I know a lot about. > > Interesting option. But it will likely not solve the no_sanitize and > inlining problem, because those are deeply tied to the optimization > pipelines. So I'm imagining adding the instrumentation is done at a very late pass, after all, all we want is to add instrumentation to any memops. I imagine this is done right before doing register allocation and emitting asm. At this point we can look if the current function has a no_sanitize attribute, no? That is, this is done after all the optimization and inlining stages anyway; why would we care about that? Maybe I'm too naive of compiler internals; this really isn't my area :-)