Received: by 2002:a05:622a:1442:b0:3a5:28ea:c4b9 with SMTP id v2csp736620qtx; Mon, 31 Oct 2022 12:37:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM57baEb+QF9VjZXsJetjc7BZugBruv/jk3g5KXpU2AG1zBJGGnZ/Gz+oirtcT75uZlnuN/S X-Received: by 2002:a05:6402:7c6:b0:461:aca1:97cd with SMTP id u6-20020a05640207c600b00461aca197cdmr15608812edy.95.1667245062130; Mon, 31 Oct 2022 12:37:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667245062; cv=none; d=google.com; s=arc-20160816; b=WACiXuLEfEDxsNjKR8jeYVVhwAZdTxVv9nGljQRUe8hFVAMFLghz9CNMA6LtmT1IjO vu5r28lJJmLcjHaOKSAP3oCWWP44fKP+A3050UbamM2EDCW+8/hU0sP/9fkhmpUWinSs QXhAgwVmIJzPcsqTRRKxJxUawOKhvbc9Cg3XdfEOSEGs75gMm9gAicEqZUB41pbUpAYU omi8NYIUgp+K5bqWIWNS9xObmxfbNU0W7J3YqovAaJ6ylICpCe8FbAtdSIn/kOPpWXDB 3TBvp0shM+AT5hxLgxRE38KuZqG5HrAqnWOu498fHGUmFD5eiiM+X5HSbPQhrZNp0yqY EMdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jEhFfKgPGa+jF8gRH8MuxebIn57K9uU2Jd3Ie7jAcT8=; b=lmoH6iNP/B/J9BlMDi6Cb3I7gajyssVuGmPJsssfqmiOHgMzka74fAiQjmZgEXVV1g 7160MueOEGcyWJPvDD55yiO3cgO/maDM9p0qiyBbMqItNL2hxxlUSSA2r23tWhbxWj29 2FVFF9zPFi7cfh7UGa4L82MSddXLbuiBiMIwvZD7L/MCRABXioGIETuvxJB+fBBx4bl7 03qjD8NNmULE44iw9bF6rAxajE4FrRF2Vem5wsscWOMnLTWjKzao8o1dHLzmyf+mOD2P KVvezEWysD9ZeDQH8yVC6X/MFcB00yLgLs23R8R+xxk0/Zyf5MBUS7EEyUjqzbMfSUPZ fkaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LBmrcq+X; 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 se13-20020a170906ce4d00b00789d1d367dcsi6895830ejb.281.2022.10.31.12.37.15; Mon, 31 Oct 2022 12:37:42 -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=LBmrcq+X; 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 S230003AbiJaTV1 (ORCPT + 99 others); Mon, 31 Oct 2022 15:21:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229528AbiJaTVZ (ORCPT ); Mon, 31 Oct 2022 15:21:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E51712771 for ; Mon, 31 Oct 2022 12:21:25 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 014A061440 for ; Mon, 31 Oct 2022 19:21:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07C57C433C1; Mon, 31 Oct 2022 19:21:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1667244084; bh=o0Q9MbdmmncKUEHxnHZRV+zqBROs61ocnfVwIcKSVsE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LBmrcq+XXz4JAY9e02wNJrk6F4jYOd/jAfp8S8+JsCpTSD8oSyZ4sZB4yHG776g9w Ft73y3/tY1aeDTL9F3Ebfyaog0NIJ5WtEzdcNxz1kumyE4AJM9jDwNNyaCXHGWnZ3f /Tzpdtk28wx+9rUYA7BgEYX4IIaYqcqdd8oA/S3An3mpinQMZTOTjXjZUhoIX4Yih3 /4Z1jp2adXePblNQPvfPUJmbNa+VgvSFAdjDU2DTW6O5qHJBEf3bqp5+pR8ifNDD1D 0s5jH9Wntw/GxnJ4XwjWu4LGk7fFcbJ1VrDEySYvlN1pR36oCI2QWyK0GKaoErv1Cn AshK4OjoStjXw== Date: Mon, 31 Oct 2022 19:21:20 +0000 From: Conor Dooley To: Jisheng Zhang Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] riscv: vdso: fix build with llvm Message-ID: References: <20221031182943.2453-1-jszhang@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221031182943.2453-1-jszhang@kernel.org> 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 On Tue, Nov 01, 2022 at 02:29:43AM +0800, Jisheng Zhang wrote: > 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. Tested-by: Conor Dooley > > 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 >