From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 02277C433EF for ; Sun, 17 Jul 2022 19:58:24 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4LmG9q0HXSz3c1y for ; Mon, 18 Jul 2022 05:58:23 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.crashing.org (client-ip=63.228.1.57; helo=gate.crashing.org; envelope-from=segher@kernel.crashing.org; receiver=) Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by lists.ozlabs.org (Postfix) with ESMTP id 4LmG9M0nlvz2xrY for ; Mon, 18 Jul 2022 05:57:57 +1000 (AEST) Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 26HJsmgu016415; Sun, 17 Jul 2022 14:54:48 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 26HJsmPs016414; Sun, 17 Jul 2022 14:54:48 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Sun, 17 Jul 2022 14:54:48 -0500 From: Segher Boessenkool To: Linus Torvalds Subject: Re: mainline build failure of powerpc allmodconfig for prom_init_check Message-ID: <20220717195448.GB25951@gate.crashing.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kees Cook , linux-kernel , Paul Mackerras , linux-hardening@vger.kernel.org, linuxppc-dev , Sudip Mukherjee Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Sun, Jul 17, 2022 at 07:44:22AM -0700, Linus Torvalds wrote: > On Sun, Jul 17, 2022 at 2:13 AM Sudip Mukherjee > wrote: > > I was trying to check it. With gcc-11 the assembly code generated is > > not using memset, but using __memset. > > But with gcc-12, I can see the assembly code is using memset. One > > example from the assembly: > > You could try making the 'args' array in 'struct prom_args' be marked > 'volatile'. > > Ie something like this: > > --- a/arch/powerpc/kernel/prom_init.c > +++ b/arch/powerpc/kernel/prom_init.c > @@ -115,6 +115,6 @@ struct prom_args { > __be32 service; > __be32 nargs; > __be32 nret; > - __be32 args[10]; > + volatile __be32 args[10]; > }; > > because I think it's just the compilers turning the small loop over > those fields into a "memset()". Yes. See near the end: Most of the compiler support routines used by GCC are present in libgcc, but there are a few exceptions. GCC requires the freestanding environment provide memcpy, memmove, memset and memcmp. Finally, if __builtin_trap is used, and the target does not implement the trap pattern, then GCC emits a call to abort. Can't we simply have a small simple implementation of these functions in arch/powerpc/boot/? This stuff is not performance-critical, and this is not the first time we hit these problems. Segher