From patchwork Wed Jul 11 11:29:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 10519431 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 7F18A603D7 for ; Wed, 11 Jul 2018 11:30:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E17D28B8C for ; Wed, 11 Jul 2018 11:30:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C16628D22; Wed, 11 Jul 2018 11:30:25 +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=ham 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 1F34928D44 for ; Wed, 11 Jul 2018 11:30:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 40CD36B0276; Wed, 11 Jul 2018 07:30:10 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 340ED6B0273; Wed, 11 Jul 2018 07:30:10 -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 1E5FE6B0276; Wed, 11 Jul 2018 07:30:10 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by kanga.kvack.org (Postfix) with ESMTP id A6C916B0273 for ; Wed, 11 Jul 2018 07:30:09 -0400 (EDT) Received: by mail-ed1-f72.google.com with SMTP id a22-v6so9880469eds.13 for ; Wed, 11 Jul 2018 04:30:09 -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=Mas/7t3u9PA0XkI0yoAHF0mrZXYJ0b/fOg1XnnPiNhU=; b=GxUFqn0/pw1fxKjxylm/WOKQkNHHhcFs4FGlwrysvt7Q9idmuMu1MwU39uN4QKKWfT k54ibOToDIMG8xmOidUvqYeJ42LxpPJjL8cUiWG2rA/WLcYXQMBfZJmy1NPg+8aT0Cg1 BqLKXhDHIQ2obWlGzpqQIrqeE8ndSR41Hj5XaEf6mFc0LE0rdEaCh6aJHjQMdedjZcZn 27qsJQ4kpE8iX3tSxxKgRTJQ5yqmdQscbi0xabOQwSMRFuQaOm1RQRDwumphPHmzMKZ+ Y+zT52/RTByKJBKNobxSSugAEQE+CTkudM//bhjmsWgr+VGHoPvTdTHS4AN9BwEz3bZ1 /cSg== X-Gm-Message-State: APt69E0MlH/nFzrVXFzO04stGqSIk+0vN8Z4c2vNdgEHRieuKMjDuK7K VgZJQXFskS6tl6A143PEzzcPOa2+gIjVSdj2pLi2y+xwLio3YYKFRc2mfrarYkvfVi9KjJ2jOOh pdLMrCF4GAyXcz7uo9JpnpswSuWpAVIePibadnMlOwo42DWgF7fQaS4WEonknPMoWXQ== X-Received: by 2002:a50:d0ca:: with SMTP id g10-v6mr30777661edf.182.1531308609255; Wed, 11 Jul 2018 04:30:09 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdXqjWt5CYl7BS4PqmaHyrnNgGYB5IqHtdyC6DCwklFJ24cyplEB5k3kTntgb3kzrv1rxu6 X-Received: by 2002:a50:d0ca:: with SMTP id g10-v6mr30777622edf.182.1531308608567; Wed, 11 Jul 2018 04:30:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531308608; cv=none; d=google.com; s=arc-20160816; b=b5CR3fKYNsPnQv+1NMyVOkdgYQIH8Kjwg10wnUmhHNFrrawDeVnI1qwkkJmkzZUDCU TNDvyHi6EyFOjUhiiYXkYmYEbFMdaKx7SaB5+eQc4ID/ZFeOKfkruTfyBr5fgYHalguV WBj70RkQl1HKc0ZFi6/1k3WlpAbdQ9TSHN9G/Le7v8Q+PyIkE9zWCKMO0SjCtLfEhzAk DrnSAlGJsSW0xvMJld85esslEZGHTMi6vANbBt2UdXr+LUeLi5E4wEaQpRcAJoXL5dTB LjcUO2vK/hA14nWlGpuWuTz/t5UyNllZBNgFuPV6FgUVvUe21JDeJghEti3UFNWJIudU 0C5Q== 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=Mas/7t3u9PA0XkI0yoAHF0mrZXYJ0b/fOg1XnnPiNhU=; b=DzF8Q+3UmK5ryXXekNeKd88KEq/RuKYnTyvYY4ZVdmreXH6r3SWcFyMh5lNes6LoXi fLhdvzyS3S/zmh5w7aWeaR03dh0QrNiJxHDMH0AK2CfOpaSi53+YzhJ6yH8T8Vi4nnKt rul22XwJLSKH9pM/WPM4maVeaKyE5x2XlHHcRsUIynta8UQGaSUI8pxttLa+ddBWHWWc MzUUYiZ9rA5S3HNaDTYUI96v6+FTOl/HqqFrtZcTK8Kgjx/Tb7Xly3M8x2CGXx0hUq15 LOaGJmwuKw91AfzsieJOw3Ld4+QhnqCqkmyfBJTC3VlWKcz9Wy9bljhl8wHPMJPA2tZG oDGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@8bytes.org header.s=mail-1 header.b=TyzSjYqU; 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 u18-v6si1234917eda.251.2018.07.11.04.30.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jul 2018 04:30:08 -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=TyzSjYqU; 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 25FA57B4; Wed, 11 Jul 2018 13:30:00 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1531308601; bh=oDMxF3o058bjpJa4HrDdMIfZpi53bUCauxD68r1Y9K4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TyzSjYqUxtz81dSIk8lAWsCYRvAaSzZ8BBCnXcvJ2ETfpak3XlRdLUzWIRjhl/4Gy SAQyhYHDsAcpxtEMDiut94nSwJvogRNwL2fbucrljHxQOo2cHMc29Un9qBDrxsRlD6 wyX6Mqj0cO/J/FLIV4quWWGPOHPm9Db8gyt2gygwplS+4vXs40Sl+eWgnTu7S5iePF S5rfw3f/BwS69/Rd+Is56FHKD+LUZLYLFEKilefVFSle8RLgrKJPIrnzd+o9ciVvcx MyvQb9G5FOjp1+yih/NFPm8ID2fRsc9K7WDEAtiQvpAVMisldIMALOEq7wahV5YJcv p65fbIjTEnpvg== 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 06/39] x86/entry/32: Split off return-to-kernel path Date: Wed, 11 Jul 2018 13:29:13 +0200 Message-Id: <1531308586-29340-7-git-send-email-joro@8bytes.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531308586-29340-1-git-send-email-joro@8bytes.org> References: <1531308586-29340-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 Use a separate return path when we know we are returning to the kernel. This allows us to put the PTI cr3-switch and the switch to the entry-stack into the return-to-user path without further checking. Signed-off-by: Joerg Roedel --- arch/x86/entry/entry_32.S | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/x86/entry/entry_32.S b/arch/x86/entry/entry_32.S index 571209e..61303fa 100644 --- a/arch/x86/entry/entry_32.S +++ b/arch/x86/entry/entry_32.S @@ -65,7 +65,7 @@ # define preempt_stop(clobbers) DISABLE_INTERRUPTS(clobbers); TRACE_IRQS_OFF #else # define preempt_stop(clobbers) -# define resume_kernel restore_all +# define resume_kernel restore_all_kernel #endif .macro TRACE_IRQS_IRET @@ -399,9 +399,9 @@ ENTRY(resume_kernel) DISABLE_INTERRUPTS(CLBR_ANY) .Lneed_resched: cmpl $0, PER_CPU_VAR(__preempt_count) - jnz restore_all + jnz restore_all_kernel testl $X86_EFLAGS_IF, PT_EFLAGS(%esp) # interrupts off (exception path) ? - jz restore_all + jz restore_all_kernel call preempt_schedule_irq jmp .Lneed_resched END(resume_kernel) @@ -606,6 +606,11 @@ restore_all: */ INTERRUPT_RETURN +restore_all_kernel: + TRACE_IRQS_IRET + RESTORE_REGS 4 + jmp .Lirq_return + .section .fixup, "ax" ENTRY(iret_exc ) pushl $0 # no error code