From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 067FBC433E0 for ; Wed, 10 Feb 2021 02:27:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C9B3464E32 for ; Wed, 10 Feb 2021 02:27:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235178AbhBJC0h (ORCPT ); Tue, 9 Feb 2021 21:26:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235191AbhBJB5Q (ORCPT ); Tue, 9 Feb 2021 20:57:16 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB13EC061756 for ; Tue, 9 Feb 2021 17:56:35 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id e9so351064plh.3 for ; Tue, 09 Feb 2021 17:56:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=cujEpEkxco6B8FhFOweauGZMK6zlCmv92EUaCj1tfZU=; b=QcB3JRfzVYnUQKD4IJqERWsSeLYwfEHpJ5NGQfTXsDT2iBtVBJrKBYZB/3BvissB96 b81RVHnG94ZBmU2/7MkhzEwUuW3SfpukAisiI8EgrpVB4muQPHBJRlX5YYayteadex4n l0Q65zSqJKetfa2EuqteJV/vKyOu6CIO49lBRssfiOAI7ztW9wosy93mgL9/1whL+rkm xbc+T8P+zRK/mNvcXK1fNTgIJsTwFpf4vH3VSGfAzCTjKbbCRLPjAsspCpzquYoAUCNz AWZjdDR7fOIOp9gBMZXNUaEuaGlWydZUXv/P2rGGcx6x5Y+Uz659BM7RKu18uTZQUEEV pThA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=cujEpEkxco6B8FhFOweauGZMK6zlCmv92EUaCj1tfZU=; b=QPsaLr7m3WLqbt5waAJ7g63F+iahXaT1zGkndFvprPtvunOQPJv4j1ehD6qmsq8RGY VTar9X+yv0+QxsYFE3z7WsZBIVvv+O8zqcl/MPKFE/UYIONGMBEunctCLuR1JyBKd3Fa h2RyXtwvq3OBkfyQHuPjYOKX1zo5XMLTZALIc6PBfzhT2fTh26rakITdCHxPcP2wRuMI +T+GgJOvfpZp8+/B6iqgiXZHq0RzH7dPp8XpCbJCYPZhKSOmiEYxNWsduxctVqrnY/KV SnMbY3QmqjGUmxPS9QSRTGmmWIMgBEpevuw7QBR5kKvfxz8eztzrLc5yFmefbZmILexs rEdA== X-Gm-Message-State: AOAM532EBbG11nRLELCm01tGPI3xbUDuoHW7BTiTIu1Fpm6C7LTPL/qo aAtGOi2wS70djo8G/6SKZMU= X-Google-Smtp-Source: ABdhPJzdG85BEtQNWf1RRd3yZaTPVEmX/rJLwzoukFhBukSeHLFyF5kK9HUhgm9mwpbTrI97H94B9A== X-Received: by 2002:a17:90a:5601:: with SMTP id r1mr761643pjf.236.1612922195487; Tue, 09 Feb 2021 17:56:35 -0800 (PST) Received: from localhost (14-201-150-91.tpgi.com.au. [14.201.150.91]) by smtp.gmail.com with ESMTPSA id bk12sm279994pjb.1.2021.02.09.17.56.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Feb 2021 17:56:34 -0800 (PST) Date: Wed, 10 Feb 2021 11:56:28 +1000 From: Nicholas Piggin Subject: Re: [PATCH v5 16/22] powerpc/syscall: Avoid stack frame in likely part of system_call_exception() To: Benjamin Herrenschmidt , Christophe Leroy , Michael Ellerman , msuchanek@suse.de, Paul Mackerras Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org References: <981edfd50d4c980634b74c4bb76b765c499a87ec.1612796617.git.christophe.leroy@csgroup.eu> <1612834634.qle1lc7n6y.astroid@bobo.none> In-Reply-To: MIME-Version: 1.0 Message-Id: <1612921956.st2b8xlrew.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Excerpts from Christophe Leroy's message of February 10, 2021 2:13 am: >=20 >=20 > Le 09/02/2021 =C3=A0 02:55, Nicholas Piggin a =C3=A9crit=C2=A0: >> Excerpts from Christophe Leroy's message of February 9, 2021 1:10 am: >>> When r3 is not modified, reload it from regs->orig_r3 to free >>> volatile registers. This avoids a stack frame for the likely part >>> of system_call_exception() >>=20 >> This doesn't on my 64s build, but it does reduce one non volatile >> register save/restore. With quite a bit more register pressure >> reduction 64s can avoid the stack frame as well. >=20 > The stack frame is not due to the registers because on PPC64 you have the= redzone that you don't=20 > have on PPC32. >=20 > As far as I can see, this is due to a call to .arch_local_irq_restore(). >=20 > On ppc32 arch_local_irq_restore() is just a write to MSR. Oh you're right there. We can actually inline fast paths of that I have=20 a patch somewhere, but not sure if it's worthwhile. >> It's a cool trick but quite code and compiler specific so I don't know >> how worthwhile it is to keep considering we're calling out into random >> kernel C code after this. >>=20 >> Maybe just keep it PPC32 specific for the moment, will have to do more >> tuning for 64 and we have other stuff to do there first. >>=20 >> If you are happy to make it 32-bit only then >=20 > I think we can leave without this, that's only one or two cycles won. Okay for this round let's drop it for now. Thanks, Nick From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09A1AC433E6 for ; Wed, 10 Feb 2021 01:59:42 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3F65464E45 for ; Wed, 10 Feb 2021 01:59:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F65464E45 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4Db2y13Gs8zDr1q for ; Wed, 10 Feb 2021 12:59:37 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:4864:20::1030; helo=mail-pj1-x1030.google.com; envelope-from=npiggin@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=QcB3JRfz; dkim-atps=neutral Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4Db2td61NWzDqTy for ; Wed, 10 Feb 2021 12:56:39 +1100 (AEDT) Received: by mail-pj1-x1030.google.com with SMTP id my11so2170855pjb.1 for ; Tue, 09 Feb 2021 17:56:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=cujEpEkxco6B8FhFOweauGZMK6zlCmv92EUaCj1tfZU=; b=QcB3JRfzVYnUQKD4IJqERWsSeLYwfEHpJ5NGQfTXsDT2iBtVBJrKBYZB/3BvissB96 b81RVHnG94ZBmU2/7MkhzEwUuW3SfpukAisiI8EgrpVB4muQPHBJRlX5YYayteadex4n l0Q65zSqJKetfa2EuqteJV/vKyOu6CIO49lBRssfiOAI7ztW9wosy93mgL9/1whL+rkm xbc+T8P+zRK/mNvcXK1fNTgIJsTwFpf4vH3VSGfAzCTjKbbCRLPjAsspCpzquYoAUCNz AWZjdDR7fOIOp9gBMZXNUaEuaGlWydZUXv/P2rGGcx6x5Y+Uz659BM7RKu18uTZQUEEV pThA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=cujEpEkxco6B8FhFOweauGZMK6zlCmv92EUaCj1tfZU=; b=UvSZM34ce+Whz6fVTelgsSzxurOFShrZ+enNDbZ7ugXpBb+RtugJZ1cLZTjnEuUPnx DGkbh0CPdpvZb5bAqLicY510EaFDTwMlRH2nQLgod9HhVYLp/HtLcjf9lSpLopmEI4IL CH50Pit+7m0f29tbh9wl6e2fN8TmzAc0Aap8L+XjkpMmwbeKWh6aRqpIsPpWVokS+pC/ bB8JxR/4oRf3AQDXRrFzoicsNkXNHoQ+4Z4mpvMdzjg/fUf4vQgQQXXCkijJRAvPK71P XYa3RjIOeCjCvl2uTwSlCrhWFknNJbL8C+UiVZt9RRtTeqTZULY2TR7pUgTNmlMMprLN KIWA== X-Gm-Message-State: AOAM533n5okQPlOIlc5N8DNLahVhDqX8VCRoEwf00d+jf2a8FCX4lGfG cMK7uP4RPtESQacOlLDln/s= X-Google-Smtp-Source: ABdhPJzdG85BEtQNWf1RRd3yZaTPVEmX/rJLwzoukFhBukSeHLFyF5kK9HUhgm9mwpbTrI97H94B9A== X-Received: by 2002:a17:90a:5601:: with SMTP id r1mr761643pjf.236.1612922195487; Tue, 09 Feb 2021 17:56:35 -0800 (PST) Received: from localhost (14-201-150-91.tpgi.com.au. [14.201.150.91]) by smtp.gmail.com with ESMTPSA id bk12sm279994pjb.1.2021.02.09.17.56.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Feb 2021 17:56:34 -0800 (PST) Date: Wed, 10 Feb 2021 11:56:28 +1000 From: Nicholas Piggin Subject: Re: [PATCH v5 16/22] powerpc/syscall: Avoid stack frame in likely part of system_call_exception() To: Benjamin Herrenschmidt , Christophe Leroy , Michael Ellerman , msuchanek@suse.de, Paul Mackerras References: <981edfd50d4c980634b74c4bb76b765c499a87ec.1612796617.git.christophe.leroy@csgroup.eu> <1612834634.qle1lc7n6y.astroid@bobo.none> In-Reply-To: MIME-Version: 1.0 Message-Id: <1612921956.st2b8xlrew.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Excerpts from Christophe Leroy's message of February 10, 2021 2:13 am: >=20 >=20 > Le 09/02/2021 =C3=A0 02:55, Nicholas Piggin a =C3=A9crit=C2=A0: >> Excerpts from Christophe Leroy's message of February 9, 2021 1:10 am: >>> When r3 is not modified, reload it from regs->orig_r3 to free >>> volatile registers. This avoids a stack frame for the likely part >>> of system_call_exception() >>=20 >> This doesn't on my 64s build, but it does reduce one non volatile >> register save/restore. With quite a bit more register pressure >> reduction 64s can avoid the stack frame as well. >=20 > The stack frame is not due to the registers because on PPC64 you have the= redzone that you don't=20 > have on PPC32. >=20 > As far as I can see, this is due to a call to .arch_local_irq_restore(). >=20 > On ppc32 arch_local_irq_restore() is just a write to MSR. Oh you're right there. We can actually inline fast paths of that I have=20 a patch somewhere, but not sure if it's worthwhile. >> It's a cool trick but quite code and compiler specific so I don't know >> how worthwhile it is to keep considering we're calling out into random >> kernel C code after this. >>=20 >> Maybe just keep it PPC32 specific for the moment, will have to do more >> tuning for 64 and we have other stuff to do there first. >>=20 >> If you are happy to make it 32-bit only then >=20 > I think we can leave without this, that's only one or two cycles won. Okay for this round let's drop it for now. Thanks, Nick