From patchwork Tue Jun 13 13:05:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 775158 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3wn9Kh3zWWz9s81 for ; Tue, 13 Jun 2017 23:17:28 +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="cYwPTMhY"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3wn9Kh2dcjzDqNK for ; Tue, 13 Jun 2017 23:17:28 +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="cYwPTMhY"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-pf0-x242.google.com (mail-pf0-x242.google.com [IPv6:2607:f8b0:400e:c00::242]) (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 3wn94z34qRzDqLk for ; Tue, 13 Jun 2017 23:06:27 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="cYwPTMhY"; dkim-atps=neutral Received: by mail-pf0-x242.google.com with SMTP id s66so6773068pfs.2 for ; Tue, 13 Jun 2017 06:06:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GgZZfQFnAsafmDmlEupMmYy1qHWaxcWh+h6WMkvz9ws=; b=cYwPTMhYmPRiJ1Qb6Py0mWq89nkHeQk5JgX5Pxi9yb27wviM455jwuNPGxLIkSLnBF sc0EQFQrcQI69QbCyeO87AHqolsZ/B2hPAHa+GbkIZQzW4VLfAl2hhNcWcYW7HN0uo8W hv4fmFGHdy7lUxoUzMqHuIMPI6Bad6yLy+Lc/3GiEwB8v7oF+NBlb3fTego4Uz8oT7x4 zAqhACNriTI95q8rNg9gjvdLkimQ9Nx/ChwkIzfuXXxeLjS7pQQ6WJT5nCB+QMqBuu56 VBeg77XJqak1JBgVzm94QHxwFeXAGg8ZyYTNZMwAsCWilcpT/eO41Q5W3hPGLwkffqBt qnSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GgZZfQFnAsafmDmlEupMmYy1qHWaxcWh+h6WMkvz9ws=; b=iu80XMiubUfVrAuR2yfuG7UAwDNOnOQyUXxdZf4rl6LwySbzowAdOQjxUW3+W/2ohH O0DGFu20U2dXJQCG+GJv25l817qT6VIkBaOPy5AZm5KCfwhwl3etHOh46b75ttuMuF+R g6dxiUciwH+kBQO0UaruR9VHEwOKQZyz4HYOo4kLSF2z4jdKc+kgtP7Lzjko5cI/ToRo tfLWhjEqkXMNo3mYhy5CskAVCE2zPA5Kf53xtL0Iz1RQU8qvFkvFn9+qHykLEAEph+0V Ofwul2En/CrGmEIhiu/ImzyntPVIt1ZBjDunahTdbVbqcCKT2VCo70cP65/OBfxCmQdL oN1w== X-Gm-Message-State: AODbwcABl3kPggxRALcSzVwGX5oFNPbPmnwhW/ZHtosuLxCdsGj2TTFh 8Z5HWTAvANLLPjWL X-Received: by 10.84.149.102 with SMTP id b35mr60906810plh.289.1497359185396; Tue, 13 Jun 2017 06:06:25 -0700 (PDT) Received: from roar.au.ibm.com ([210.185.119.63]) by smtp.gmail.com with ESMTPSA id y28sm27750667pfd.32.2017.06.13.06.06.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Jun 2017 06:06:24 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 05/13] powerpc/64s: interrupt replay balance the return branch predictor Date: Tue, 13 Jun 2017 23:05:49 +1000 Message-Id: <20170613130557.26315-6-npiggin@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170613130557.26315-1-npiggin@gmail.com> References: <20170613130557.26315-1-npiggin@gmail.com> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Gautham R . Shenoy" , Nicholas Piggin Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The __replay_interrupt code is branched to with bl, but the caller is returned to directly with rfid from the interrupt. Instead, rfid to a stub that returns to the caller with blr, which should keep the return branch predictor balanced. Reviewed-by: Gautham R. Shenoy Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/exceptions-64s.S | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S index a04ee0d7f88e..31a9114860c4 100644 --- a/arch/powerpc/kernel/exceptions-64s.S +++ b/arch/powerpc/kernel/exceptions-64s.S @@ -1579,6 +1579,10 @@ doorbell_super_common_msgclr: * Note: While MSR:EE is off, we need to make sure that _MSR * in the generated frame has EE set to 1 or the exception * handler will not properly re-enable them. + * + * Note that we don't specify LR as the NIP (return address) for + * the interrupt because that would unbalance the return branch + * predictor. */ _GLOBAL(__replay_interrupt) /* We are going to jump to the exception common code which @@ -1586,7 +1590,7 @@ _GLOBAL(__replay_interrupt) * we don't give a damn about, so we don't bother storing them. */ mfmsr r12 - mflr r11 + LOAD_REG_ADDR(r11, .L__replay_interrupt_return) mfcr r9 ori r12,r12,MSR_EE cmpwi r3,0x900 @@ -1604,4 +1608,6 @@ FTR_SECTION_ELSE cmpwi r3,0xa00 beq doorbell_super_common_msgclr ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE) +.L__replay_interrupt_return: blr +