Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp5105755pxb; Thu, 14 Oct 2021 19:35:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweZKkurqsfTNHgxl6+nICT1TzoOg5xDqyFFu2/j2XTJptlUR0dTBv+93mQDKjiESLB7Mws X-Received: by 2002:a50:d78c:: with SMTP id w12mr10894199edi.147.1634265357745; Thu, 14 Oct 2021 19:35:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634265357; cv=none; d=google.com; s=arc-20160816; b=M5ar+nsOGqhhkSLfrEEH2s6ajZjtWSkYCcx/IFhotsc6sdgej/CGHJgwIYHWUan7ou qGFqJCvdFbTckSn8MQmgFnP1PGMu2LjZ8MTXULXy5n/0dPIvpmoG1zhz9fXShmddlykE j/wmulVkfoBNbp2H+4A47Gz2e/KwLs/KQMMiddvIY5+ADbsKhNiJosIMRXsqu4LfbyY9 SPISlpWwbHnwVDCT4BPwDlbFIxCqnnasf5cHxTAsWtNE1DUwYfClKvAEhc/ku0KDNN81 Z7iu/ETvwIuUY/PUqDOA3jfCRCN3ll+Yz0w6m8tjfagmD/PlSwXuzRpOvg/2APlShtaa fGfA== 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=Fy57D187X48Fx9bxjnyOKm0PBOatPcD5XyLLGaScZCs=; b=V9QTD+WlfAgf6AIkstJJl2PlU5MoTOl1MJohQ7C7A0qE6PJ6atyHDxh2QWR6rF0T80 FhcTtM/Hekpj4QuJ1KdeM4TXX+CyxOfjjLHWSpZura3Osb1hJ8ALo4/96d4UCETeDDlx kCbuo1Zx84GlJ7xCXYRcUnk2g5ShbjzqcBbRJTvS5VB36dOv9Zk3UTwqduWbfGGuuh/f l9qSg/b3cXGyTGX0X5bAa2WFh55V4tB/xNCQqke8QnvvPnqreixFXD7rsTVbiNC7YRnc 2Dd9tKJyxt2y8kYsOzCtTdL+zp0d1lHkPnkeOEvWVbbyCZKrXXCRBxuMivtXnFWvKXWY nhHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Xv43Nnn8; 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 s4si8831400ejm.735.2021.10.14.19.35.32; Thu, 14 Oct 2021 19:35: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=@google.com header.s=20210112 header.b=Xv43Nnn8; 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 S232041AbhJNVBc (ORCPT + 99 others); Thu, 14 Oct 2021 17:01:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230378AbhJNVBb (ORCPT ); Thu, 14 Oct 2021 17:01:31 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05520C061570 for ; Thu, 14 Oct 2021 13:59:26 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id y15so32481909lfk.7 for ; Thu, 14 Oct 2021 13:59:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Fy57D187X48Fx9bxjnyOKm0PBOatPcD5XyLLGaScZCs=; b=Xv43Nnn8wKY7HqJ/aaTgZcLyLVXJTIgRqKiWGdpe/DtNHjAokUzkObHf/XPqjzbkwa tSAfHanBeDadiwCnOXbi7PnZ9yuFj3BODLOSTci05KvAy4RnxAhuqo8LUaS0w24Oe8KP Vq53ebcADealKHOaZWv90un+/ajhEjR2OeRvlqOzeEtj2pgoulBiTmUYTtrJLIQ+M+XL wMBM9H7X3WPquujBXNBFMNadJjiGW1KMqahcgiPQUCxxmjr/gObAlyrKUsF0NCRbQfFz uaos0Auyw4+iEWHiphp3uNGAT7jVWsVEfj0ebtH3hW/bP0mhONG6TU1purtxK4jm7Eqh 410A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Fy57D187X48Fx9bxjnyOKm0PBOatPcD5XyLLGaScZCs=; b=7et0k+nicNuc7y325zgKB4zCTWqCF5ulMptcz266t+3ksXPiclj6FcmG7zePvGM/Wk l/0SqYGB+uc6n72YrxG9I6KutFMIx5b3Y9vnaX2h7lx5HWLjwC4G8sDepC+Apsr8GktY gPyXBQOvz4FlzGHjVDOS457RerSWTS9Wh6tzv9cOWNpPZ8MRkFQ6HGEt6Jsg073tUsz8 Dw88yp4NQnfqjvg27wmtC1yQBqEK6EwB9UND3k9IehOmmEOE3mWn1lWr+Vd8NVkhH1By fAwyc/9eu3YlqjpIAn5yZkc2TLSP0mEjGylvgTnDYVx1wvVssQ5uD2EMtWr43OXq8wgu qzMA== X-Gm-Message-State: AOAM530LeC4GkfVHsSueoJAP/tS53TrqDermWdBzuH2mT9/r9fjcMsyO 7E/CHlh3YgBKnwdE29PpzPrzMVXX+ue1Jiz4JrIFpQ== X-Received: by 2002:a05:6512:3ba3:: with SMTP id g35mr7442920lfv.651.1634245164162; Thu, 14 Oct 2021 13:59:24 -0700 (PDT) MIME-Version: 1.0 References: <20211012234606.91717-1-ndesaulniers@google.com> <20211012234606.91717-3-ndesaulniers@google.com> In-Reply-To: From: Nick Desaulniers Date: Thu, 14 Oct 2021 13:59:12 -0700 Message-ID: Subject: Re: [PATCH 2/3] arm64: vdso32: lazily invoke COMPAT_CC To: Masahiro Yamada Cc: Catalin Marinas , Will Deacon , llvm@lists.linux.dev, Linux Kernel Mailing List , linux-arm-kernel , Vincenzo Frascino , Lucas Henneman Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 12, 2021 at 8:03 PM Masahiro Yamada wrote: > > On Wed, Oct 13, 2021 at 8:46 AM Nick Desaulniers > wrote: > > > > When running the following command without arm-linux-gnueabi-gcc in > > one's $PATH, the following warning is observed: > > > > $ ARCH=arm64 CROSS_COMPILE_COMPAT=arm-linux-gnueabi- make -j72 LLVM=1 mrproper > > make[1]: arm-linux-gnueabi-gcc: No such file or directory > > > > This is because KCONFIG is not run for mrproper, so CONFIG_CC_IS_CLANG > > is not set, and we end up eagerly evaluating various variables that try > > to invoke CC_COMPAT. > > > > This is a similar problem to what was observed in > > commit 3ec8a5b33dea ("kbuild: do not export LDFLAGS_vmlinux") > > > > Cc: Masahiro Yamada > > Reported-by: Lucas Henneman > > Signed-off-by: Nick Desaulniers > > > There are two ways to fix it: > > [1]: sink the error message to /dev/null > (as in commit dc960bfeedb01cf832c5632ed1f3daed4416b142) > [2]: use a recursively-expanded variable as you did. > > > "Simple variable (:=) vs recursive variable (=)" is a trade-off. > > Please be careful about the cost when you try the [2] approach. > > > > Simple variables are immediately expanded while parsing Makefile. > There are 7 call-sites for cc32-option, hence > the compiler is invoked 7 times for building vdso32, > 0 times for cleaning. > (Since 57fd251c789647552d32d2fc51bedd4f90d70f9f, > try-run is no-op for 'make clean'). > > > > > Recursive variables are expanded every time they are used. > > IIUC, if_changed expands the command line 3 times. > There are 2 objects (note.o and vgettimeofday.o) > There are 7 call-sites for cc32-option. > > So, the compiler is invoked 42 (3 * 2 * 7) times > for building vdso32. With this patch applied: $ ARCH=arm64 CROSS_COMPILE_COMPAT=arm-linux-gnueabi- make LLVM=1 -j72 clean defconfig $ ARCH=arm64 CROSS_COMPILE_COMPAT=arm-linux-gnueabi- make LLVM=1 -j72 arch/arm64/kernel/vdso32/ V=1 | tr -s ' ' | cut -d ' ' -f 2 | grep clang | wc -l 55 $ find arch/arm64/kernel/vdso32/ -name \*.o | xargs rm $ ARCH=arm64 CROSS_COMPILE_COMPAT=arm-linux-gnueabi- make LLVM=1 -j72 arch/arm64/kernel/vdso32/ V=1 | tr -s ' ' | cut -d ' ' -f 2 | grep clang | wc -l 2 Prior to this series: $ ARCH=arm64 CROSS_COMPILE_COMPAT=arm-linux-gnueabi- make LLVM=1 -j72 clean defconfig $ ARCH=arm64 CROSS_COMPILE_COMPAT=arm-linux-gnueabi- make LLVM=1 -j72 arch/arm64/kernel/vdso32/ V=1 | tr -s ' ' | cut -d ' ' -f 2 | grep clang | wc -l 55 $ find arch/arm64/kernel/vdso32/ -name \*.o | xargs rm $ ARCH=arm64 CROSS_COMPILE_COMPAT=arm-linux-gnueabi- make LLVM=1 -j72 arch/arm64/kernel/vdso32/ V=1 | tr -s ' ' | cut -d ' ' -f 2 | grep clang | wc -l 2 With patch 3 applied, we can drop CROSS_COMPILE_COMPAT, and we now get: $ ARCH=arm64 make LLVM=1 -j72 clean defconfig ARCH=arm64 make LLVM=1 -j72 arch/arm64/kernel/vdso32/ V=1 | tr -s ' ' | cut -d ' ' -f 2 | grep clang | wc -l 44 $ find arch/arm64/kernel/vdso32/ -name \*.o | xargs rm $ ARCH=arm64 make LLVM=1 -j72 arch/arm64/kernel/vdso32/ V=1 | tr -s ' ' | cut -d ' ' -f 2 | grep clang | wc -l 2 Please confirm; perhaps my pipeline missed some invocations? Or was there a different target you were referring to? -- Thanks, ~Nick Desaulniers