Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6834331rwd; Tue, 6 Jun 2023 02:36:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6RcVDZzD+gKtLXJBpaxtA4oTZBhXBdH80pbwLMgBguvjEHuBjHshRZ+/tf0qrLFPmggAkA X-Received: by 2002:a25:9d0d:0:b0:bab:af52:7482 with SMTP id i13-20020a259d0d000000b00babaf527482mr1681371ybp.34.1686044194286; Tue, 06 Jun 2023 02:36:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686044194; cv=none; d=google.com; s=arc-20160816; b=ZrdH5yBRywGRn0jcmwwUZeMGzsPHttUYox4//GyP9at5+Iq26/JIO7XUPLQ3UKcN10 3tE47DxjsqGRt0AX8vvbGmdRuMIZHJ3FtVz340Deqbtf8/kCJIPdgqSD8VAWlfT7q93G 4h3NdHTHJ97U4FVoPGsg38THBKvlqaCY1y4QpAqRkuo6W1oxhrbtB+sXu20CZ5Wf0JdW pU8niS7KO2yzWlbysI3i31/nrz44Nvo8kPlWfloePKg+siElqvGGv2TOX2IIjljce3X9 p8PqmpdfCpOMpUA4ymP5mtx0/cjQAMf5tGT8j3+zmqINi+0EFs2SrszOU+NRjGv5q+iS 7YmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:references:to:from:subject:cc :message-id:date:content-transfer-encoding:mime-version :dkim-signature; bh=N6kW28rRS95PBT40ZyGvD53ULubXonpBS0T08hlvYzY=; b=lma14AS2bVlANgecygVY2KK+GTg6tAf47i543wPiEqIak/ERxci9zgscT61fVl1B2T pqfPANhMoIda0+J96OdwJx+fyqrGgNBivEf369luj7IBy8S4WEEIwt5oj6rkIpCosu+e 69COO4DFWXHgoO+WkAsvvnuHjqLoVh0UZDf48gsBXG4RA7kWjAS6afM/13h7WigMOGkZ lFJp1q99J8FxJIVAykG91yKN9k805H6xb6mZbxGK9r18Xy8f91Bn8SG2GW54TXZDJnQW f6kvef3ODrftek8WTr5O/DnTVWcunzGbuZGaaO+Mt+p55TIRn9TWoutGAnwCYof1UqXo uiXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=dPR7PAcB; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gq24-20020a17090b105800b00256a3130dcasi8753327pjb.160.2023.06.06.02.36.22; Tue, 06 Jun 2023 02:36:34 -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=@gmail.com header.s=20221208 header.b=dPR7PAcB; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236370AbjFFI7m (ORCPT + 99 others); Tue, 6 Jun 2023 04:59:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230499AbjFFI7l (ORCPT ); Tue, 6 Jun 2023 04:59:41 -0400 Received: from mail-yb1-xb34.google.com (mail-yb1-xb34.google.com [IPv6:2607:f8b0:4864:20::b34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74E1818E for ; Tue, 6 Jun 2023 01:59:39 -0700 (PDT) Received: by mail-yb1-xb34.google.com with SMTP id 3f1490d57ef6-bad97da58adso7375905276.1 for ; Tue, 06 Jun 2023 01:59:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686041978; x=1688633978; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=N6kW28rRS95PBT40ZyGvD53ULubXonpBS0T08hlvYzY=; b=dPR7PAcBEbq14AyijUdKPeY9aopH5oxf/XU5xNmYSoOyjYqERl9cm3yey7nh0m1wiS 1fQw4PTKPUr1LJE40ZZd38eOjy07GYhYSuKlqSPiw9DGP2NV1Aew+xNyenr+gJKvfyEv Y673QHzNp/7uVnjx13QJvFKmESHWi+kGU/7hSOalAPdHTdKRkE5GkH2WPHuEeLevB7hY fg6S/VW2ocpOzz2HcK6UtqUmuV68T5KMZHULgMQU8YeFJ/522xFXPPa4x+MmRNG7uo3B Ir72yEqU5vuJXbw10qlB+t+kNprQd5pxm7t7+R4QcijkqpA6eNRyCE7+kDOarN9nzyr+ ZNiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686041978; x=1688633978; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=N6kW28rRS95PBT40ZyGvD53ULubXonpBS0T08hlvYzY=; b=J+cJmtPnb3NgcxxAQGPKnli+3AWHAMCENishhA5YsvFAZxaC+bO9R7EXj4S0FRMv+a B4lgjZQWjkcOSeDSrtF1J6jgRx4aKCK8cj21J+X74oxHDcyzrhn7LBRkJ6dAlUJAx2hW 05K6d93FR8IfTHkrtbZFF85gsDLtfGyW0qSRvvppFp5gZMQcRQwJaH9oKXn0g4zFFrti 4YMj/G51B1EQxFPQhvbWjRCWTDbR1ErjZvPZPyy6H+iV1y9FpgWz9+UdRpUo5Hy1riem jUAYBli8nmVvWcJmFZTm3V0mLHrqhd9TJRc+b3IkRtqTR5lXnxlldap8wXTowQezvUFn qZUA== X-Gm-Message-State: AC+VfDxvWeC7EL7TLhdC5pFBFih0F/F5t/Af4v1rpSUcX7+z/vMJc8Ex mlb21JCNd/yM8+zzG4t97aX25ke4RbY= X-Received: by 2002:a25:c382:0:b0:bb3:b0ab:d626 with SMTP id t124-20020a25c382000000b00bb3b0abd626mr485746ybf.31.1686041978611; Tue, 06 Jun 2023 01:59:38 -0700 (PDT) Received: from localhost ([203.221.142.9]) by smtp.gmail.com with ESMTPSA id o1-20020a17090ab88100b0024dfbac9e2fsm9010107pjr.21.2023.06.06.01.59.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Jun 2023 01:59:37 -0700 (PDT) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 06 Jun 2023 18:58:46 +1000 Message-Id: Cc: , Subject: Re: [PATCH] powerpc/signal32: Force inlining of __unsafe_save_user_regs() and save_tm_user_regs_unsafe() From: "Nicholas Piggin" To: "Christophe Leroy" , "Michael Ellerman" X-Mailer: aerc 0.14.0 References: <7e469c8f01860a69c1ada3ca6a5e2aa65f0f74b2.1685955220.git.christophe.leroy@csgroup.eu> In-Reply-To: <7e469c8f01860a69c1ada3ca6a5e2aa65f0f74b2.1685955220.git.christophe.leroy@csgroup.eu> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 Mon Jun 5, 2023 at 6:58 PM AEST, Christophe Leroy wrote: > Looking at generated code for handle_signal32() shows calls to a > function called __unsafe_save_user_regs.constprop.0 while user access > is open. > > And that __unsafe_save_user_regs.constprop.0 function has two nops at > the begining, allowing it to be traced, which is unexpected during > user access open window. > > The solution could be to mark __unsafe_save_user_regs() no trace, but > to be on the safe side the most efficient is to flag it __always_inline > as already done for function __unsafe_restore_general_regs(). The > function is relatively small and only called twice, so the size > increase will remain in the noise. > > Do the same with save_tm_user_regs_unsafe() as it may suffer the > same issue. Could you put a comment so someone doesn't uninline it later? Marking it notrace as well would be sufficient for a comment, if that works. Thanks, Nick > > Fixes: ef75e7318294 ("powerpc/signal32: Transform save_user_regs() and sa= ve_tm_user_regs() in 'unsafe' version") > Signed-off-by: Christophe Leroy > --- > arch/powerpc/kernel/signal_32.c | 15 +++++++++------ > 1 file changed, 9 insertions(+), 6 deletions(-) > > diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal= _32.c > index c114c7f25645..7a718ed32b27 100644 > --- a/arch/powerpc/kernel/signal_32.c > +++ b/arch/powerpc/kernel/signal_32.c > @@ -264,8 +264,9 @@ static void prepare_save_user_regs(int ctx_has_vsx_re= gion) > #endif > } > =20 > -static int __unsafe_save_user_regs(struct pt_regs *regs, struct mcontext= __user *frame, > - struct mcontext __user *tm_frame, int ctx_has_vsx_region) > +static __always_inline int > +__unsafe_save_user_regs(struct pt_regs *regs, struct mcontext __user *fr= ame, > + struct mcontext __user *tm_frame, int ctx_has_vsx_region) > { > unsigned long msr =3D regs->msr; > =20 > @@ -364,8 +365,9 @@ static void prepare_save_tm_user_regs(void) > current->thread.ckvrsave =3D mfspr(SPRN_VRSAVE); > } > =20 > -static int save_tm_user_regs_unsafe(struct pt_regs *regs, struct mcontex= t __user *frame, > - struct mcontext __user *tm_frame, unsigned long msr) > +static __always_inline int > +save_tm_user_regs_unsafe(struct pt_regs *regs, struct mcontext __user *f= rame, > + struct mcontext __user *tm_frame, unsigned long msr) > { > /* Save both sets of general registers */ > unsafe_save_general_regs(¤t->thread.ckpt_regs, frame, failed); > @@ -444,8 +446,9 @@ static int save_tm_user_regs_unsafe(struct pt_regs *r= egs, struct mcontext __user > #else > static void prepare_save_tm_user_regs(void) { } > =20 > -static int save_tm_user_regs_unsafe(struct pt_regs *regs, struct mcontex= t __user *frame, > - struct mcontext __user *tm_frame, unsigned long msr) > +static __always_inline int > +save_tm_user_regs_unsafe(struct pt_regs *regs, struct mcontext __user *f= rame, > + struct mcontext __user *tm_frame, unsigned long msr) > { > return 0; > } > --=20 > 2.40.1