Re: Accelerating user mode linux

Jeff Dike
2002-08-02T03:34:02Z

alan@redhat.com said:
> We add
> sys_switchmm(address);
> This switches to the altmm (creating one if it doesnt exist as a copy
> of the current mm), flushes the tlb and jumps to the address given.

You didn't explicitly say (and so I had to ask :-) that this is intended
to be the mechanism by which UML returns to userspace, rather than the
normal sigreturn you'd get by just returning from the handler.

So, this would make the entry to userspace look like:
restore registers
.
.
.
sys_switchmm(ip);

The problem with this is that it needs to be atomic wrt signals. There
can't be an interrupt in the middle of that sequence. So, sys_switchmm
would also have to restore the old signal mask, which you'd have to pass
in unless you're going to read it off the signal frame. Also, it would
have to be open coded because you've already restored the stack pointer.

So, the entry to userspace starts looking like:
block signals
restore registers
sys_switchmm(ip, new_sigmask);

Well, except for the blocking signals part, this is sigreturn under a
different name and partly moved into userspace.

Your objection to returning through sigreturn was performance. Is performance
a veto of adding an mm switch to sigreturn, or it is possible to make it
acceptible?

Also, is a new sigreturn_mm() reasonable? This would be close to sys_switchmm,
except that it would restore registers and would be a plug replacement for
sigreturn[_rt]. I don't favor this because it would probably have to choose
whether to be an _rt return or not, and I'd like the option of having UML
register some signals as SA_INFO (currently, they are all non SA_INFO).

Comments, brickbats, spanners?

Jeff