Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp1135578rwi; Mon, 31 Oct 2022 11:49:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4fNnWH5CZkqVwwUTRC24am3OBC/+2R5z3qSMCzwe5OEFL6LTRAudzqkInEXU/uOB3snLEM X-Received: by 2002:a17:902:f686:b0:187:16a0:fd2b with SMTP id l6-20020a170902f68600b0018716a0fd2bmr9939820plg.91.1667242192109; Mon, 31 Oct 2022 11:49:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667242192; cv=none; d=google.com; s=arc-20160816; b=EBFDO5KWN+1BMesB1f4EzZXvdXBx/2X7Wgvw9GaOMngjU9NyutDzPf4i/MUT0T7uSc y5FS5rdUoHro/JmJLDp9qaI63VhdnyZ/Vs5Xw1CXe3X4aSjCQuuFPr918uMJBdB0t4uu t4j6Let0Gjqp4YFNNxzWM6okMbeyIM9l+6kSVxPhtPxCpGhtzcWkoXhYOyFS/WDYvbQO 5cz0Ao7SiEx9fYIfZsW1XAsaNaJiATz5RQUp8xfU7nMseU+7QLssv/afYYbxGN6w/5FB rpa0HKIKcuKxGksig8CVy8Ok+TCeiEVBE1akJAs+kpA7FHvuUB0KyeN848187ryHh/j7 zhOw== 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=xkN/AU8435Q0TYl8BhJEGqy5gjSFdQDymBq8MjDqeIU=; b=Zxz1QvfdKtL0TkgR/Sco2AI5qgGUPoJVP65JhQlWcnUxNGBV3kjzHQxXdB4Bf0Ycpv trRH0VCOiE/EOeGJw7jNJ9nmJYT7gsTiBV6109zqdHK3pGucQo06aVpFqPTJFL3cMRbl O/rS6Cl/eE9LEEfSzvJ6t/Jk8bIp1cN62FBGZ7dK7y5ggjG1IdTA5KHX0veSw8eod+0W EXHreiHKk6RsOBln7V3ye25AwqHizLIHQT60DRFWq5MI4I0epDdgCtlphLBxXWeC2seo xBgHibqVnXoRaEnFMYepWRK2Jf5o9wQx8vubX5aFLvK7L0B+dstGUHNxggmPeGzw7FkC SFWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BjgfbnyQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q128-20020a632a86000000b004599da2b2b6si9921181pgq.716.2022.10.31.11.49.38; Mon, 31 Oct 2022 11:49:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BjgfbnyQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229720AbiJaSj3 (ORCPT + 99 others); Mon, 31 Oct 2022 14:39:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229452AbiJaSj1 (ORCPT ); Mon, 31 Oct 2022 14:39:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B309DDF77 for ; Mon, 31 Oct 2022 11:39:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 69A53B819A9 for ; Mon, 31 Oct 2022 18:39:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2632C433C1; Mon, 31 Oct 2022 18:39:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667241564; bh=It14nDJvTqCUwHf/PuycyXWi6Kbor6f6XNY4NSVwgLE=; h=From:To:Cc:Subject:Date:From; b=BjgfbnyQkRTF0+PkDkOegY6LaF3LwWV0vcYyqsL3bgIUuoftJO1AgskCxUc/LvLSI lazDQKYdKatIhtRYHTVuw+X6AFDD77Lyt4q1Y/SL6I/JX5ELPVSSz9Z71+9UrYP1zX yoYqsnCZFcs7RWp91IiXeSphXoUaimfoHtLHjKYBkginNuaa203nnreCe0/bx4aEor bd4n2WrOnXiP2fP+ucM6f1vNqmPENJI71T19HHkxNPJLLylilyeRKtg3YREQvtpAjw NRxBoDsnrHiW9c/W8ghfPvqdv9zYLUDaj7ChG6MmNFT8x+pjT4v68iO8vxVE1/mPx0 Ivtd/6+a33yzA== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] riscv: vdso: fix build with llvm Date: Tue, 1 Nov 2022 02:29:43 +0800 Message-Id: <20221031182943.2453-1-jszhang@kernel.org> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Even after commit 89fd4a1df829 ("riscv: jump_label: mark arguments as const to satisfy asm constraints"), building with CC_OPTIMIZE_FOR_SIZE + LLVM=1 can reproduce below build error: CC arch/riscv/kernel/vdso/vgettimeofday.o In file included from :4: In file included from lib/vdso/gettimeofday.c:5: In file included from include/vdso/datapage.h:17: In file included from include/vdso/processor.h:10: In file included from arch/riscv/include/asm/vdso/processor.h:7: In file included from include/linux/jump_label.h:112: arch/riscv/include/asm/jump_label.h:42:3: error: invalid operand fo r inline asm constraint 'i' " .option push \n\t" ^ 1 error generated. I think the problem is when "-Os" is passed as CFLAGS, it's removed by "CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os" which is introduced in commit e05d57dcb8c7 ("riscv: Fixup __vdso_gettimeofday broke dynamic ftrace"), thus no optimization at all for vgettimeofday.c arm64 does remove "-Os" as well, but it forces "-O2" after removing "-Os". I compared the generated vgettimeofday.o with "-O2" and "-Os", I think no big performance difference. So let's tell the kbuild not to remove "-Os" rather than follow arm64 style. vdso related performance can be improved a lot when building kernel with CC_OPTIMIZE_FOR_SIZE after this commit, ("-Os" VS no optimization) Fixes: e05d57dcb8c7 ("riscv: Fixup __vdso_gettimeofday broke dynamic ftrace") Signed-off-by: Jisheng Zhang --- arch/riscv/kernel/vdso/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile index f2e065671e4d..84ac0fe612e7 100644 --- a/arch/riscv/kernel/vdso/Makefile +++ b/arch/riscv/kernel/vdso/Makefile @@ -30,7 +30,7 @@ obj-y += vdso.o CPPFLAGS_vdso.lds += -P -C -U$(ARCH) # Disable -pg to prevent insert call site -CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os +CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) # Disable profiling and instrumentation for VDSO code GCOV_PROFILE := n -- 2.37.2