Received: by 10.223.185.116 with SMTP id b49csp1108826wrg; Sat, 3 Mar 2018 15:49:48 -0800 (PST) X-Google-Smtp-Source: AG47ELsbBzQMAx1cpxwK6MYoPAX/NLSqlUbM0TtzRTlgmdsyYLKzAVPoaj5B1gqEhW155JsbOXGB X-Received: by 10.98.103.136 with SMTP id t8mr10456351pfj.177.1520120988437; Sat, 03 Mar 2018 15:49:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520120988; cv=none; d=google.com; s=arc-20160816; b=UzzFHIcvM0KJXSE3Cb2gVmlEEtPQPpZQpqtW72P3Xb30rzXpAw9IDYZN4IIkswlENk s+a75bBcO3ngNKkd5wvUHsYFobttASZh4EBo/h26Do3Gn9t6FZ6VJFHhNErN730p1xWI uVmETANaV8nhUV+l3DYdeod3F+x6DJb3H78fIfW99521hXtpWykHvBBKDeqBR0JS+SQB aHuuA9T5IwhG6hCzryVsyOPsnYtQ8jCku8+WGDQP4f7fQFEoRMxiJBNQ1FrUv/tsy1fl htBQOCv/ecn1M9/YKZBmJ6Sj33k7RS4Z5gI9ddKv+XgcQZb+BCDL/KPxxsY9pJczcMhN FIjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=gBlMVs2GEDm1Ok8SwlspuES3fPfL3ME9EzxwxhvCbMw=; b=FnvYqd/FFR1L1xoRIM2jVS0p4fXuXg+/9t6IAtc/LV8/60mGHYHTCXbNcJ1lVYehD+ 601JRcUoYJC8V+6NRU3OaJW5vcta+5tPiUoGDrnhW9jWg8RfJBPV/LZPlKoTGNQvbC90 gDLeYfmIdUIqePwJKh478N2U0nYEVtC4Obt5+/FSFgm3BRMhnGIZctQMbytP3aHG1+JM d2fx6F9PxoJ+eXUwcSTFv651kd3yAd2mbET03blSXkffbpHFaJD2/mNQM39gxKp7tGl7 TdyPNLK82Edtas0335vpjAXs6ZL3sP+6INtzLVFqbLrc1U6LjOuaB45nUhWwegt0Q6ha 138w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=PhZnN3GF; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d6-v6si6806938plo.661.2018.03.03.15.49.34; Sat, 03 Mar 2018 15:49:48 -0800 (PST) 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=@microsoft.com header.s=selector1 header.b=PhZnN3GF; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934125AbeCCXtB (ORCPT + 99 others); Sat, 3 Mar 2018 18:49:01 -0500 Received: from mail-by2nam03on0128.outbound.protection.outlook.com ([104.47.42.128]:37280 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934084AbeCCWd7 (ORCPT ); Sat, 3 Mar 2018 17:33:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=gBlMVs2GEDm1Ok8SwlspuES3fPfL3ME9EzxwxhvCbMw=; b=PhZnN3GFwaGvVYNv09+BmmeM+iIpaxX5HJsBoS912q4Qq3V7ARJCftho6660okn3l2RdWEMWpjFeAm7xZKWRVakS0NsF8BkT4OPS8Yww7VpWQeP92FhEK178Ei9XTRgnW690T8aRAvXwRnl7JJPIjI6g6mztD/2o09kJ8iaH0oc= Received: from MW2PR2101MB1034.namprd21.prod.outlook.com (52.132.149.10) by MW2PR2101MB1065.namprd21.prod.outlook.com (52.132.149.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.567.2; Sat, 3 Mar 2018 22:33:55 +0000 Received: from MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0]) by MW2PR2101MB1034.namprd21.prod.outlook.com ([fe80::1d56:338f:e2b:cec0%3]) with mapi id 15.20.0567.006; Sat, 3 Mar 2018 22:33:55 +0000 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Anton Blanchard , Michael Ellerman , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 100/219] powerpc: Avoid taking a data miss on every userspace instruction miss Thread-Topic: [PATCH AUTOSEL for 4.9 100/219] powerpc: Avoid taking a data miss on every userspace instruction miss Thread-Index: AQHTsz8C3wQhZbkUbEqRZi8NuMC2DA== Date: Sat, 3 Mar 2018 22:28:53 +0000 Message-ID: <20180303222716.26640-100-alexander.levin@microsoft.com> References: <20180303222716.26640-1-alexander.levin@microsoft.com> In-Reply-To: <20180303222716.26640-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;MW2PR2101MB1065;7:7ZmNOsDoz86VvIbsba2kcQ1S2bQ+sgE0yvCMeysDc59IJKPx2aOHOR1GmD7RsKwqTJkL3S7XJt3bCRNUFStx+t0/a3qcdZ0qdEe6A67Mn3u2powmxcV/njnEbhh8AYxh+uWPUz0MWZqHXKRqLjWUxR91deWBoKe/BsI1YXPJqLYXqNFHGO/Y7O7BgEsRpH7XY4NCp4LRiuAH7BCcrE16UbtldVlOH7tG26U7QOHzJ2T5qa1j/d/0hxSZCkUnBB09 x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 8a455edd-cba2-4158-e99e-08d58156d96f x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7193020);SRVR:MW2PR2101MB1065; x-ms-traffictypediagnostic: MW2PR2101MB1065: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040501)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231220)(944501244)(52105095)(6055026)(61426038)(61427038)(6041288)(20161123558120)(20161123564045)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:MW2PR2101MB1065;BCL:0;PCL:0;RULEID:;SRVR:MW2PR2101MB1065; x-forefront-prvs: 0600F93FE1 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(366004)(346002)(376002)(396003)(39380400002)(39860400002)(189003)(199004)(6506007)(22452003)(54906003)(25786009)(186003)(2950100002)(102836004)(5250100002)(2501003)(110136005)(97736004)(316002)(2900100001)(36756003)(76176011)(6436002)(59450400001)(6486002)(26005)(4326008)(99286004)(68736007)(6512007)(6116002)(10090500001)(106356001)(105586002)(478600001)(66066001)(107886003)(3660700001)(305945005)(86612001)(14454004)(81166006)(7736002)(86362001)(575784001)(1076002)(72206003)(2906002)(10290500003)(8676002)(8936002)(81156014)(3846002)(5660300001)(3280700002)(53936002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:MW2PR2101MB1065;H:MW2PR2101MB1034.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: BzWgXdQO8/VlOVTQUihUPgQ5mlwoPM5vcGBVLwMaUFAUL4501eDScKztWdvPOhZTq5wT7Cw7ZkbXjGNjod0V4d6wSv8A4HM3SgfWcWDD3HUkUrbjlhGPKMlK0l02aHFNEcm6Ua+ytO9Q+jWlGHRt8zgG43zaUF8C8a73guv6nsU= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8a455edd-cba2-4158-e99e-08d58156d96f X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2018 22:28:53.5725 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR2101MB1065 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 =3D atol(argv[1]); char leftstr[16]; if (left-- =3D=3D 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 --- arch/powerpc/mm/fault.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c index d0b137d96df1..9376e8e53bfa 100644 --- a/arch/powerpc/mm/fault.c +++ b/arch/powerpc/mm/fault.c @@ -294,7 +294,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long a= ddress, * 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 =3D store_updates_sp(regs); =20 if (user_mode(regs)) --=20 2.14.1