From patchwork Wed Jul 18 09:41:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 10531917 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 95304602CA for ; Wed, 18 Jul 2018 09:43:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 850FB28FBC for ; Wed, 18 Jul 2018 09:43:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78A5A28FCD; Wed, 18 Jul 2018 09:43:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 210A028FBC for ; Wed, 18 Jul 2018 09:43:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 863D96B02AE; Wed, 18 Jul 2018 05:41:43 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 83B296B02AF; Wed, 18 Jul 2018 05:41:43 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7049F6B02B1; Wed, 18 Jul 2018 05:41:43 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by kanga.kvack.org (Postfix) with ESMTP id 0AC566B02AF for ; Wed, 18 Jul 2018 05:41:43 -0400 (EDT) Received: by mail-ed1-f70.google.com with SMTP id d5-v6so1699856edq.3 for ; Wed, 18 Jul 2018 02:41:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=zvvGGa/Bwj0t4EPeBHGNGvWiUojFwh9F16t30seYo/4=; b=SoiXnkjiXjI+/YgdEXgseE2QiyihZctfSoip8dP8HRciA5Vp7jxrF+G9BzOhovvX3B +08ziwNK48PhWrD37te2DtYXWkILK9RxolzxGWHqO1H4t3ceqbtDlsRob8tvKX7Jz2sW RV83V9jDh5fc1cXuv7QdNc7bc163zsH7nEC/h2NRHru2rghxus7maH4J7ns6IXJAkPE/ m8XC9ADSgS5fR0mGSc0X/Z6IjH+V+udKF5iZ39Xezibsy3DeH0CfGVFSrPZ+HJgoLA9+ RR5fvLyzHgGl034TVTj4ZYEiXaLaQU2lUrP5JpCXc+h8oPVl+X2IRtT0vt2cb3v3OSeD fLQg== X-Gm-Message-State: AOUpUlF8YEFsTobseiP9qAqru1KkIuoKYdlL13yX2ZzHX5BWLaXjnv1m o4Y3mWxPQigYx8ji1Uh4yRlAjuSw3VepV0w/vLt38+ItW51PQpRm9xu1fLVKoOl+a4uG+TNdr4C 8gFy/LieUCfMcTcJ9usp07MHYfXlJ+Tvxf3qYBDuziGAGRGBiU/S9EAOAep8cwfGuLA== X-Received: by 2002:a50:9e2f:: with SMTP id z44-v6mr6021481ede.303.1531906902610; Wed, 18 Jul 2018 02:41:42 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfriuy2BnxjfY1qG+U7+BZZwDC0x85FNiNqcG2XIURfe924eY31QlrJ7FD3Nd4qRL647z+A X-Received: by 2002:a50:9e2f:: with SMTP id z44-v6mr6021442ede.303.1531906901983; Wed, 18 Jul 2018 02:41:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531906901; cv=none; d=google.com; s=arc-20160816; b=qFmBkAo4mojRjXxuH+Wmqojd1UmneC+ZLlBVOX9x/o0EIgfYdX75hudg07+4aiWMB6 nomlGoyAOGRxI0R6vVW2cgZ4rwYLJnYTXrm5GL9qIzVbCWOv1zmU8QLtyhc5z99tzvBd DGz+MI2vlvLEyEyqrMdaqJEd9zkn9lNNMEFhxhOBG2v0A2xfdqrR9hfjA+6YuK40SY7z 1DvYByKzMCgp6+lNHfFS2vXpcnq7sI5Ioa3rx/ubkc214PikyApSyh4jwHoBiEYJ19qe UgJKgo3oQaHGLdIljLQngKI2CnTwgP4XDUuyzsHjX5wnjdfY40hI4duKOw3Xd+mmgwdr tFtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=zvvGGa/Bwj0t4EPeBHGNGvWiUojFwh9F16t30seYo/4=; b=Ra7LLIkljiiZd6mW1QHiEfU32NRe5+eJ+jVP9G9C/vMLioba8tbT+Wv7GRZb14wkjy UU/53+yX8Uvvd4MRoXICJSn5JxWJmoGH9d75V1XZ0vj5HN0bSJLpuNxWrln4P9slr2uy G+gJ/G8AH+Wm9oD/0EcnZScw8dxHWR+3oFHwB3cyCro97P+/fUQJwDCNZ6tyuemRiF+B gvDJBltTflFGAsTZ3TIkhdtqIHHdG7MecHMu6q/do3+4J6At41OPjk69oQ/H4obmX5ii Xfg+35+rrV+ZKx6zV+xntQ7+YmFGPP15WN5QrHhhMYUM5D+M6B8dKrwmpBQsqtsNq3CT N72w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@8bytes.org header.s=mail-1 header.b=b2lpY+3e; spf=pass (google.com: domain of joro@8bytes.org designates 81.169.241.247 as permitted sender) smtp.mailfrom=joro@8bytes.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: from theia.8bytes.org (8bytes.org. [81.169.241.247]) by mx.google.com with ESMTPS id p5-v6si2761541eda.158.2018.07.18.02.41.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jul 2018 02:41:41 -0700 (PDT) Received-SPF: pass (google.com: domain of joro@8bytes.org designates 81.169.241.247 as permitted sender) client-ip=81.169.241.247; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@8bytes.org header.s=mail-1 header.b=b2lpY+3e; spf=pass (google.com: domain of joro@8bytes.org designates 81.169.241.247 as permitted sender) smtp.mailfrom=joro@8bytes.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: by theia.8bytes.org (Postfix, from userid 1000) id 5F23C3C8D; Wed, 18 Jul 2018 11:41:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1531906887; bh=tLiAcI2qwMEnqd4vo5oDTMRTlAL0Hs4aB8R7khMPaks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b2lpY+3e5534kA09OFfGmi+ZXpHoCMgEc/+axL4ev+yncVtABPW32sT9KncfUL5JG DtoJIduHdHHRNq4t0zMmr84zPZskwulKUGSW6XnQP6hK4njQw53CmkPT6avSr2A9yU wFCX62mU0sVwB5ocIVRhb4RRJpcSZmTrBOjp22X/hhMdYDN1wyGMHkDY+ho9SR+xF1 mKEkg+EGfGo/peer7QDjxr1ZPpNJbQ9Iw09s3sVZ6C/swi70V2Ln3grzRneRSM5NjO o7fTDH/5Obe6eBwZRm8z8h7QgNz9yPdB30jeI9sG1RByL+rsBedeMNgr5pBREPnoHf sE6wtxaKMURNQ== From: Joerg Roedel To: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" Cc: x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Linus Torvalds , Andy Lutomirski , Dave Hansen , Josh Poimboeuf , Juergen Gross , Peter Zijlstra , Borislav Petkov , Jiri Kosina , Boris Ostrovsky , Brian Gerst , David Laight , Denys Vlasenko , Eduardo Valentin , Greg KH , Will Deacon , aliguori@amazon.com, daniel.gruss@iaik.tugraz.at, hughd@google.com, keescook@google.com, Andrea Arcangeli , Waiman Long , Pavel Machek , "David H . Gutteridge" , jroedel@suse.de, joro@8bytes.org Subject: [PATCH 38/39] x86/mm/pti: Add Warning when booting on a PCID capable CPU Date: Wed, 18 Jul 2018 11:41:15 +0200 Message-Id: <1531906876-13451-39-git-send-email-joro@8bytes.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531906876-13451-1-git-send-email-joro@8bytes.org> References: <1531906876-13451-1-git-send-email-joro@8bytes.org> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP From: Joerg Roedel Warn the user in case the performance can be significantly improved by switching to a 64-bit kernel. Suggested-by: Andy Lutomirski Signed-off-by: Joerg Roedel --- arch/x86/mm/pti.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/arch/x86/mm/pti.c b/arch/x86/mm/pti.c index b879ccd..be8d2cd 100644 --- a/arch/x86/mm/pti.c +++ b/arch/x86/mm/pti.c @@ -517,6 +517,28 @@ void __init pti_init(void) pr_info("enabled\n"); +#ifdef CONFIG_X86_32 + /* + * We check for X86_FEATURE_PCID here. But the init-code will + * clear the feature flag on 32 bit because the feature is not + * supported on 32 bit anyway. To print the warning we need to + * check with cpuid directly again. + */ + if (cpuid_ecx(0x1) && BIT(17)) { + /* Use printk to work around pr_fmt() */ + printk(KERN_WARNING "\n"); + printk(KERN_WARNING "************************************************************\n"); + printk(KERN_WARNING "** WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! **\n"); + printk(KERN_WARNING "** **\n"); + printk(KERN_WARNING "** You are using 32-bit PTI on a 64-bit PCID-capable CPU. **\n"); + printk(KERN_WARNING "** Your performance will increase dramatically if you **\n"); + printk(KERN_WARNING "** switch to a 64-bit kernel! **\n"); + printk(KERN_WARNING "** **\n"); + printk(KERN_WARNING "** WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! **\n"); + printk(KERN_WARNING "************************************************************\n"); + } +#endif + pti_clone_user_shared(); /* Undo all global bits from the init pagetables in head_64.S: */