lkml.org 
[lkml]   [2004]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch, 2.6.10-rc3] safe_hlt() & NMIs


On Thu, 16 Dec 2004, Ingo Molnar wrote:
>
> i also played a bit with the %ss instructions, and combined them with
> the cli/sti instructions and other instructions in various ways, and
> with a bit of experimenting found the following, somewhat surprising
> results:
>
> [ snip ]
>
> it shows a number of interesting effects:
>
> - "mov %eax,%ss" followed by the _same_ instruction cancels the
> black-hole. This i suspect is done to prevent the lockup in vm86
> mode.

I don't think it's the "same instruction". Looking at the pattern, I think
that a "mov->ss" always checks interrupts _before_ it executes, and never
checks interrupts _after_ it executes.

So I think the pattern is (for your athlon64):

- regular instructions check interrupts before they execute, _except_ if
the "dontcheck" flag was set. They clear "dontcheck" after execution.
- "mov->ss" always checks interrupts before it executes, regardless of
"dontcheck". It always sets "dontcheck".
- "sti" sets "dontcheck" if interrupts were disabled before.

So you can get two-instruction holes by doing the sequence

/* interrupts disabled */
mov->ss
sti
/* any instruction except cli/mov->ss */

but no other combination (series of "mov->ss" will always check _before_
each "mov->ss", and series of "sti" will obviously only have interrupts
disabled for the _first_ sti).

And I suspect this is very much micro-architecture-dependent, although the
Athlon64 rules seem very simple and straightforward.

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2009-11-18 23:46    [W:0.066 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site