Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2490799pxb; Thu, 11 Feb 2021 13:51:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJyY5yb7yV0v4NWhKZ8IpIksyPmwBuTodKgrf1mCVFyAuZfDaQNs13lnn0EO3/uCY7s5mhxI X-Received: by 2002:aa7:d2c7:: with SMTP id k7mr185463edr.374.1613080299916; Thu, 11 Feb 2021 13:51:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613080299; cv=none; d=google.com; s=arc-20160816; b=Axdqbx86PdQFedsEw9uJRqXFvL8TO7PKDuquaaP0laYT5zqhn6ZrjicILi3eyJxZPS KSXu/IA0yWhdvPdUCDupNz+2A4uC0J5xekDPP1/cF3usbTeLUppJdL4Q0BZLlVPsS+JM 9yoHdu3cKGNvGplGV5P3MqRt0k+Wh/4PqR9AbqW/b9fHIWBmt+6lbPmQ6CONT5PRYB8V /d33+2pXg62P8p9z0NdjQ3n2+Jmo04Q2QkKAYspoNQbV4A9wutSGEi4h0fCjE8T8HFtP NnPpE6VHJ6LFpV/p8Uagm7kt8od6MnmGoWbf/scs2mTS4xr3A7irIU7/hqmvXLulnCZ8 BPKA== 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=n1LR8bXA8m9yKBLdWfg/9jF4Dd+6Hiiy3Cbm06YIqOE=; b=E9dzAZhpp+/CBBA/G8MQcn/+PLbXn38VS06zdSzNF/fxlyHcFL1B/4yJluTfhM4aat JV5VIa21UQf/SjuVo0Hi/XxIc2AGOUbO8zv7mM20vOt6wfHyj/IUoxDOGwMbgXaQTTLe +eZb54U7gyO8cRhMS+qyGNcKIjBa3+2qpjHvA1KG7eCXUmQkpaPVawnqqMQdAvk+KE6T oNf0siTUJI3nsiV9WDplneqtEl4uzJF0+V2dR83e+PDo/xgjLC12WKomThy0ELzhs/Gq 2yhbiuJZodN2xyGGcFbp8cx6udUzr/hB0kcJhG0vKpHgVYLNQivUxYE5VdSB0f9RGb6y jJXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AauGAUa8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id de28si4330811edb.466.2021.02.11.13.51.14; Thu, 11 Feb 2021 13:51:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=AauGAUa8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229642AbhBKVtb (ORCPT + 99 others); Thu, 11 Feb 2021 16:49:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbhBKVta (ORCPT ); Thu, 11 Feb 2021 16:49:30 -0500 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5E00C061574 for ; Thu, 11 Feb 2021 13:48:50 -0800 (PST) Received: by mail-pf1-x42e.google.com with SMTP id t29so4539619pfg.11 for ; Thu, 11 Feb 2021 13:48:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=n1LR8bXA8m9yKBLdWfg/9jF4Dd+6Hiiy3Cbm06YIqOE=; b=AauGAUa8Z69t8uDWvSpHf3f8FsUWV80P9nRC4+xUeA3Wq7qTN7D/38hTGgs/Bf4fi+ NfR89goWKn/X2atc8EfD77nAUyBn7PcZjfYv8Y06O9lmYnJeyFUVcoAQ1QClNjn6DDYa Dj3LWymwXnXepu8ou7LuHCyeD5DgIk4ET2Jl9is7SLCd74Sk5QEGlBYSIl5jJ0oyYMSA TITGHT0OXull26nXQf3y7ZmyfeLfAaa4Z/+mOFPs22dL83sJc4z8D2KGr4kVvUb7ppFG yrTInENIJU3fEHdmUZ3wnuuuD1FttHOQY2YNwqCOgXgmGdOEF/wSDYAMTji+1dks0u9N nbXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=n1LR8bXA8m9yKBLdWfg/9jF4Dd+6Hiiy3Cbm06YIqOE=; b=nJTucxxfod+DNh7zhJNDDMin4QuiBKUEETvXc8kPMrBt0+HgzoWAkRdC5d5Eul6TsI leyEzAIqfNz0pcDa4AdLwzmWfrThZxYbQXQe9iFB+4tKJTEIvbbILLOEBjzQAlUcaFPn 6nszDbigT2azBYA8hF229/sqwjwLllhWIhV69nxEeTPhFiZf2FcgdswoP6obF8++OwW3 YYnBai2mvgjs6BPj43B6priJ1dvMkRxghkAXvnBw9k4CysH1Oley3mlyO+gnAWV7PW7/ gdzPZp/FfLKSAhI7+PfmLN8wyLoGSEdtvYWAH4WsvY/KFpDyx5KJUmwZn+xdnJOa8J71 mF7w== X-Gm-Message-State: AOAM532kFjP6uW7hxKOLWJA9GRWzqLbqbaipeohdD34zXawD+EIJdzuT Fx5Dz80NGJChveNCnLvpEA/Y87Sg5upo4g== X-Received: by 2002:a63:4623:: with SMTP id t35mr169739pga.294.1613080130191; Thu, 11 Feb 2021 13:48:50 -0800 (PST) Received: from horus.lan (71-34-94-168.ptld.qwest.net. [71.34.94.168]) by smtp.gmail.com with ESMTPSA id j20sm6556609pfe.172.2021.02.11.13.48.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Feb 2021 13:48:49 -0800 (PST) From: Jason Gerecke X-Google-Original-From: Jason Gerecke To: linux-kernel@vger.kernel.org, Peter Zijlstra , Josh Poimboeuf , Jason Baron Cc: Jason Gerecke , Steven Rostedt , Ard Biesheuvel Subject: [PATCH] RFC: x86/jump_label: Mark arguments as const to satisfy asm constraints Date: Thu, 11 Feb 2021 13:48:48 -0800 Message-Id: <20210211214848.536626-1-jason.gerecke@wacom.com> X-Mailer: git-send-email 2.30.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When compiling an external kernel module with `-O0` or `-O1`, the following compile error may be reported: ./arch/x86/include/asm/jump_label.h:25:2: error: impossible constraint in ‘asm’ 25 | asm_volatile_goto("1:" | ^~~~~~~~~~~~~~~~~ It appears that these lower optimization levels prevent GCC from detecting that the key/branch arguments can be treated as constants and used as immediate operands. To work around this, explicitly add the `const` label. Signed-off-by: Jason Gerecke Cc: Steven Rostedt Cc: Ard Biesheuvel --- Marked RFC since I'm not familiar with this subsystem or the asm blocks that are impacted. Extra-close inspection would be appreciated. arch/x86/include/asm/jump_label.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/jump_label.h b/arch/x86/include/asm/jump_label.h index 06c3cc22a058..7f2006645d84 100644 --- a/arch/x86/include/asm/jump_label.h +++ b/arch/x86/include/asm/jump_label.h @@ -20,7 +20,7 @@ #include #include -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("1:" ".byte " __stringify(STATIC_KEY_INIT_NOP) "\n\t" @@ -36,7 +36,7 @@ static __always_inline bool arch_static_branch(struct static_key *key, bool bran 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("1:" ".byte 0xe9\n\t .long %l[l_yes] - 2f\n\t" -- 2.30.1