From patchwork Thu Sep 15 09:03:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 670280 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sZXYk08L0z9s3v for ; Thu, 15 Sep 2016 19:05:14 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=nbimNnhX; dkim-atps=neutral Received: from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3sZXYj6B61zDsYn for ; Thu, 15 Sep 2016 19:05:13 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=nbimNnhX; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-pa0-x244.google.com (mail-pa0-x244.google.com [IPv6:2607:f8b0:400e:c03::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3sZXX85Z5fzDsWc for ; Thu, 15 Sep 2016 19:03:52 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=nbimNnhX; dkim-atps=neutral Received: by mail-pa0-x244.google.com with SMTP id pp5so1888318pac.2 for ; Thu, 15 Sep 2016 02:03:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=9YIVcfRN+rcxF3cHoKFA3Br3NMB/m6JcZ81VmZ/3Yvk=; b=nbimNnhXVMBuN4doCAsrWcYKWCYgfE92NkLjGTdId+rb3Nl6MokkFy9nwmqiK1DeGd Mv6j0zZ6y5krAnKNiG86MUcjRlKwdPncpEQI3YS+VAhJWmYuXB4YRgdLayzTr/ZQBmO4 D4t0o0Rxhih46ULmZfNICDAJuM+L5H95FFmbPy+LuZskFyAbKHefayC3NnGi6BPADBJ/ ywBx2HaWQnBZ9UMMG+lrHXqH2FuY4f7CUlSNhj06BQ2QApWCzYqcBhKepBKoq6es+enB 5hKbXZlgx2903iRKgZp5S46QNxVB/70cVXALiPavoAshvNsdIDBY/4sqR5Yn9jXyEEyF nwkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9YIVcfRN+rcxF3cHoKFA3Br3NMB/m6JcZ81VmZ/3Yvk=; b=gpQAINqd+SkTKwqigQJf/E/ebG+Gr8fRaBbO1jrUFDaB01VNRJKitfrzFjVMPEBCxP mG9wBRKCRpxwfzaiTD+oKJTdKGYSu8hNPWJxi/TV2CkuiuzdMfSy2wVblN9M8EHa1RMi r5eMG4Z5BH9ZOfzqfNF7U3ywNjG0xFM08/YsABL1UQXmFcWAM0ny6a+JNf1Uj2y/livC balHgdvJOkRic1c/GRtJRBf/L2glfYEfkrxNLo80QH/hVGySW7/wGHmV4vQvBL4h6UQc CTozIeUwxy5CMmR9zwHvjtPzB0qNCpNJnYb/yBnePlTXdz7haGAf4QbueoHeovwdaqS8 CznQ== X-Gm-Message-State: AE9vXwMS7vWA6rldWEeN9TiIXXSwindx3e4hivdWgU/10l3EHLgiNkiR1t+Oec+UtXN9cg== X-Received: by 10.66.176.141 with SMTP id ci13mr12794286pac.85.1473930230456; Thu, 15 Sep 2016 02:03:50 -0700 (PDT) Received: from roar.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id bl6sm3447927pad.6.2016.09.15.02.03.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Sep 2016 02:03:49 -0700 (PDT) From: Nicholas Piggin To: Michael Ellerman , linuxppc-dev@lists.ozlabs.org Subject: [PATCH] powerpc/64s: optimise syscall entry for virtual, relocatable case Date: Thu, 15 Sep 2016 19:03:21 +1000 Message-Id: <20160915090321.787-1-npiggin@gmail.com> X-Mailer: git-send-email 2.9.3 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Neuling , Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The mflr r10 instruction was left over saving of lr when the code used lr to branch to system_call_entry from the exception handler. That was changed by 6a404806d to use the count register. The value is never used now, so mflr can be removed, and r10 can be used for storage rather than spilling to the SPR scratch register. The scratch register spill causes a long pipeline stall due to the SPR read after write. This change brings getppid syscall cost from 406 to 376 cycles on POWER8. getppid for non-relocatable case is 371 cycles. Signed-off-by: Nicholas Piggin Acked-by: Balbir Singh --- arch/powerpc/kernel/exceptions-64s.S | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index df6d45e..2cdd64f 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S @@ -63,15 +63,12 @@ END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE) \ * is volatile across system calls. */ #define SYSCALL_PSERIES_2_DIRECT \ - mflr r10 ; \ ld r12,PACAKBASE(r13) ; \ LOAD_HANDLER(r12, system_call_entry) ; \ mtctr r12 ; \ mfspr r12,SPRN_SRR1 ; \ - /* Re-use of r13... No spare regs to do this */ \ - li r13,MSR_RI ; \ - mtmsrd r13,1 ; \ - GET_PACA(r13) ; /* get r13 back */ \ + li r10,MSR_RI ; \ + mtmsrd r10,1 ; \ bctr ; #else /* We can branch directly */