Received: by 10.223.185.116 with SMTP id b49csp1087809wrg; Sat, 3 Mar 2018 15:12:52 -0800 (PST) X-Google-Smtp-Source: AG47ELuY3vkdwNXxGP3Rq9IfQ1TTSCoCgMaLCvkfqAI6EJ+VwSK58puoDDv3NPtJLytKXn+1y60V X-Received: by 10.98.72.204 with SMTP id q73mr10430372pfi.48.1520118772223; Sat, 03 Mar 2018 15:12:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520118772; cv=none; d=google.com; s=arc-20160816; b=hI4hXmLd3t8O3IROJRoLipTsWgxXuYUcp9hsoCC7TSl5NbCbYPxsinxTq8JPuZ+AXa 89T55wkhQP6VZl1ZpN3zb0/d82fjvBhSm9t6YBxvHH7T3zkKaGb80JqDh0RudTbBET+S a5PHdUK8bD7XFrn5F3UG4ptUdAKetCxtMseFkdskDFj0fbmxSYkvQrb3nXXBOAaao0Bz GCGF24q9x/EvtYbX+4ZEZMIv/Uu9lpXk+zPhzLWqOFEx9xoDBGyUeOlV6ED3bEbqIWjd pMCWykpPU6BhSbJFVRTVsNft6HXeLlTXXd3tFQIOb1Ib/rxmJnn+ztd1EioyU/0CdrV/ MYSA== 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=8RSsN/Rv6LepEmRcXh4lirBa68f0dnP8WMpLwv0a52s=; b=Bc/VsAxknTInbSRoa86x13Db51fAm2hIFRY6OsXzwQsGYApJm0e8Ebd+QMq1X+OTyg S/hbl9NlW2HGESBK7c2Z56U/kkmejhN+fO7NFw++8XClUwD9DMfrg7UyIw4Rp+970N2N x8ZITIfkSiT28kJs/1MA3ui0bH9z9U5F2a+goHWbPR9OT5+Hm1bv4oiq0Qi8pVdaHf8k BLE3m2y3uHGN8wkAu8G9SP7o/dnYZdORIFo9oCxsTVVG8A4GeMBSNuzZscTLtpqjiknO 3LUz6xZJkbE3WMp7M0vpvcS98EoYGFHNtr6OK0DBSBnZElPcYqX2SEuygAZRJaFVUCDZ PqIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=BVc/9wBI; 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 t13si7376286pfa.294.2018.03.03.15.12.38; Sat, 03 Mar 2018 15:12:52 -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=BVc/9wBI; 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 S934797AbeCCXMD (ORCPT + 99 others); Sat, 3 Mar 2018 18:12:03 -0500 Received: from mail-dm3nam03on0102.outbound.protection.outlook.com ([104.47.41.102]:24173 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935055AbeCCWjS (ORCPT ); Sat, 3 Mar 2018 17:39:18 -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=8RSsN/Rv6LepEmRcXh4lirBa68f0dnP8WMpLwv0a52s=; b=BVc/9wBITMG2HvxbA0vzGeNwvF//FXCjrwpgWSlm1wp+5khSpkCg6uyWuTi4jZPPtCHkOmiNCt6eHKvXxOIQ8rsUNmUmGV7yAhwvf5iK7Ay3eAvlGiZ7SptcM7TRzBlnKDpi5B0kmji6HF7n9xya962JMXqJyNwnfRdU2Hh6BUs= Received: from MW2PR2101MB1034.namprd21.prod.outlook.com (52.132.149.10) by MW2PR2101MB1113.namprd21.prod.outlook.com (52.132.149.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.588.1; Sat, 3 Mar 2018 22:39:16 +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:39:16 +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.4 050/115] powerpc: Avoid taking a data miss on every userspace instruction miss Thread-Topic: [PATCH AUTOSEL for 4.4 050/115] powerpc: Avoid taking a data miss on every userspace instruction miss Thread-Index: AQHTsz9YEJDimf73Wk6CXD+VNj0VAw== Date: Sat, 3 Mar 2018 22:31:17 +0000 Message-ID: <20180303223010.27106-50-alexander.levin@microsoft.com> References: <20180303223010.27106-1-alexander.levin@microsoft.com> In-Reply-To: <20180303223010.27106-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;MW2PR2101MB1113;7:XnfS/HmzZl67bRsSlCSh6RxbcD/OIlXJFUCWwfPToFrWddWYAJFL8GjUIz0z8sWJO+ETJvdhkE7QwObokS4iCv/pXfghJZ1A/DLdJ/ubuDTpXaavRSKAx25m5hXr7590wnN9jY4rtkfH8QOpjPnMY0o0Vfy2HQNxkAaXAodmFVPd8cuOUEyCF/913sbxL+4QshglNwG8N6hDg2E8Mm5o0wZpFj56qmPB34a/TxcZNnaWBv4retEml8K7+oUByNsj x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: f79783bb-0441-4474-20b3-08d5815798b0 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603307)(7193020);SRVR:MW2PR2101MB1113; x-ms-traffictypediagnostic: MW2PR2101MB1113: 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)(3231220)(944501244)(52105095)(10201501046)(93006095)(93001095)(6055026)(61426038)(61427038)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(6072148)(201708071742011);SRVR:MW2PR2101MB1113;BCL:0;PCL:0;RULEID:;SRVR:MW2PR2101MB1113; x-forefront-prvs: 0600F93FE1 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39380400002)(366004)(346002)(39860400002)(396003)(376002)(199004)(189003)(68736007)(7736002)(10090500001)(6116002)(3846002)(1076002)(2906002)(5250100002)(6486002)(2501003)(6436002)(76176011)(86362001)(22452003)(6512007)(53936002)(66066001)(86612001)(99286004)(59450400001)(2900100001)(316002)(36756003)(54906003)(106356001)(110136005)(6506007)(102836004)(186003)(97736004)(26005)(6346003)(14454004)(3660700001)(8936002)(107886003)(10290500003)(5660300001)(81166006)(478600001)(3280700002)(105586002)(8676002)(81156014)(4326008)(72206003)(2950100002)(305945005)(25786009)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:MW2PR2101MB1113;H:MW2PR2101MB1034.namprd21.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: BX0QTBmmxAfU6hj/ab1TClZfmosqrw/P2YVGpWfQ94PYMy0HPU1W8k+qjdIizlwVdkKnQCI9CvsKlHW9VdbBwuBfRsbuw/J+mBzHNjKa6jHG0QmSxQrwVQTRcI7MjvTjJCSHLvA5dzfFMRTCKHTGhStfuGgYcIbUu6WmRW2+luk= 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: f79783bb-0441-4474-20b3-08d5815798b0 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Mar 2018 22:31:17.9165 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR2101MB1113 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 a67c6d781c52..d154e333f76b 100644 --- a/arch/powerpc/mm/fault.c +++ b/arch/powerpc/mm/fault.c @@ -294,7 +294,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsig= ned long address, * 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