[Lguest] mercurial repo

Rusty Russell rusty at rustcorp.com.au
Fri Jul 27 10:34:58 EST 2007


On Thu, 2007-07-26 at 13:10 -0700, ron minnich wrote:
> I fail the test. Where is the mercurial repo at this point? I pulled
> it down at some point but memory fails. I've got a proposed patch or
> two.

Hi Ron!

Sure, it's at http://lguest.ozlabs.org/patches but Linus' git tree is
pretty close now, so patches against that would be OK too.

> Next question. I do have a working patch to allow experts to set the
> system call #. Really, though, it makes more sense to set this in
> sysfs or via a per-guest ioctl or some such, right? What's the fix
> here? Plan 9 port is done, but I do need this change among others.

Since we want direct system calls, we don't want to trap into the
hypervisor every time (otherwise we'd catch the #gp and emulate).  This
means we need to request_irq() to make sure no real device needs the
irq, then let the guest override it.

I think the simplest thing is to have a system call # in the lguest_data
struct sent by the initial hypercall, but only allow one, something
like:

interrupts_and_traps.c:

static unsigned res_syscall, res_syscall_use;

void setup_syscall(struct lguest *lg)
{
	if (lg->syscall == SYSCALL_VECTOR)
		return;

	down_mutex(&lguest_lock);
	if (!res_syscall_use) {
		if (request_irq(lg->syscall, dummy_handler, 0, "lguest", NULL))
			kill_guest(lg, "Could not allocate syscall vector %u", lg->syscall);
		else {
			res_syscall = lg->syscall;
			res_syscall_use++;
		}
	} else if (reserved_syscall == lg->syscall)
		res_syscall_use++;
	else
		kill_guest(lg, "Syscall %u already reserved, not %u", res_syscall, lg->syscall); 
	up_mutex(&lguest_lock);
}

...

void release_syscall(struct lguest *lg)
{
	if (lg->syscall == SYSCALL_VECTOR || !lg->syscall)
		return;
	if (res_syscall == lg->syscall && --res_syscall_use == 0)
		free_irq(res_syscall, NULL);
}
	
Cheers,
Rusty.




More information about the Lguest mailing list