Received: by 10.213.65.68 with SMTP id h4csp1765545imn; Mon, 19 Mar 2018 12:38:45 -0700 (PDT) X-Google-Smtp-Source: AG47ELvANGtF2VEyns7GNb+XWYvL862atZS/li2vhI8C9uJO0FmaEzLllDE081ZTiBIoKcJwotOY X-Received: by 2002:a17:902:42e:: with SMTP id 43-v6mr13483205ple.186.1521488324960; Mon, 19 Mar 2018 12:38:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521488324; cv=none; d=google.com; s=arc-20160816; b=wVakKSuRw7ZjkJuPVbGh7g4tY6WpQdbUbVPCWVeWC+6Bo9Roll8G29oM8qLvD+zJCg zyfIj1bE+sDgL8jPtqbFDLyDRniYLngpnFBIHcd12CiNmj5oFHummr/FE/moNBUSwLDR PcrcPnE/Ehf7M/n2f/yBkDC2R6fXkKC2ExTYOoC8QZUUwQFOiiIR9LTAY/13CxiF+Mdt FUTyDi6tyP/g3jWeXJKGymMcaqRJkOI7IPHruP/KkHIDwWlLE1Bogvxhcfc2L0/AHq1i 5NI842orgibbakrlGx+HPKxe3KqsT3Dxi1VfOLPB0yhxscOMzwOl4j82MczmYapPID1h TOiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=kw2cvn1T2oRYJNf+TtIgd/qh6vrXCQv5grCyc8r5dWc=; b=m86NA4ezXe0zx2D696TgcPQ/TdYMY87NquQ8PJEnH0vkGiVljBqbxUrVM4ZTP3zQY/ Bl57gtRWixz6/mhwG5ZBSOwUqyFB1dplTQZPy+3iO7UkNkUFVJhCKzf/b7NFgmSFwYyy OZuh/KzMuphPCNqFpyVByAhUsOYPJlpLJNa88Q0e6tCc78NvHhRNLwHvZNtWgMlSl3UU xJqTUIJUq0MbeFxtqdECIYKPH3fw9QOnfHwLk7iX54nDtGlz3kF3PabbAfEsXk+5HtH7 t0sBlCHW7LY/s0F8Hen+fyBWx7VLgVckA45c44Lt4ZNBM/LjmNdpsdgcFcLtkDTzVEJT Ourg== ARC-Authentication-Results: i=1; mx.google.com; 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 j10si442918pfe.276.2018.03.19.12.38.30; Mon, 19 Mar 2018 12:38:44 -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; 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 S968641AbeCSTg4 (ORCPT + 99 others); Mon, 19 Mar 2018 15:36:56 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48484 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031237AbeCSSWR (ORCPT ); Mon, 19 Mar 2018 14:22:17 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 40FC6128F; Mon, 19 Mar 2018 18:22:16 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anton Blanchard , Michael Ellerman , Sasha Levin Subject: [PATCH 4.9 097/241] powerpc: Avoid taking a data miss on every userspace instruction miss Date: Mon, 19 Mar 2018 19:06:02 +0100 Message-Id: <20180319180755.209904834@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180751.172155436@linuxfoundation.org> References: <20180319180751.172155436@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Anton Blanchard [ Upstream commit a7a9dcd882a67b68568868b988289fce5ffd8419 ] Early on in do_page_fault() we call store_updates_sp(), regardless of the type of exception. For an instruction miss this doesn't make sense, because we only use this information to detect if a data miss is the result of a stack expansion instruction or not. Worse still, it results in a data miss within every userspace instruction miss handler, because we try and load the very instruction we are about to install a pte for! A simple exec microbenchmark runs 6% faster on POWER8 with this fix: #include #include #include int main(int argc, char *argv[]) { unsigned long left = atol(argv[1]); char leftstr[16]; if (left-- == 0) return 0; sprintf(leftstr, "%ld", left); execlp(argv[0], argv[0], leftstr, NULL); perror("exec failed\n"); return 0; } Pass the number of iterations on the command line (eg 10000) and time how long it takes to execute. Signed-off-by: Anton Blanchard Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/mm/fault.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/powerpc/mm/fault.c +++ b/arch/powerpc/mm/fault.c @@ -294,7 +294,7 @@ int do_page_fault(struct pt_regs *regs, * can result in fault, which will cause a deadlock when called with * mmap_sem held */ - if (user_mode(regs)) + if (!is_exec && user_mode(regs)) store_update_sp = store_updates_sp(regs); if (user_mode(regs))