Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3713368pxj; Tue, 1 Jun 2021 11:26:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0L6TO0wdnIqbO/LJGcYm1sIAWQ1wBPkSGhbiFWQHAtqCQfrUl0obfRRaruiL+cfOgfruC X-Received: by 2002:a05:6402:4251:: with SMTP id g17mr34953821edb.238.1622571968740; Tue, 01 Jun 2021 11:26:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622571968; cv=none; d=google.com; s=arc-20160816; b=Z83KBAVNhFQNMDWF21rlysrtNsswosS5nYFT1kj1F0eHJMew8NNlXgzS+IA7xcnOKW /FoYWvI51jv9ncEEzSkFN39lkGM8H9aAgj+DL0fSSrWt3mCfxcFRjWinhcE0+9rUSvv1 nA9dM/387Ucv8BAVFCk0LBq50Bb1EQrvUu/H93WnMrIX5TRlC+ejkDn0eL/KdtGBOhxU OJWKRqSLJ2uMd4dbbm5HCt8aac2Rg6mqvVBIVunkMTgkwXzN72MMAxLukpko/Oy0sEsZ XBKfopDpCWkvL2W0t+ujjHbVc3Mpv6vml+fhFwEYjT9WdAz7KCH2xmvFKyxk2vLnrZV/ lU1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=g4HQ0zyETBbXwypfTphsYhXQU5jUVi5BzIgs/sw7Qr8=; b=L9WBG+4F3Y6R2ndVQYFC+g1BF2dEIgqpEuFixnfx4bJoGc6Np5q8xOXAsBNge9OaPn SA6abaecXCWgJOje0T8fErFTySmsrJbQ3brFqB6XK7fQmaP+1tnzsA5hFRHv+CEBJjxI 5hEJwfHntTWeBixXs8hz0VS4pJNgWbep8n3FgkRLpf/T/0ZRkq3ZTBDm/y0VP/vP2DB2 lhUiBVMc5mFpWpxogZk8QZxyD6HXxhxN638DYLYnT+NmcVvMyPKDUzejrylSYADqfw2J A52L2D4gbUYvJlHYdVmBS3Zxg7wRNy4u//c8vTJtuP118lncv5IUtCYRirexeKvQ20HA hACw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=J3WL8E4q; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cm8si2115727edb.480.2021.06.01.11.25.45; Tue, 01 Jun 2021 11:26:08 -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=@google.com header.s=20161025 header.b=J3WL8E4q; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234586AbhFASY7 (ORCPT + 99 others); Tue, 1 Jun 2021 14:24:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233970AbhFASY7 (ORCPT ); Tue, 1 Jun 2021 14:24:59 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26B0AC061574 for ; Tue, 1 Jun 2021 11:23:17 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id a2so23243284lfc.9 for ; Tue, 01 Jun 2021 11:23:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=g4HQ0zyETBbXwypfTphsYhXQU5jUVi5BzIgs/sw7Qr8=; b=J3WL8E4quXYSmlALpA4XqSbRNMkkryxgkK8Ptt0YOOdNVi1/KYdNDnaoduKS8LK9Ge +8hEjlbbF6PZpEHEiW6QJQ8UjotEyliXvpGLMrsAVg+d3vsHVhmPK2Dbx6YqMlLN/jqk KNjQ2W2p7bXOzJt1psL/Gdw+VOxgShKjU5eB+tDUJMFNw51HL5vvDlU0rMkx8lyK9KPS 2OOZOf1DCbA6rQHNGOiChXxGknvervBMVdMqENHWVGUMjPOOMxZxeorJAj42uQAoHF8H QzoTeHaAgktEa1mDkQ2VxhcU1edRIO970jXe9XT4qv4Or1wYiSBAEvGtg5CS2XforJBA z2uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=g4HQ0zyETBbXwypfTphsYhXQU5jUVi5BzIgs/sw7Qr8=; b=jU4NFLY9TsFZI01m/t+NrremITnR8Df7/KISn91lyK2nVX6IP4NzKH9nQnwQpQgoTr IcRVEvJ7j762c3zJ72cWVoXOCTPpNWA3hRBGoBCL8F+lwdIH9Kcf19Ov/OPW2FCO/X7C ULpehMJyB+gqVLKnBa9S1pnymiy9u+DQz5D9zaDzUpTaPrwcVjSoRZaOF7LZwLOyiL/j Ku3zfyk6MGer72AtIq1EBbvad4L1s/tXTSoaD8YDy0ePl6tgpbncnrOygLmemX49wbZI 0yfyq+rpz7hI4VaKZUHlr0YoJkQ+tRM3zof8HuMGOUKBt6Aj0l5zMcvl8W01iLz3/gsr P2fw== X-Gm-Message-State: AOAM5303KGfeP/Rh+rLR8t/ng4fiFEmc6Qru/LL0FCO3VDgx55shajRj M1KaQtkUILKL/6Cp8ExUnPxz+etB1/6umoBkgqF35SFKXNEXcg== X-Received: by 2002:a05:6512:220c:: with SMTP id h12mr20429141lfu.374.1622571795265; Tue, 01 Jun 2021 11:23:15 -0700 (PDT) MIME-Version: 1.0 References: <20210528182752.1852002-1-nathan@kernel.org> In-Reply-To: <20210528182752.1852002-1-nathan@kernel.org> From: Nick Desaulniers Date: Tue, 1 Jun 2021 11:23:03 -0700 Message-ID: Subject: Re: [PATCH] powerpc/barrier: Avoid collision with clang's __lwsync macro To: Nathan Chancellor Cc: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , linuxppc-dev , LKML , clang-built-linux , "# 3.4.x" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 28, 2021 at 11:29 AM Nathan Chancellor wrote: > > A change in clang 13 results in the __lwsync macro being defined as > __builtin_ppc_lwsync, which emits 'lwsync' or 'msync' depending on what > the target supports. Indeed, $ clang --target=powerpc64le-linux-gnu -mcpu=e500 -m32 for example. Thanks for the patch! Reviewed-by: Nick Desaulniers > This breaks the build because of -Werror in > arch/powerpc, along with thousands of warnings: > > In file included from arch/powerpc/kernel/pmc.c:12: > In file included from include/linux/bug.h:5: > In file included from arch/powerpc/include/asm/bug.h:109: > In file included from include/asm-generic/bug.h:20: > In file included from include/linux/kernel.h:12: > In file included from include/linux/bitops.h:32: > In file included from arch/powerpc/include/asm/bitops.h:62: > arch/powerpc/include/asm/barrier.h:49:9: error: '__lwsync' macro redefined [-Werror,-Wmacro-redefined] > #define __lwsync() __asm__ __volatile__ (stringify_in_c(LWSYNC) : : :"memory") > ^ > :308:9: note: previous definition is here > #define __lwsync __builtin_ppc_lwsync > ^ > 1 error generated. > > Undefine this macro so that the runtime patching introduced by > commit 2d1b2027626d ("powerpc: Fixup lwsync at runtime") continues to > work properly with clang and the build no longer breaks. > > Cc: stable@vger.kernel.org > Link: https://github.com/ClangBuiltLinux/linux/issues/1386 > Link: https://github.com/llvm/llvm-project/commit/62b5df7fe2b3fda1772befeda15598fbef96a614 > Signed-off-by: Nathan Chancellor > --- > arch/powerpc/include/asm/barrier.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/arch/powerpc/include/asm/barrier.h b/arch/powerpc/include/asm/barrier.h > index 7ae29cfb06c0..f0e687236484 100644 > --- a/arch/powerpc/include/asm/barrier.h > +++ b/arch/powerpc/include/asm/barrier.h > @@ -46,6 +46,8 @@ > # define SMPWMB eieio > #endif > > +/* clang defines this macro for a builtin, which will not work with runtime patching */ > +#undef __lwsync > #define __lwsync() __asm__ __volatile__ (stringify_in_c(LWSYNC) : : :"memory") > #define dma_rmb() __lwsync() > #define dma_wmb() __asm__ __volatile__ (stringify_in_c(SMPWMB) : : :"memory") > > base-commit: 97e5bf604b7a0d6e1b3e00fe31d5fd4b9bffeaae > -- > 2.32.0.rc0 > -- Thanks, ~Nick Desaulniers