Re: [Bug 350] New: i386 context switch very slow compared to 2.4 due to wrmsr (performance)

Jamie Lokier
2003-02-12T10:16:57Z

Andi Kleen wrote:
> + /* FIXME should disable preemption here but how can we reenable it? */
> +
> + enable_sysenter();
> +

Try this:

1. Disable preemption in do_sys_vm86(), at the same place as
disable_sysenter() is called.

2. Enable preemption in save_v86_state(), and put the call
to enable_sysenter() there.

3. In restore_sigcontext() [signal.c], _iff_ the VM flag
is set in the restored context, call disable_sysenter()
and also disable preemption.

That should make vm86 simply disable preemption while it is activated.
It is not as nice as actually being preemptible, but safe first,
optimise later.

The return path to vm86 mode has the peculiar property of not doing
the need_resched test, unlike the return path to normal user space,
which is a boon here.

-- Jamie