Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2248837imm; Thu, 19 Jul 2018 16:24:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfQyOSf6U00aG/V2vqOh7BATd8jJY3h2Q5IuIh4qpGDheBiZ2TB4iumygNeEPP5TT+Xr9gb X-Received: by 2002:a62:8d7:: with SMTP id 84-v6mr11462405pfi.172.1532042651088; Thu, 19 Jul 2018 16:24:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532042651; cv=none; d=google.com; s=arc-20160816; b=LgWMfJ8K+0DUBwtqQZrNK4cCdmVdGSPG/p9q8JHVttqI5tbqyaC2T6lZt2MwteD6/R SzB8XJBnGIbuuXPz0qFAM/ElQJM/pcKEknZ8/ZYTf2+Mgz/Fk1+5YBKpwKAZHKZAOZwA wHlXcxzm49v2zYwmyD9DenLC+GwaXOyvM+0GRqc4a0tGTn46AVjmr/hzJBqKPsfEnTm5 TZ2OFw7YqNdI8lmGD27u7vsAR74UeirxeNmXO+88hdYtOhD9Yn723Cw0PS6osLZYsXfS HNXWLEQBTALmFVoLDNcuGVX3hqTZNE/kGjsX2kvzEUNR1RPArI2V1xWJQwAHzDzRWIl3 Y8CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=crXchk/4vWdLcLL0S+GFjQ/vpjPjozlZYh4rH8rXU+0=; b=gNbAoOG/zVQ5E5u8E4LqdzDYdS2mq0U3rUj6D1Os1JsHe+MculivxJJSly/tLgBgkx IuWGzO7m3+40P5lFjMcmf3rvWui6UMRwo6kt2IEhG5MpnlgnLU5pBnGm0K2//R1A7YDg AXUujq7+j0KbQpa/KswF8eIP5yYMivx5hpN1xldzeR9H9FohwhiaHHM59Ht1M3fqlCb/ MxpkJQwubcbf6blKknSsVUpcha8UlLEhCtKmMrxmCci+WQ9iC2mlnf119SjbQl+8o118 NWRxCbtugLm8lUEUpltQHj4ZG7w4nteSbpzEl895Xz2ibnlTfO7PZ1E0/z337I93lu1N EWwg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q14-v6si387542pgm.512.2018.07.19.16.23.56; Thu, 19 Jul 2018 16:24:11 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731262AbeGTAHv (ORCPT + 99 others); Thu, 19 Jul 2018 20:07:51 -0400 Received: from terminus.zytor.com ([198.137.202.136]:34099 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727743AbeGTAHv (ORCPT ); Thu, 19 Jul 2018 20:07:51 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w6JNLULn2451213 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 19 Jul 2018 16:21:30 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w6JNLUiN2451210; Thu, 19 Jul 2018 16:21:30 -0700 Date: Thu, 19 Jul 2018 16:21:30 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Joerg Roedel Message-ID: Cc: dave.hansen@intel.com, linux-kernel@vger.kernel.org, peterz@infradead.org, eduval@amazon.com, bp@alien8.de, mingo@kernel.org, tglx@linutronix.de, dvlasenk@redhat.com, jpoimboe@redhat.com, torvalds@linux-foundation.org, hpa@zytor.com, will.deacon@arm.com, aarcange@redhat.com, llong@redhat.com, jgross@suse.com, David.Laight@aculab.com, dhgutteridge@sympatico.ca, jroedel@suse.de, gregkh@linuxfoundation.org, brgerst@gmail.com, jkosina@suse.cz, luto@kernel.org, pavel@ucw.cz, boris.ostrovsky@oracle.com Reply-To: brgerst@gmail.com, jroedel@suse.de, gregkh@linuxfoundation.org, luto@kernel.org, pavel@ucw.cz, boris.ostrovsky@oracle.com, jkosina@suse.cz, llong@redhat.com, jgross@suse.com, dhgutteridge@sympatico.ca, David.Laight@aculab.com, dvlasenk@redhat.com, mingo@kernel.org, tglx@linutronix.de, will.deacon@arm.com, aarcange@redhat.com, torvalds@linux-foundation.org, hpa@zytor.com, jpoimboe@redhat.com, linux-kernel@vger.kernel.org, peterz@infradead.org, dave.hansen@intel.com, bp@alien8.de, eduval@amazon.com In-Reply-To: <1531906876-13451-7-git-send-email-joro@8bytes.org> References: <1531906876-13451-7-git-send-email-joro@8bytes.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/pti] x86/entry/32: Split off return-to-kernel path Git-Commit-ID: 0d2eb73b29996684d5bbb72f85c74b47b4c359f7 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-0.8 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q,FREEMAIL_FORGED_REPLYTO autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 0d2eb73b29996684d5bbb72f85c74b47b4c359f7 Gitweb: https://git.kernel.org/tip/0d2eb73b29996684d5bbb72f85c74b47b4c359f7 Author: Joerg Roedel AuthorDate: Wed, 18 Jul 2018 11:40:43 +0200 Committer: Thomas Gleixner CommitDate: Fri, 20 Jul 2018 01:11:37 +0200 x86/entry/32: Split off return-to-kernel path Use a separate return path when returning to the kernel. This allows 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 Signed-off-by: Thomas Gleixner Tested-by: Pavel Machek Cc: "H . Peter Anvin" Cc: linux-mm@kvack.org Cc: Linus Torvalds Cc: Andy Lutomirski Cc: Dave Hansen Cc: Josh Poimboeuf Cc: Juergen Gross Cc: Peter Zijlstra Cc: Borislav Petkov Cc: Jiri Kosina Cc: Boris Ostrovsky Cc: Brian Gerst Cc: David Laight Cc: Denys Vlasenko Cc: Eduardo Valentin Cc: Greg KH Cc: Will Deacon Cc: aliguori@amazon.com Cc: daniel.gruss@iaik.tugraz.at Cc: hughd@google.com Cc: keescook@google.com Cc: Andrea Arcangeli Cc: Waiman Long Cc: "David H . Gutteridge" Cc: joro@8bytes.org Link: https://lkml.kernel.org/r/1531906876-13451-7-git-send-email-joro@8bytes.org --- 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 43641310b6e3..7251c4f3e99e 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