mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: Zachary Amsden <zach@vmware.com>
Cc: Andi Kleen <ak@suse.de>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] 3/5 explicit-iopl
Date: Thu, 4 Aug 2005 17:46:49 +0200	[thread overview]
Message-ID: <20050804154649.GA8266@wotan.suse.de> (raw)
In-Reply-To: <42F2344D.1070209@vmware.com>

> Well... maybe.  On Opteron and/or Intel EMT it may not be a win.  The 
> cost of the branch could overtake the cost of the POPF (that's the 
> expensive one).  Grrr.

Not on Opteron, but probably on Intel.

iirc popf will actually flush parts of the trace cache, while
a branch shouldn't do that. So I expect it to be a win.


> 
> >Can we perhaps get rid of the PUSHF/POPF in the SYSENTER syscall path too?
> >iirc they were only for single stepping. But SYSENTER doesn't disable
> >single stepping, so the debug handler could detect this and set
> >some magic flag that restores it on syscall exit.
> > 
> >
> 
> A context switch requires IRET, which requires the flags to be saved, so 
> you can't eliminate the pushf (*) IIRC, the popf is already omitted.  

If we have iopl and TF elsewhere then the flags could just be replaced
with a default value. 

Drawback would be that it would be slightly incompatible to before,
but then it's just a function call and function calls are not 
required to preserve flags.

> (*) Well, you could.  It's just that system calls would have to clobber 
> flags - hmm.. sysenter based calls already do. But I'm not 100% sure 

They do pushf. 

> there isn't some bogon case where kernel preemption could cause you a 
> problem.  Keeping around the fake IRET frame still appears to be a good 
> thing to do just for the benefit of ptrace / debug functionality.  PUSHF 
> is cheap on every core I have measured on.

Are you sure? I thought it was expensive on Northwood at least.
Haven't measured on a Prescott or newer.

-Andi

  reply	other threads:[~2005-08-04 15:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200508040043.j740hi0R004184@zach-dev.vmware.com.suse.lists.linux.kernel>
2005-08-04 12:19 ` Andi Kleen
2005-08-04 15:29   ` Zachary Amsden
2005-08-04 15:46     ` Andi Kleen [this message]
2005-08-04  0:43 zach

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=20050804154649.GA8266@wotan.suse.de \
    --to=ak@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zach@vmware.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome