Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1876715rwi; Tue, 11 Oct 2022 01:25:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4UfJ1mY1rt505/Ucbgq2UANFmM+ooawMmOSN31+50X2Ppzpoqj5r5WVaaZDNCa7f5lpM6Z X-Received: by 2002:a17:90a:5914:b0:20a:ea11:2620 with SMTP id k20-20020a17090a591400b0020aea112620mr25709328pji.34.1665476698791; Tue, 11 Oct 2022 01:24:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665476698; cv=none; d=google.com; s=arc-20160816; b=LyWh/7JRT6Q0hGO9Ejqw0CRejrb9tt8RiQC84SaNcGcSJJIDJZsorQsAymwl6iP0uZ s7JGKHH8tiGovkJbGnho7PHKwgtPPxHBXNOgSv/GXn0rICI1HlXkUaR/5y5OHbxWnP4r j+htnS21fFV6j2s5kaV0ihQvvdzvn5X/Lye5t/7m22lOl+EotORWP3E8a/WCJNg4IFeb bMU9deTiUORukAuo46N6DB57BXa5EMPhenZBxthhtqKDPeULTCMQ3y+Aa83fybx2odat Wu+pV4YaCV66wf72H7nWn2cgRNjO5msMHbq1d48cUCBtiib1lsYjCrGK4OxD7ykrGaMd RXNA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=4TBz4kCks9G6w6Yduun9NaaOIRAzf+CGZlfsXSRmBwo=; b=gkJPj1k+H0G/MOYm4yyo7c7F5dFBALjL0rvHmU9RPvHUWtyKT6Er7PjWlivV7KpbwC WMCxle8b34h+3V6Mo6N42kU/nnYhlFKY47lCmmJmfaQOJbrO+j21mG62XVyAgIEuF/vS aIEVK4qJ7C7Kj/bMhGpL6En3197Tz2jN6PqmY6prdB9MFHxjfJCn5JMf5a9HgrzG6s2j duj9JTdr/EEey15RV0AAgpsOLcqv86OTaQZtAo7ReJ6tYWnsXIbDVnVcZLuyoxzpKlYD 4UZXyNhkzNqxttP3vTn935sjmh+XygXBTPIFEfr10uisEzrmDZ307WvDroKryRjs4BGc NbQA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=sntech.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cj12-20020a056a00298c00b0054307ac90f1si12825727pfb.319.2022.10.11.01.24.47; Tue, 11 Oct 2022 01:24:58 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=sntech.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229838AbiJKHjo (ORCPT + 99 others); Tue, 11 Oct 2022 03:39:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229483AbiJKHjk (ORCPT ); Tue, 11 Oct 2022 03:39:40 -0400 Received: from gloria.sntech.de (gloria.sntech.de [185.11.138.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46B361B0 for ; Tue, 11 Oct 2022 00:39:35 -0700 (PDT) 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 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS, T_SPF_HELO_TEMPERROR 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 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