Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp627640pxj; Fri, 28 May 2021 11:30:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEGmFtpZQbYBZtYTr/uSO+sQ0vjEqJQisUPjR/pqxsuUGvtohN8VdMIXltluEdpEYrNUZ6 X-Received: by 2002:a5e:c703:: with SMTP id f3mr7993875iop.107.1622226657387; Fri, 28 May 2021 11:30:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622226657; cv=none; d=google.com; s=arc-20160816; b=Skh8jQUH3/0zCgt4n+punYGKf/ZR6LrXzapwDVmz3JxK/KEEgnh25ClAp+NPEFtAJM YLjcAUkCahN3A2UsUM+8X2YrByPBBEYNGYujy+1U9NUZoLrsx4AuvGjI04x4tjo3bmKv jNJCrxBe9oo9J0sjBR7BjxlkB0hVtsdR4DtRhdhWS7pYteSt0cl7nY+F25Oe/x4QmVjg qvWX4TquWsO9TOe+RvH+cUn+hwuSMPPJkEaaFVBZJXuEy7Q9yWiPhkxfeQcuP7SqXNrJ puLn2Pz7gGDmHUvkFs648sBVRu063kZQ8C4whu13etDxSXJ6Kim19yaIEFaE9rTWE8c9 W4rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=UCEixsYx90N8c/JhthJCAXMPc4UC/tqNbnZHMWhUHiE=; b=zv/ulzGzSB5/OenLsAhvo/gdZJQ3RnqL8tOJouiHyRApVyAuqu2QXcoTtvpBtUGWD6 x2uzLOKAp8DfW44Fwj/0WUPyGgZmZxzTRznxD/YYfeBjHWA9zZa4mnnfYW4btX/ICrDg MeTrSI6xuO5t/cNKRQcn5eqTZsHh+xNQ1Oz8g9N75VzYJYxLqB8EoZdge50TzLMUXur/ TOzzdglYRe2IZiLSYJBymF/UVjoRDojsZuc2SAnoYpfo75a6Ekji3B0bBqiu7TNLvOGY aMezV686tj/Y2eJdoZ12/unzE04SOErmS2uACYRazGGui77dsLaVJJZ0jYsZexmhEnKD nd1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hNQ+OCbF; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a16si1983401ilr.155.2021.05.28.11.30.43; Fri, 28 May 2021 11:30:57 -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=@kernel.org header.s=k20201202 header.b=hNQ+OCbF; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229528AbhE1SbY (ORCPT + 99 others); Fri, 28 May 2021 14:31:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:56138 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229463AbhE1SbY (ORCPT ); Fri, 28 May 2021 14:31:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 43175613B5; Fri, 28 May 2021 18:29:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622226588; bh=QSRZ6S+Sdf5WKAtAbGtJdidvTJ3wPSV/gRZewGESIdk=; h=From:To:Cc:Subject:Date:From; b=hNQ+OCbF7nGq0MnBf2zAPV0EqKgB5b70lnJOPG/Bwu1By3raVTVvicfYq/ICuuHbd TC4czzsMTLqk/RFcDpjfix5VBAQA34WlMU6mD/3sEKEkGHA1scGO+5EtIlxJb6bb58 962RSm5GttFs0CsZ8cXfAJ+eZhpLF/JFoUYqjV/b6uVemz8qtqktlMljUQ5UGd4Azl XD5WWPTootKdW6q8HHwnhvXYLSk+a70AX587QpUItcVK6WevBjXPBPIYj903/XSfic FIdC1ILIpNVc42D925oe+PjwSOgQwuqCkmAe0+hc+y9hJY7LAyK7zRUkUDuMF+CJTg 9n7m86SCQtTlQ== From: Nathan Chancellor To: Michael Ellerman Cc: Benjamin Herrenschmidt , Paul Mackerras , Nick Desaulniers , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, Nathan Chancellor , stable@vger.kernel.org Subject: [PATCH] powerpc/barrier: Avoid collision with clang's __lwsync macro Date: Fri, 28 May 2021 11:27:52 -0700 Message-Id: <20210528182752.1852002-1-nathan@kernel.org> X-Mailer: git-send-email 2.32.0.rc0 MIME-Version: 1.0 X-Patchwork-Bot: notify Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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