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 CB138C433FE for ; Tue, 11 Oct 2022 07:39:45 +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:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kdvt+jABhVUG8M/EbmZ1oW8I2qjwX+/xmT5pjjsujrk=; b=2tq/qEH0OjjUfm mpAIq3XkAllvKOzR7ePds6DdoukGZ66dshCF4B2OitjhkyFevhGWFo9xLUKs90zSUognhqVqDl04z 0HWFx7qoR9DqLeHEWEz9+6Aj3SCl0ikmBoTnMPBhxnBK9+mM1jga6LEIMjNNL7mV0gS1H0YzV1aYE BN4KsP7PSUvy8/VcvS88Mm2lU0GQlymF6yrn+vObEC1ORRKq5rg8pcsHcHVoLyTy+5X1UACnUl01N TxqukhldaleLos264IcVGBrYtF5YsCROV2+lRuPqLJm70A+Oprh+xXAP0TB0jTY8JBuWY/Lwt3GpW qvP1dVONmImu1oeswXQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oi9rU-003c3H-Ro; Tue, 11 Oct 2022 07:39:36 +0000 Received: from gloria.sntech.de ([185.11.138.130]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oi9rS-003c2C-AQ for linux-riscv@lists.infradead.org; Tue, 11 Oct 2022 07:39:35 +0000 Received: from p5b127dea.dip0.t-ipconnect.de ([91.18.125.234] helo=phil.localnet) by gloria.sntech.de with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1oi9r9-0007Gg-5z; Tue, 11 Oct 2022 09:39:15 +0200 From: Heiko Stuebner To: Peter Zijlstra , Josh Poimboeuf , Jason Baron , Steven Rostedt , Ard Biesheuvel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Nathan Chancellor , Nick Desaulniers , Tom Rix , linux-riscv@lists.infradead.org Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Samuel Holland , Andrew Jones , Jisheng Zhang Subject: Re: [PATCH v2] riscv: jump_label: mark arguments as const to satisfy asm constraints Date: Tue, 11 Oct 2022 09:39:14 +0200 Message-ID: <2905332.q0ZmV6gNhb@phil> In-Reply-To: <20221008145437.491-1-jszhang@kernel.org> References: <20221008145437.491-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221011_003934_370899_8F31BD9F X-CRM114-Status: GOOD ( 12.92 ) 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 Am Samstag, 8. Oktober 2022, 16:54:37 CEST schrieb Jisheng Zhang: > 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 I ran into the same build-issue when enabling CC_OPTIMIZE_FOR_SIZE and this patch fixes it, so Tested-by: Heiko Stuebner _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv