Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp20039ybt; Tue, 30 Jun 2020 13:57:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4ljwBhuBuUKRkhRI21xccl3u3xy7x/TZil0QgMMJWInwKZGn7Zmrp5m0wv41XokAWjM6x X-Received: by 2002:a17:906:76c4:: with SMTP id q4mr20968981ejn.371.1593550229949; Tue, 30 Jun 2020 13:50:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593550229; cv=none; d=google.com; s=arc-20160816; b=oi0f8LkRPnW2eQ10/TTJKdMRdc5Jl+v1ydAlFYeyHqcDuqaxiVvdqQXYXE3rOlLVN9 4fmojeM5kkraxevX/g8pOQeloPfsNisnPb9b2wTKzsylOQYSHxyAhoIgNyi/dhxluyEL jhCVhzj8aywk9uAcRDRzvDYcXUeb619Fh3QLciOwMtTVAeQHTNx+xgvNokFAK4WsAcpF vHpHzTfC+SqK48bx8CYcllILSd6UM8vmkE32fSX1TAdmLnuqebEOuAt8Uvat7ZvnvznP 5Zdfd0T1NFNxJn3LSWA3/CV8ZRxZy0v+0R9qeX5uQjZ+ODQTE9IzIr5ETkoye1ie7IDt KNCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=XgsEheiIYigRxwgwUn+L6Gxtb96SAEpgIC8vskcBnKQ=; b=EV/TlS8ySfKEN19AEj6AgzI0UVhR8wQPKhvXqf5FSfOg2+KmSaNqCSichxjJS+m1RP zZ13ky2KfnXwkCdo4be3yqQ7kPLtQlxHca7XOOPoHHBdBkHK9AFTb8pWDcx5bWXDPmyd ynhQaW32Lv6BZrH+bwUSm9QX0ko3gX9LamJUIdkdvMVFDuewKgDhW1eWm+KwQi5Fa8+A l1GcAhTJev3yXW30weHwiynxGX8tIAn+0Cr25J25pBAaUcfm3JNssugb40th46VcCXNd 83IpccLG6S87YRWsC7Fo2/mTLbbFD+8Oakr3aI65/dPgTavzW/nzZfSooybyARVTixao 8SNA== ARC-Authentication-Results: i=1; mx.google.com; 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 ds16si3259929ejc.112.2020.06.30.13.50.07; Tue, 30 Jun 2020 13:50:29 -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; 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 S1727943AbgF3TZX (ORCPT + 99 others); Tue, 30 Jun 2020 15:25:23 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:58875 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726065AbgF3TZW (ORCPT ); Tue, 30 Jun 2020 15:25:22 -0400 Received: from mail-qv1-f49.google.com ([209.85.219.49]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPSA (Nemesis) id 1Mi2eP-1jCK6T3JM9-00e1cG; Tue, 30 Jun 2020 21:25:20 +0200 Received: by mail-qv1-f49.google.com with SMTP id t7so9813284qvl.8; Tue, 30 Jun 2020 12:25:20 -0700 (PDT) X-Gm-Message-State: AOAM533XNKdCu/boRlQlXHXOgCTzD9NSlo4eeDbnYZu/cr0B8NYTaFHE 9kAOGVwZ4OFtu541UoXHbVqGl9X39c9TuPRHP0U= X-Received: by 2002:a0c:ba0e:: with SMTP id w14mr21638836qvf.222.1593545119567; Tue, 30 Jun 2020 12:25:19 -0700 (PDT) MIME-Version: 1.0 References: <20200630173734.14057-1-will@kernel.org> <20200630173734.14057-19-will@kernel.org> In-Reply-To: <20200630173734.14057-19-will@kernel.org> From: Arnd Bergmann Date: Tue, 30 Jun 2020 21:25:03 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 18/18] arm64: lto: Strengthen READ_ONCE() to acquire when CLANG_LTO=y To: Will Deacon Cc: "linux-kernel@vger.kernel.org" , Sami Tolvanen , Nick Desaulniers , Kees Cook , Marco Elver , "Paul E. McKenney" , Josh Triplett , Matt Turner , Ivan Kokshaysky , Richard Henderson , Peter Zijlstra , Alan Stern , "Michael S. Tsirkin" , Jason Wang , Boqun Feng , Catalin Marinas , Mark Rutland , Linux ARM , alpha , virtualization@lists.linux-foundation.org, Android Kernel Team Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:PHrO9izh4NNAQ0DpLs98Zi/cmfDRago2QI2t67m75yidnuOuK1y dRxsXcxsm8wiJuINEL+rhy5rzZ8DT7OLpRDD4XWCtmuiZIVsTQIEa6bq5gS71Un2O3OcJHZ VfoV4oxYRtJqd4TkIACF5ShEMlDu3Hb0fOa1W4wbIc0m72JV6V4P/vC5u23vyq3Hli5m6/f jHHhY9bmP4fbJwEHOtNhw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:W9+Tl/3NP3s=:dK9mjkydT8Mu8YiyXNKw+P qMs16YMejU0ODuWFv4qZ7ZlYlXkk4wHvecKoE0ODcvPYYXQPwS3c+CypwJnSnD1U87WKEvMcG cvirPkAQxR9sFbpxIRmCs0kVpvD+MLji7qeO19Jnv4OhJ4CsWfTI+oQFPMApbwvROvgmMUeiQ AdppnErFNSz2rcEruYJLcr8U8k9YSSb+sSxcgu+VU2wOqFqFB/PwVuNWPAXH9O7bjmk9zEh8+ VgC49SQLnZcASQPNT0GNV6jPLGnH1e/OcU4A/6hdw9cV7gp2KjKAutsz3/I20S/s0o4HfjlyQ 2joKjxMfWZeBTJZKY5BF/qJ3TCKudf1x1bHl7FJAJ+t763jGm39elvBO91wXb/THJ3R8juijS 37LrD2jGWf5AGD7fyjvqXUIgg5QTRGykMqKt8TxOMdasC3cYWX/SXSfgO5ZtMhc4/j6u0b1y+ CSBUA7YbUJIKTnZnpJD5jeVtOCiIpUlLC9QbhULUDATrfO+vNb4I1EXvmKkSJk+q926QmPAIU SCneudOiwHSm/nAzqQxSo4Qu9YLVeGrXNfOnaH/2mA6EjEVAru7GbzgI9OkiW7Wb1xzGY7j1Y LNz27F9dI0FQUQ79+rqHOHMpf5U4ck9vZXu8/RxY9voYkRZqRBt3BbGzqQvhaXy86uK2C1/FT 7WtGOCDvTZ5BhTDfvpJM0Q7rP4zDKiJEZYRbgCl58flOBx65B8BF+YoOZEjH4yQWT5R0AbpfK o+PS/GjIzHzpNli5uctSF96tEHsEN8B38ttqdfa6ddxlQxUbZnmEbRJ9IuA1mD1UXsu8376qj l46sp0RFk5uPfmb8K64fcC2sK9ypzulKt2To3lDVC4u2sagdFY= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 30, 2020 at 7:39 PM Will Deacon wrote: > +#define __READ_ONCE(x) \ > +({ \ > + int atomic = 1; \ > + union { __unqual_scalar_typeof(x) __val; char __c[1]; } __u; \ > + typeof(&(x)) __x = &(x); \ > + switch (sizeof(x)) { \ ... > + atomic ? (typeof(x))__u.__val : (*(volatile typeof(x) *)__x); \ > +}) This expands (x) nine times (five in __unqual_scala_typeof()), which can lead to significant code bloat after preprocessing if something passes a compound expression into READ_ONCE(). The compiler works it out eventually, but we've seen an actual slowdown in compile speed from this recently, especially on clang. I think if you move the typeof(&(x)) __x = &(x); line first, all other instances can use typeof(*__x) instead of typeof(x) and avoid this problem. Once we make gcc-4.9 the minimum version, this could be further improved to __auto_type __x = &(x); Arnd