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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 A0860C4332F for ; Wed, 12 Oct 2022 13:29:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:CC:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4KcPQCe1nVXgbSYHG3KucyOjf/W8vvf5YVw9u3/k+20=; b=CL6OYe3Oijml2k G6HBE8bfDZFDL5mqrjcgAmWoQvIBumWfnkHxMtQ09RqBYiNOewcyPls5PKFbqRg3TeG1f6IoYinEb H7kquqtUZd8Btc6D5A4rv8Htz3gAYPBxWEfdzl4AMBtNHIwXNrHDfWeDjG/NP6VEaJvufh7CKHXS4 iAURSrwL34Dg8l/EynAWml3EEraeVrdqKSIIWHN9LjFBSlk9YNMqxcgHlcit1TWA52q62was1kWRD 2QgQ2FRR8sHpaLSuxGLBopSO7c8JWnKS6ufTjtMSQ7Kj6pXjp1ulSRl0pa8/umw+GCFYngSlSOfNj 9240cZl/cSOZjJ84RL7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oibnJ-008BYk-GY; Wed, 12 Oct 2022 13:29:09 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oibn2-008BTh-Mu for linux-riscv@lists.infradead.org; Wed, 12 Oct 2022 13:28:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1665581333; x=1697117333; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=zLOMPQX/UZ2BIcOn/66Oe03IRbrUXRGhlWZylqU+JUI=; b=Gea/GlsUmEmBqfr07pcuutryjLolYJYiyHBJDc3nq4ZxXnHwlwVRFWAE NfJDrLHMFGnQYy7y/rrFmF0AbfGtR43q/Ztrq3CjqHAXJSsKTDVSpsM8W ToJalwwz6y5VRP6ZgTkTd9HIyh/mgDjjVpxDLO3CP8AWJyf5ewedzfq6J fqSvonwlpurASDC3q/tlGtAr6GoeOzaxAm2XUV+2LgmtTAnFTLSEvc3Xu LlBDIC5UO6LxRJBvFY8RwIg0FSzCY6XaG/EhxM53Y/KacKKyxNY9lueWs 8Tsu25bsNrsYMrXGVfc9jGzdiahb/Z+enfvqhYxShok9sBPADlxYYZUwc g==; X-IronPort-AV: E=Sophos;i="5.95,179,1661842800"; d="scan'208";a="178371523" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 12 Oct 2022 06:28:46 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Wed, 12 Oct 2022 06:28:41 -0700 Received: from wendy (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12 via Frontend Transport; Wed, 12 Oct 2022 06:28:38 -0700 Date: Wed, 12 Oct 2022 14:28:16 +0100 From: Conor Dooley To: Jisheng Zhang CC: Peter Zijlstra , Josh Poimboeuf , Jason Baron , Steven Rostedt , Ard Biesheuvel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nathan Chancellor , Nick Desaulniers , Tom Rix , , , , Samuel Holland , Andrew Jones Subject: Re: [PATCH v2] riscv: jump_label: mark arguments as const to satisfy asm constraints Message-ID: References: <20221008145437.491-1-jszhang@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20221008145437.491-1-jszhang@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221012_062852_894396_6519B403 X-CRM114-Status: GOOD ( 20.15 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Hey Jisheng, LKP reported an error that seems to only have gone to myself & Samuel, but the branch it's complaining about is your v1: https://lore.kernel.org/lkml/202210122123.Cc4FPShJ-lkp@intel.com/ Any idea what the story is here? Thanks, Conor. On Sat, Oct 08, 2022 at 10:54:37PM +0800, Jisheng Zhang wrote: > Samuel reported that the static branch usage in cpu_relax() breaks > building with CONFIG_CC_OPTIMIZE_FOR_SIZE: > > In file included from : > ./arch/riscv/include/asm/jump_label.h: In function 'cpu_relax': > ././include/linux/compiler_types.h:285:33: warning: 'asm' operand 0 > probably does not match constraints > 285 | #define asm_volatile_goto(x...) asm goto(x) > | ^~~ > ./arch/riscv/include/asm/jump_label.h:41:9: note: in expansion of macro > 'asm_volatile_goto' > 41 | asm_volatile_goto( > | ^~~~~~~~~~~~~~~~~ > ././include/linux/compiler_types.h:285:33: error: impossible constraint > in 'asm' > 285 | #define asm_volatile_goto(x...) asm goto(x) > | ^~~ > ./arch/riscv/include/asm/jump_label.h:41:9: note: in expansion of macro > 'asm_volatile_goto' > 41 | asm_volatile_goto( > | ^~~~~~~~~~~~~~~~~ > make[1]: *** [scripts/Makefile.build:249: > arch/riscv/kernel/vdso/vgettimeofday.o] Error 1 > make: *** [arch/riscv/Makefile:128: vdso_prepare] Error 2 > > Maybe "-Os" prevents GCC from detecting that the key/branch arguments > can be treated as constants and used as immediate operands. Inspired > by x86's commit 864b435514b2("x86/jump_label: Mark arguments as const to > satisfy asm constraints"), and as pointed out by Steven: "The "i" > constraint needs to be a constant.", let's do similar modifications to > riscv. > > Tested by CC_OPTIMIZE_FOR_SIZE + gcc and CC_OPTIMIZE_FOR_SIZE + clang. > > Link: https://lore.kernel.org/linux-riscv/20220922060958.44203-1-samuel@sholland.org/ > Link: https://lore.kernel.org/all/20210212094059.5f8d05e8@gandalf.local.home/ > Fixes: 8eb060e10185 ("arch/riscv: add Zihintpause support") > Reported-by: Samuel Holland > Signed-off-by: Jisheng Zhang > Reviewed-by: Andrew Jones > --- > > since v1: > - add Reported-by, Reviewed-by, Fixes and Link tag > > arch/riscv/include/asm/jump_label.h | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/arch/riscv/include/asm/jump_label.h b/arch/riscv/include/asm/jump_label.h > index 38af2ec7b9bf..6d58bbb5da46 100644 > --- a/arch/riscv/include/asm/jump_label.h > +++ b/arch/riscv/include/asm/jump_label.h > @@ -14,8 +14,8 @@ > > #define JUMP_LABEL_NOP_SIZE 4 > > -static __always_inline bool arch_static_branch(struct static_key *key, > - bool branch) > +static __always_inline bool arch_static_branch(struct static_key * const key, > + const bool branch) > { > asm_volatile_goto( > " .option push \n\t" > @@ -35,8 +35,8 @@ static __always_inline bool arch_static_branch(struct static_key *key, > return true; > } > > -static __always_inline bool arch_static_branch_jump(struct static_key *key, > - bool branch) > +static __always_inline bool arch_static_branch_jump(struct static_key * const key, > + const bool branch) > { > asm_volatile_goto( > " .option push \n\t" > -- > 2.37.2 > _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv