LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [RFC][KVM] Adding a signal mask to KVM_RUN
@ 2007-03-01 15:07 Avi Kivity
2007-03-01 22:23 ` [kvm-devel] " Rusty Russell
0 siblings, 1 reply; 2+ messages in thread
From: Avi Kivity @ 2007-03-01 15:07 UTC (permalink / raw)
To: kvm-devel, linux-kernel
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).
The question is how to fit the signal mask to the kvm userspace
interface (which has a shared kernel/user structure that userspace
mmaps). I see several options:
1. Add a __u64 to that structure. This is the simplest option, but I
see that signal masks in the kernel/user interface are variable-length
bitmaps, so this clearly doesn't work well.
2. Add __u32 signal_mask_offset and signal_mask_size members to the
structure to tell userspace where to store the signal mask (in the same
shared area). A disadvantage is that here the kernel tells the user the
size of the signal mask instead of the other way round as is traditional.
3. Add a separate ioctl to set the signal mask. A NULL parameter
disables the signal mask functionality.
I am in favor of the third option, but the existence of three options
tells me more are possible.
[Just as background, signals are used for the following in our modified
qemu, the only known public client for kvm:
- interrupt the guest to get timer interrupts
- interrupt the guest on packet arrival
- interrupt the guest on aio completion
- (future) for guest smp, to simulate IPIs]
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [kvm-devel] [RFC][KVM] Adding a signal mask to KVM_RUN
2007-03-01 15:07 [RFC][KVM] Adding a signal mask to KVM_RUN Avi Kivity
@ 2007-03-01 22:23 ` Rusty Russell
0 siblings, 0 replies; 2+ messages in thread
From: Rusty Russell @ 2007-03-01 22:23 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel, linux-kernel
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-03-01 22:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-01 15:07 [RFC][KVM] Adding a signal mask to KVM_RUN Avi Kivity
2007-03-01 22:23 ` [kvm-devel] " Rusty Russell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).