Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3577724ybb; Mon, 6 Apr 2020 11:21:03 -0700 (PDT) X-Google-Smtp-Source: APiQypJALdbBKIj8EI0IjrH2Qta72V4K8A+q+1dlkXtv0tMuvbdOo9SranY3Xm87ANxonD/qnMyt X-Received: by 2002:aca:b8c5:: with SMTP id i188mr533408oif.2.1586197262882; Mon, 06 Apr 2020 11:21:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586197262; cv=none; d=google.com; s=arc-20160816; b=Ehr6L3TR+C1er3LtyY+V/+5LFcF2N+BIMZd2v3jYpxNAkdJx3cWke9tonEBxGzYY6W LhQAlyZZJIfgKpV3Tea0RV/OeWubW+w65WH5/RG6aCxJ4236+uD14IEFCq5z5WNIZMc7 M6yF78j3IHWCikwiAvAlq2mR9cfZvEDh2jIBcxQk6MhlpaSCzNPLmODDixfQVCp7VxTq R7rVwSw2VtyVWWnpxIi/xJBQ8TlMRmaXO53fMMf05tFjSeXPhZw2VWCYDnBXlKy4HPw7 vk9E0lexhklO1T9B48FAnIn0yu52sRrRJBxkd6JlrBBb/aNpkYyUxYDxPwGRthqFUfm7 /LjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=yZgIn2IQa50rMQP6WmsKiaEb+lPusPUrp+Nx/nDnY70=; b=QI2K8Y/Vimr2TG5vEeVIpaB1JyPuxtMclNT5Y8HZ1QYQhiF3ZCfz2gFJaC0biGf+vD 0cyuXAIua86Mi9RQ5XEHo9PAlc60Mz5A2+kx+Qd1yGdfCu+mtk6FghqHd7LdN4z+Mr3Q o6y+oEJeLa7YLiyMj7ws884pzEVUHPbSMotdaxIPdJ9yruwMpiTCGhm6zF1gvv5Y5mmK mAZizumfrAsXMgYBMiHL1AiXN7J2wBLnS8YMjd24MwWTvq298wAIZAzEFIFY9iYzisAD pol2jFvX2zzCN/IytI3Mgn5AuFTWZYh3QL7EXJblIklreXzcqLjROY8KnLTiURjfL0uz dHKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=slRBn5fT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b17si138343otq.269.2020.04.06.11.20.42; Mon, 06 Apr 2020 11:21:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=slRBn5fT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726633AbgDFSTZ (ORCPT + 99 others); Mon, 6 Apr 2020 14:19:25 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:23180 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726521AbgDFSTZ (ORCPT ); Mon, 6 Apr 2020 14:19:25 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 48wzMb6ZVxz9v0BM; Mon, 6 Apr 2020 20:19:23 +0200 (CEST) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=slRBn5fT; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id WPQRn9erC4S7; Mon, 6 Apr 2020 20:19:23 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 48wzMb53Pmz9v0BL; Mon, 6 Apr 2020 20:19:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1586197163; bh=yZgIn2IQa50rMQP6WmsKiaEb+lPusPUrp+Nx/nDnY70=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=slRBn5fT//wm9OLrPXBHGltusxm9LC0swUDaHARxkWwQj9hvtfZPNC/5jxkuC01F8 CUSf3zEDTK8xLLy+0ZWmXxsCpneAedlzp/9AcRr0qW47bUrTd5aHoe2Mipju9Fdxw1 vMWAVmp5/MXf/hwOEVFNiRfoMv6BivHGuXJqCNbU= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id A3FB38B784; Mon, 6 Apr 2020 20:19:23 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id G779_yM4ui7G; Mon, 6 Apr 2020 20:19:23 +0200 (CEST) Received: from [192.168.4.90] (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 1B2C78B775; Mon, 6 Apr 2020 20:19:23 +0200 (CEST) Subject: Re: [RFC PATCH v2 11/13] powerpc/syscall: Avoid stack frame in likely part of syscall_call_exception() To: Nicholas Piggin , Benjamin Herrenschmidt , Michael Ellerman , msuchanek@suse.de, Paul Mackerras Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org References: <029e1064b1ad738785718221ea468c9cfc282457.1586108649.git.christophe.leroy@c-s.fr> <1586136357.atgut3zasc.astroid@bobo.none> From: Christophe Leroy Message-ID: <2447d216-1948-c121-4843-6ae5cac6f377@c-s.fr> Date: Mon, 6 Apr 2020 20:19:18 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <1586136357.atgut3zasc.astroid@bobo.none> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 06/04/2020 à 03:29, Nicholas Piggin a écrit : > Christophe Leroy's on April 6, 2020 3:44 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 syscall_call_exception() >> >> Before : 353 cycles on null_syscall >> After : 347 cycles on null_syscall >> [...] >> >> Signed-off-by: Christophe Leroy >> --- >> arch/powerpc/kernel/syscall.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/arch/powerpc/kernel/syscall.c b/arch/powerpc/kernel/syscall.c >> index 69d75fc4a5eb..630c423e089a 100644 >> --- a/arch/powerpc/kernel/syscall.c >> +++ b/arch/powerpc/kernel/syscall.c >> @@ -91,6 +91,8 @@ notrace long system_call_exception(long r3, long r4, long r5, >> >> } else if (unlikely(r0 >= NR_syscalls)) { >> return -ENOSYS; >> + } else { >> + r3 = regs->orig_gpr3; >> } > > So this just gives enough volatiles to avoid spilling to stack? I wonder > about other various options here if they would cause a spill anyway. > > Interesting optimisation, it would definitely need a comment. Would be > nice if we had a way to tell the compiler that a local can be reloaded > from a particular address. Ok, comment added. Christophe