Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp591356rwb; Thu, 6 Oct 2022 01:26:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7q+u6PTSisqCDkj+kzW/1KcUXNVbd+vBj+T4o2IeVstREpvqCHPBhcwtELXQibzsvg7vcx X-Received: by 2002:a17:902:d894:b0:179:e82d:a0a2 with SMTP id b20-20020a170902d89400b00179e82da0a2mr3462641plz.16.1665044815656; Thu, 06 Oct 2022 01:26:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665044815; cv=none; d=google.com; s=arc-20160816; b=mA9h57zJJsy7S8Anc/SXUVJpwvRjW6ru3cF0/TSzybzFruwb1NG3bAEO94pqdoaajT ME0c80hFoN68sgMaiHcxaenc/H9Dwqka7y/+cCm6WVfAt9U3C5V2vhAnEZkk1ZdAk43B oAdOHJ9mrPXGML3p3ewDL+25usv6qCxk1dckZs4V+lfRFZHBc2RaAXVgXC60JUYfAY7E 0GjMaBTJy8KjSIIG1b4tP/saTwgiTL/fBUTD+WfR7DANPKff851/E+GUJKKFL8RwDL+L 2jxlKwN9ju+Z6n0Fn/nQ6CTPUCbd5nrYjwxyitE9y0O+Mfczj3ALOCnW50kjiIwt9D6p Y5hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=l+VA15k9ZpzTRS394N/ofC610qzfdjvvPIVSI8yJ9xU=; b=lZR7Mc1Wx/C9/28yHGO4d3FW2JXRW8Yu/JYWQDQA+l+4MgMTH2ddZ/T+HkHAFtBmM1 I4kPNR1cO35KLyUTqoGv5jiJYnkIep3/+84dehoiltp0vzgzU+FinnYrf1OxNurJwfR6 C9utx14RQm5hNUh4d7praulxgobQYxxmKE2nN4igdjXDMaUZmZgO9TX3ZbIjjc/BKS3y YnrQq0GiHSLoXYliTlYIwDXNcnCUJPP3GCgtxzNzj2TKKLC4/wEwQdE1RVmAlCTr4Vkp zomSuPAnO9f2fDApFYvmyCHyGDmD4gcpYpyE5/d6Ldt20lMD/pFnRrVTvDMm5f6F87Ey GxzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tI0J0Wnf; 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 y189-20020a6232c6000000b0055345e08029si17258579pfy.266.2022.10.06.01.26.44; Thu, 06 Oct 2022 01:26:55 -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=tI0J0Wnf; 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 S230466AbiJFISG (ORCPT + 99 others); Thu, 6 Oct 2022 04:18:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230340AbiJFISE (ORCPT ); Thu, 6 Oct 2022 04:18:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89E6A77543 for ; Thu, 6 Oct 2022 01:18:00 -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 ams.source.kernel.org (Postfix) with ESMTPS id 3A1F3B82037 for ; Thu, 6 Oct 2022 08:17:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1B29C43140 for ; Thu, 6 Oct 2022 08:17:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1665044277; bh=sPYhHQSN08fPJZJXmiJjpYtAxcNKjsgm0ubxG7uLtzk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=tI0J0WnfQHk3JuV8Eq24CSgeSDYJv+GEEjqpHDqS4KWNOPgl6e37MMRL1dHqRmAmv IF8oLcgN4nQITykoZuxmIqUEsSouqVUbgoqYcOUQSVeY5K2swQPOlmVZ4la4BYmyA1 DhmuSda7I+L4XV72hbwXnD6I5na8Jba6TLAFtgYnNnth0f8bHtc/LNu1aRB6FVqmKo C0HRW/As50FLmKhowOAzu4lF7+AWM1JBL4UKgSXucMKN8tLa3Ivosfw7k08ORsxIQE tJv2PedMdp5K/Tb2KECjkh6gDp2FO/Smaw3O35V9BHAKhSYYh1hfgZeIRHjXI9urIa it1EW5pIBIUEg== Received: by mail-lj1-f181.google.com with SMTP id s10so1352323ljp.5 for ; Thu, 06 Oct 2022 01:17:57 -0700 (PDT) X-Gm-Message-State: ACrzQf3Woo+d+fkrVa7SXYBjVbrtVQe7n497WET+bHldjYPPqcOZTYtW 9BHIwlCVQE/N40q1jh9aLMw0LJ8qzPnf7W0CCl0= X-Received: by 2002:a2e:b7d5:0:b0:26d:e725:bd35 with SMTP id p21-20020a2eb7d5000000b0026de725bd35mr1193586ljo.69.1665044275730; Thu, 06 Oct 2022 01:17:55 -0700 (PDT) MIME-Version: 1.0 References: <20221006075542.2658-1-jszhang@kernel.org> <20221006075542.2658-2-jszhang@kernel.org> In-Reply-To: <20221006075542.2658-2-jszhang@kernel.org> From: Ard Biesheuvel Date: Thu, 6 Oct 2022 10:17:44 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/2] arm64: jump_label: mark arguments as const to satisfy asm constraints To: Jisheng Zhang Cc: Catalin Marinas , Will Deacon , Peter Zijlstra , Josh Poimboeuf , Jason Baron , Steven Rostedt , Mark Rutland , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.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 Thu, 6 Oct 2022 at 10:05, Jisheng Zhang wrote: > > Inspired by x86 commit 864b435514b2("x86/jump_label: Mark arguments as > const to satisfy asm constraints"), mark arch_static_branch()'s and > arch_static_branch_jump()'s arguments as const to satisfy asm > constraints. And Steven in [1] also pointed out that "The "i" > constraint needs to be a constant." > > Tested with building a simple external kernel module with "O0". > > [1]https://lore.kernel.org/all/20210212094059.5f8d05e8@gandalf.local.home/ > > Signed-off-by: Jisheng Zhang > --- > arch/arm64/include/asm/jump_label.h | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/arch/arm64/include/asm/jump_label.h b/arch/arm64/include/asm/jump_label.h > index cea441b6aa5d..48ddc0f45d22 100644 > --- a/arch/arm64/include/asm/jump_label.h > +++ b/arch/arm64/include/asm/jump_label.h > @@ -15,8 +15,8 @@ > > #define JUMP_LABEL_NOP_SIZE AARCH64_INSN_SIZE > > -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: nop \n\t" Is this still necessary if we specify the constraints in a more reasonable manner: " .quad %c0 - . + %1 \n\t" : : "i"(key), "i"(branch) : : l_yes); instead of the horrid hack with the char* cast and using a bool as an array index? > @@ -32,8 +32,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( > "1: b %l[l_yes] \n\t" > -- > 2.37.2 >