qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Linux kernel polling for QEMU


From: Paolo Bonzini
Subject: Re: [Qemu-devel] Linux kernel polling for QEMU
Date: Tue, 29 Nov 2016 12:17:56 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0


On 29/11/2016 11:32, Fam Zheng wrote:
> 
> The kernel change will be a new prctl operation (should it be a different
> syscall to extend?) to register a new type of eventfd called "idle eventfd":
> 
>     prctl(PR_ADD_IDLE_EVENTFD, int eventfd);
>     prctl(PR_DEL_IDLE_EVENTFD, int eventfd);
> 
> It will be notified by kernel each time when the thread's local core has no
> runnable threads (i.e., entering idle state).
> 
> QEMU can then add this eventfd to its event loop when it has events to poll, 
> and
> watch virtqueue/linux-aio memory from userspace in the fd handlers.  
> Effectiely,
> if a ppoll() would have blocked because there are no new events, it could now
> return immediately because of idle_eventfd events, and do the idle polling.

This has two issues:

* it only reports the leading edge of single_task_running().  Is it also
useful to stop polling on the trailing edge?

* it still needs a system call before polling is entered.  Ideally, QEMU
could run without any system call while in polling mode.

Another possibility is to add a system call for single_task_running().
It should be simple enough that you can implement it in the vDSO and
avoid a context switch.  There are convenient hooking points in
add_nr_running and sub_nr_running.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]