Re: [KVM-RFC PATCH 1/2] eventfd: add an explicit srcu based notifier interface

Michael S. Tsirkin
2009-06-16T14:46:37Z

On Tue, Jun 16, 2009 at 10:40:55AM -0400, Gregory Haskins wrote:
> > This is ugly, isn't it? With CONFIG_PREEMPT=no preemptible() is always false.
> >
> > Further, to do useful things it might not be enough that you can sleep:
> > with iofd you also want to access current task with e.g. copy from user.
> >
>
> Something else to consider: For iosignalfd, we can assume we will
> always be called from vcpu process context so we might not really need
> official affirmation from the system. For irqfd, we cannot predict who
> may be injecting the interrupt (for instance, it might be a
> PCI-passthrough hard-irq context). I am not sure if this knowledge
> actually helps to simplify the problem space, but I thought I should
> mention it.
>
> -Greg
>
>

The way this is addressed with eventfd_signal_task proposal is:
- user calls eventfd_signal_task
we look at current->mm and figure out whether this is the right
context or we need a context switch
- everyone else calls eventfd_signal
we know that we need a context switch