Re: [kvm-devel] [RFC][KVM] Adding a signal mask to KVM_RUN

From: Rusty Russell
Date: Thu Mar 01 2007 - 17:24:17 EST


On Thu, 2007-03-01 at 17:07 +0200, Avi Kivity wrote:
> I'd like to add a signal mask to kvm, so that when the guest executes,
> the signal mask is temporarily set to some user specified value. This
> allows signals to be used as a way to interrupt the guest, but without
> requiring signal delivery to the userspace handler (which is what makes
> signals expensive).

Hi Avi!

lguest uses SIGUSR1 for similar reasons (console input, incoming
packet). Basically it forks and the child does a select, then sends
SIGUSR1 to the parent whenever the select returns, to pop the parent out
of the kernel/guest.

It's nasty in another respect: the race between checking signal and
entering kernel. (Hence my child sends SIGUSR1 whenever select returns,
but it runs at v. low prio so it usually only sends one before the
parent clears the fd).

My original code passed an fd into the kernel: whenever the fd was
readable, the lg module returned to userspace. This avoids the race,
but might be more awkward to use. I shied away from a complete
select/poll-style mask which would have done exactly what I wanted, but
perhaps this should be considered.

Rusty.


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