Re: [patch 13/26] Xen-paravirt_ops: Consistently wrap paravirt ops callsites to make them patchable

David Miller
2007-04-12T23:16:24Z

From: Paul Mackerras <paulus@samba.org>
Date: Wed, 21 Mar 2007 11:03:14 +1100

> Linus Torvalds writes:
>
> > We should just do this natively. There's been several tests over the years
> > saying that it's much more efficient to do sti/cli as a simple store, and
> > handling the "oops, we got an interrupt while interrupts were disabled" as
> > a special case.
> >
> > I have this dim memory that ARM has done it that way for a long time
> > because it's so expensive to do a "real" cli/sti.
> >
> > And I think -rt does it for other reasons. It's just more flexible.
>
> 64-bit powerpc does this now as well.

I was curious about this so I had a look.

There appears to be three pieces of state used to manage this
on powerpc, PACASOFTIRQEN(r13), PACAHARDIRQEN(r13) and the
SOFTE() in the stackframe.

Plus there is all of this complicated logic on trap entry and
exit to manage these three values properly.

local_irq_restore() doesn't look like a simple piece of code
either. Logically it should be simple, update the software
binary state, and if enabling see if any interrupts came in
while we were disable so we can run them.

Given all of that, is it really cheaper than just flipping the
bit in the cpu control register? :-/