Received: by 10.223.185.116 with SMTP id b49csp2425784wrg; Mon, 5 Mar 2018 02:39:08 -0800 (PST) X-Google-Smtp-Source: AG47ELtY/I3ozWGGqVdOi7nCK4SC/PgLtgndJEd8U+IgYIawoJ3VaYMdYbX3cRisJfJdTFhqnsAC X-Received: by 2002:a17:902:63:: with SMTP id 90-v6mr12505185pla.125.1520246348225; Mon, 05 Mar 2018 02:39:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520246348; cv=none; d=google.com; s=arc-20160816; b=ws9SRlFn9Hvxhl3wknpXcIbM0y2dMOVpLiveI/xY3+j4eg7m7BqdDQjRP+tfE++Xyx lmIddP0EIqqc9DIXBZMbek/vlssDv7pVQLeh6giOsk0O7uerOM4cUibK4fQ76PLxqEEL P7H0puDPqUGPucc82OsQU/ahztpWN6YOkqdz0ainnCW2ytQUPqI5adxZj6mWuKKPguhm zzMbSOs5oxAj9tGAgFJpCOLAI8wyjzizUBCZFsu4zH2/1/MrKc9qmhwaSCATVue7fxXO 1PlRhc1s0OIlm47sN4D2kBWRWnidRksSmwsO7E/OHBvPnn8bY8IGmVqbMpR+V9wIX+7Q yADw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=c+a2sINmdTrcI8vkYK/XU7EvC9UjG9GZQWNCAcJ90XU=; b=PnPIoo5W7Smj1/d0UdHj2KjZmQPopV3W9l6uBZ+dzNWwcFDJeEI0SmM601KnlANl/K byUdC15eziGg6VU68T5mHPhqImKPUSqE0zl1Et58+tUr+e9hPKWQdFg1CIScxf64XRYw vS4OtYFiLOQlJT7c+7JIZ39ZZ0tm2Yt94PwNnZFtEeFVmXHsoKrcQpZDBRvq37HWWe79 d11ysSHSegGvEIP8kl2LxzB2FNRfvrkSRvBytFn5QJ8I1Jktt/suZR9Ac6UDaFEJsuzJ lTHW1jcHslK3PV60Iqk/fvKQcwj+b+eFtYlB+pOE6CGhW9ibvGA/2kHheB1XonJBnfEu lXzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@8bytes.org header.s=mail-1 header.b=dEU5p3qF; 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=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m72si9964750pfj.159.2018.03.05.02.38.53; Mon, 05 Mar 2018 02:39:08 -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=fail (test mode) header.i=@8bytes.org header.s=mail-1 header.b=dEU5p3qF; 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=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934348AbeCEKdw (ORCPT + 99 others); Mon, 5 Mar 2018 05:33:52 -0500 Received: from 8bytes.org ([81.169.241.247]:54374 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933385AbeCEK0M (ORCPT ); Mon, 5 Mar 2018 05:26:12 -0500 Received: by theia.8bytes.org (Postfix, from userid 1000) id 248D3858; Mon, 5 Mar 2018 11:26:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1520245566; bh=UbiL58EAxlijfMQrPA37HGknax7TkmIS93sX66QEIqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dEU5p3qFf04IKOYHbT16SDYaODzKrq/cHZtF2esZWU3MauNSR2GDlMU/4kFBsHDC3 mbzt5Z6RQ5MzSQiDM9+mX6BgcYjN/QwBlb83Ow7y0d+F4r3sIRbwFm4r2UxgV70zIf /sUmWRIg5YMIZ+XafU7g9mfeNWblVbW4p7ka4g8mR+0cVnWBFAJQ59ERsXuF0APVNN bMwRpY+BBLiJHRsNrhcXRETeZ4bbcDpon2KOGG9SnuyjQ9B4+9puyYpUSOF9neJPtb lEE8ZSc89GgObkZNwRmeGuMFpqSVm6AuFkpMrGjSfkmXw4R48z9qcrJFj1dfap44t2 yz08uEgWcJGpw== 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 , jroedel@suse.de, joro@8bytes.org Subject: [PATCH 06/34] x86/entry/32: Split off return-to-kernel path Date: Mon, 5 Mar 2018 11:25:35 +0100 Message-Id: <1520245563-8444-7-git-send-email-joro@8bytes.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520245563-8444-1-git-send-email-joro@8bytes.org> References: <1520245563-8444-1-git-send-email-joro@8bytes.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 00ae759..9bd7718 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 @@ -400,9 +400,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) @@ -602,6 +602,11 @@ restore_all: .Lirq_return: 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 -- 2.7.4