Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp330776iog; Wed, 15 Jun 2022 03:11:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxz6tDNHbDdJ2s4P4yB4kx4xrpGOs3kGoIPiJLWS5KxM6kj5PADMdzPTeUZYUmuwOxQ3q49 X-Received: by 2002:a63:4654:0:b0:405:e571:90b with SMTP id v20-20020a634654000000b00405e571090bmr8387508pgk.120.1655287867027; Wed, 15 Jun 2022 03:11:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655287867; cv=none; d=google.com; s=arc-20160816; b=VloD+SCbTVz6D2GuzoGtxSu6fJiSO7FIWqGbf+vFw3GT3N6PPLGHBeLUoPEYINliS/ co+xFFMPxAl3BanuWvgZOMtTACsXhtbN+fB1wgKMoEwbooc0IsnQlqTMhdS2N822/NJQ 61eBy4Uwwmat/Jt3vZ35puhV+F6wnIdMITjp7tTe0nX91jJub8HIc58Q+GVs/ak7E4hq eSyhV6rIFYPawcOhTmWDPW3xU099EPYQV7K6HE5uMNF2r7axG1DaIpY4oidGGLtwYc3Q P1JfjGVff6gmhTMGqrxxmcGDsKBUcdHjoPMVX+ofeHVHGheTuczJKrbJtjPLnKWiSf43 408A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=s1IaRtZasvIzrOppTcCHxpmQ4O7FpuXBBdUX/ktO+d4=; b=LbnC3LazDpZvzqVTScunHaR5xowSPBzqms248F409DC/czC9hCHyPDAJwWshdMGezC PIuxfKFiJb2VsMAChM4PmSzdNsO9u7eBO8J4vlHnJbA5UqnK70uaUVvLoCNyyzoag2xJ xyI1ukMMS8ky9rOND18CODMoigjaEmEcBAqo6g3wWBiJ63G+EEmhUzxKX9G71TmM92eo k6OZinbbzWTfm62m3+WCThJ4fDuTaec6HBrzKCpvckSv4SY62p+OZEeU+p0h0dRNQNQ/ 9c+D+s1q0LVajctvsIrA2rsUtQzUB9B6mQKQUpuEy+bvtdqUJz2eCbA2Y7IFa37FkhXF SQVA== 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=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h14-20020a63c00e000000b003c6dde2ad19si16506995pgg.26.2022.06.15.03.10.54; Wed, 15 Jun 2022 03:11:07 -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=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345362AbiFOJwy (ORCPT + 99 others); Wed, 15 Jun 2022 05:52:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236849AbiFOJwx (ORCPT ); Wed, 15 Jun 2022 05:52:53 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 10ECE167FB; Wed, 15 Jun 2022 02:52:51 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B2594152B; Wed, 15 Jun 2022 02:52:51 -0700 (PDT) Received: from FVFF77S0Q05N (unknown [10.57.38.208]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C56BF3F792; Wed, 15 Jun 2022 02:52:49 -0700 (PDT) Date: Wed, 15 Jun 2022 10:52:41 +0100 From: Mark Rutland To: Ard Biesheuvel Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Thomas Bogendoerfer , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , linux-mips@vger.kernel.org, linux-s390@vger.kernel.org Subject: Re: [PATCH 3/3] jump_label: make initial NOP patching the special case Message-ID: References: <20220608104512.1176209-1-ardb@kernel.org> <20220608104512.1176209-4-ardb@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220608104512.1176209-4-ardb@kernel.org> X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 Wed, Jun 08, 2022 at 12:45:12PM +0200, Ard Biesheuvel wrote: > Instead of defaulting to patching NOP opcodes at init time, and leaving > it to the architectures to override this if this is not needed, switch > to a model where doing nothing is the default. This is the common case > by far, as only MIPS requires NOP patching at init time. On all other > architectures, the correct encodings are emitted by the compiler and so > no initial patching is needed. > > Signed-off-by: Ard Biesheuvel > --- > Documentation/staging/static-keys.rst | 3 --- > arch/arc/kernel/jump_label.c | 13 ------------- > arch/arm/kernel/jump_label.c | 6 ------ > arch/arm64/kernel/jump_label.c | 11 ----------- > arch/mips/include/asm/jump_label.h | 2 ++ > arch/parisc/kernel/jump_label.c | 11 ----------- > arch/riscv/kernel/jump_label.c | 12 ------------ > arch/s390/kernel/jump_label.c | 5 ----- > arch/x86/kernel/jump_label.c | 13 ------------- > kernel/jump_label.c | 14 +++----------- > 10 files changed, 5 insertions(+), 85 deletions(-) I have one minor comment below, but either way this is a nice cleanup (and I'm always happy to see __weak functions disappear), so FWIW: Acked-by: Mark Rutland [...] > diff --git a/kernel/jump_label.c b/kernel/jump_label.c > index b1ac2948be79..ff8576c00893 100644 > --- a/kernel/jump_label.c > +++ b/kernel/jump_label.c > @@ -332,17 +332,9 @@ static int __jump_label_text_reserved(struct jump_entry *iter_start, > return 0; > } > > -/* > - * Update code which is definitely not currently executing. > - * Architectures which need heavyweight synchronization to modify > - * running code can override this to make the non-live update case > - * cheaper. > - */ > -void __weak __init_or_module arch_jump_label_transform_static(struct jump_entry *entry, > - enum jump_label_type type) > -{ > - arch_jump_label_transform(entry, type); > -} > +#ifndef arch_jump_label_transform_static > +#define arch_jump_label_transform_static(entry, type) > +#endif It might be slightly better to make this a static inline stub so that we always get the compiler to type-check it, e.g. | #ifndef arch_jump_label_transform_static | static inline void arch_jump_label_transform_static(struct jump_entry *entry, | enum jump_label_type type) | { | /* nothing to do on most architectures */ | } | #define arch_jump_label_transform_static arch_jump_label_transform_static | #endif Mark.