From patchwork Wed Jul 18 09:40:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joerg Roedel X-Patchwork-Id: 10531803 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 24103600F4 for ; Wed, 18 Jul 2018 09:41:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1537D28FD5 for ; Wed, 18 Jul 2018 09:41:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 08B7A28FF3; Wed, 18 Jul 2018 09:41:36 +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 ABAFB28FD5 for ; Wed, 18 Jul 2018 09:41:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 420A96B0270; Wed, 18 Jul 2018 05:41:28 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 3A7A36B0271; Wed, 18 Jul 2018 05:41:28 -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 271206B0272; Wed, 18 Jul 2018 05:41:28 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by kanga.kvack.org (Postfix) with ESMTP id AFB056B0270 for ; Wed, 18 Jul 2018 05:41:27 -0400 (EDT) Received: by mail-ed1-f69.google.com with SMTP id v26-v6so1698704eds.9 for ; Wed, 18 Jul 2018 02:41:27 -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=G5nIhUfnIJiarDCzc0yOepn6GaQz4XMwGbfON3/Lkg8=; b=YLMMyYD41ySiaxv/Eh4/WMb7BIwNTyQe+Jlhn3yeSCCRq+aMo7Y3nUNi7Y0aRyL8ut 8T/zYLxY4QhMBMV/Waw6TPrp7GV55LdIoQ0xd455KI0N3PSWwmEZnS6XQFNg9i3imrSu SGFNe24/ALEp5vYLoS/as2S/Vk51dInoKzfkzA5eKAeci8oBC+lYxvDiramvJlJ5V9gJ y8OWq1pubKA2GaiS0SFiExJalAm0LRJ+9RJEOoSpNquLL+ve9boeM+1QJGllFFf7Xivk E/KL3ohMlW9DQjQWe10h86EwDI33iiz3ZgL56TBLHxJeIXkZ74enxr6B9oxCVS421rup XGTw== X-Gm-Message-State: AOUpUlF6q9C0talNKf8l4II2HXV0jI/4i2Gyx9FLfuYR66Mqex95S9HO 0scHBatB7UqeyCYmYijcS/hxSqa5R6rZgpg8ydNIClWDWmZZDgceLdRB1tZG2a5jZyLeGeN6l/F pMQDLgJFQDygrcbEvP7Gd1tVDzKf40i7VyLf7P2PEzHAfC3STG26NffzclfWvkWu7mA== X-Received: by 2002:a50:d65e:: with SMTP id c30-v6mr6565672edj.178.1531906887287; Wed, 18 Jul 2018 02:41:27 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfuMLxUgrihTmgrN8itFL1lOGOyNjHyBem/tP0V2FcDLrkRY6SSGXsGCra4ngquxHsPjGcf X-Received: by 2002:a50:d65e:: with SMTP id c30-v6mr6565633edj.178.1531906886630; Wed, 18 Jul 2018 02:41:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531906886; cv=none; d=google.com; s=arc-20160816; b=LCNmHgr1fUQOPCI3CYA3Hf109az9YHDybJAmBpvHfgl137Q4P4IgTJVZsYj1BOQW5C Y2fpZt3ccUVLd2VZN7aWsrRheDGdAa0DhS46YDklDmMsDbGd377vv4H7P+Q1nmEiGKTG xJYrK3AFNF1VwnGX8QLF/MWtA9fcBjS6jJziS+WAPYHGqIl5FTal8j70sfMxjpbVckgQ vQfNcH7HOFf7RC4cimDGz+R5WfhI8ieKHttqbAdbMS78GZEEpiqIblu0FwuepJfgO97i SAg1q+P4yv9sElCAOzPS2RrGCgseRzbKH4RpJqtuYECc0eajwhyb8fShkxs1kKhJp7hT wgpA== 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=G5nIhUfnIJiarDCzc0yOepn6GaQz4XMwGbfON3/Lkg8=; b=uLom3YXvZXEEOnUuERTM0C2dkGRdMVLYUP7M+n3vtb3EG60b8lzuIFoH6cT+cb2rGp JQ5mIQFjurDiV/e0Z4xiY6zOZkaGJ+ysBuPfuwuidLp0jkyos5DNb9KNHgurIYVlOzok zMe89LuZzO31BWaViRfDNDT8SpR64lutHswb2LJ9vNot6Qg8zwOxYTkQW4yUFQ4lkDI2 tXHuD5dSQqIoV2F990Nyzr6UEsT255zdlWbdfPoV/9Os+8vmvnDwU1L5p900Lh6MvtHZ DbVRhefpYu5QojKigupP6ZU3Ptk6nu/nTJt0s/OOwhbyfQA74oX0Z4lquRT6IBOVIkkS StAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@8bytes.org header.s=mail-1 header.b=MGN+OMdI; spf=pass (google.com: domain of joro@8bytes.org designates 2a01:238:4383:600:38bc:a715:4b6d:a889 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. [2a01:238:4383:600:38bc:a715:4b6d:a889]) by mx.google.com with ESMTPS id z46-v6si2420345edz.160.2018.07.18.02.41.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jul 2018 02:41:26 -0700 (PDT) Received-SPF: pass (google.com: domain of joro@8bytes.org designates 2a01:238:4383:600:38bc:a715:4b6d:a889 as permitted sender) client-ip=2a01:238:4383:600:38bc:a715:4b6d:a889; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@8bytes.org header.s=mail-1 header.b=MGN+OMdI; spf=pass (google.com: domain of joro@8bytes.org designates 2a01:238:4383:600:38bc:a715:4b6d:a889 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 56AC81EE; Wed, 18 Jul 2018 11:41:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1531906879; bh=xRg8Na2aVjarlNI9kV1i+LRcfsMCnQB4qVv2e721/1g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MGN+OMdIKihyFtgBerHO4Drxt6luJGCV/DV1kaKGvv17UkbMEuNT+/L+dojXr0Yqn TM6C0Ke4zfcIvxn4uBZAJjV0DRZPkerAADk1Jz+eV8dxLrC1SduCcwu2pAIPXnpZy7 v+vUp4lQ81wvIOyihFsj3YHuObKBV1wvv0suFYw/1R0CLFga8vorRegr6uNtox7xGt ASCsYSSAlLXNHwN2JhnQVFM/JmZ3lygECAdS6LpKVdEeUCtO5G6UnAN3HZPZJ4Ozpv 8oGv0+vosbk2w5vn2KfutcAyLyCw6G89IGwotKwWe1wlZTDg9dhDXkW+4zKTR8MEq/ 0XycE8R0HAOEA== 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, 18 Jul 2018 11:40:43 +0200 Message-Id: <1531906876-13451-7-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 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 4364131..7251c4f 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