All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Andy Lutomirski <luto@amacapital.net>,
	Thomas Gleixner <tglx@linutronix.de>, X86 ML <x86@kernel.org>,
	Ingo Molnar <mingo@redhat.com>
Cc: Sebastian Lackner <sebastian@fds-team.de>,
	Anish Bhatt <anish@chelsio.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Chuck Ebbert <cebbert.lkml@gmail.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH v2 1/2] x86_64,entry: Filter RFLAGS.NT on entry from userspace
Date: Wed, 01 Oct 2014 08:22:16 -0700	[thread overview]
Message-ID: <542C1C28.9050408@zytor.com> (raw)
In-Reply-To: <0e906bdeba3660c9766248d3d7229e78a423ca5b.1412138935.git.luto@amacapital.net>

On 09/30/2014 09:51 PM, Andy Lutomirski wrote:
> 
> diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
> index 4299eb05023c..44d1dd371454 100644
> --- a/arch/x86/ia32/ia32entry.S
> +++ b/arch/x86/ia32/ia32entry.S
> @@ -151,6 +151,18 @@ ENTRY(ia32_sysenter_target)
>  1:	movl	(%rbp),%ebp
>  	_ASM_EXTABLE(1b,ia32_badarg)
>  	ASM_CLAC
> +
> +	/*
> +	 * Sysenter doesn't filter flags, so we need to clear NT
> +	 * ourselves.  To save a few cycles, we can check whether
> +	 * NT was set instead of doing an unconditional popfq.
> +	 */
> +	testl $X86_EFLAGS_NT,EFLAGS(%rsp)	/* saved EFLAGS match cpu */
> +	jz 1f
> +	pushq_cfi $(X86_EFLAGS_IF|X86_EFLAGS_FIXED)
> +	popfq_cfi
> +1:
> +

I'm wondering if it would be easier to just remove ASM_CLAC and do this
unconditionally.  On SMAP-enabled hardware then that gives us back some
of the cycles, may make the branch unnecessary.

	-hpa



  parent reply	other threads:[~2014-10-01 15:22 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-01  4:51 [PATCH v2 0/2] x86_64,entry: Clear NT on entry and speed up switch_to Andy Lutomirski
2014-10-01  4:51 ` [PATCH v2 1/2] x86_64,entry: Filter RFLAGS.NT on entry from userspace Andy Lutomirski
2014-10-01  5:09   ` Sebastian Lackner
2014-10-01  5:24     ` Andy Lutomirski
2014-10-01 15:19       ` H. Peter Anvin
2014-10-01 14:09   ` Chuck Ebbert
2014-10-01 14:32     ` Chuck Ebbert
2014-10-01 14:46       ` Andy Lutomirski
2014-10-01 14:56         ` Chuck Ebbert
2014-10-01 15:03           ` Andy Lutomirski
2014-10-01 15:22   ` H. Peter Anvin [this message]
2014-10-01 15:26     ` H. Peter Anvin
2014-10-01 15:50       ` Andy Lutomirski
2014-10-01 16:04         ` Andy Lutomirski
2014-10-01 16:17           ` H. Peter Anvin
2014-10-01  4:51 ` [PATCH v2 2/2] x86_64: Don't save flags on context switch Andy Lutomirski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=542C1C28.9050408@zytor.com \
    --to=hpa@zytor.com \
    --cc=anish@chelsio.com \
    --cc=cebbert.lkml@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@redhat.com \
    --cc=sebastian@fds-team.de \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.