qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC 0/8] arm AioContext with its own timer stuff


From: liu ping fan
Subject: Re: [Qemu-devel] [RFC 0/8] arm AioContext with its own timer stuff
Date: Wed, 24 Jul 2013 15:43:58 +0800

On Wed, Jul 24, 2013 at 2:42 PM, Paolo Bonzini <address@hidden> wrote:
> Il 24/07/2013 03:28, liu ping fan ha scritto:
>> On Tue, Jul 23, 2013 at 6:30 PM, Paolo Bonzini <address@hidden> wrote:
>>> > Il 23/07/2013 04:53, liu ping fan ha scritto:
>>>> >> The scenior I can figure out is if adopting timeout of poll, then when
>>>> >> changing the deadline, we need to invoke poll, and set the new
>>>> >> timeout, right?
>>> >
>>> > Yes, you need to call aio_notify so that poll is reinvoked.
>>> >
>> I try to list the difference between alarm_timer and timeout of poll.
>> It includes thread-affinity, resolution and easy-use.
>>
>> Most of all,  thread-affinity
>> The main issue with alarm timer is the affinity of timer_t with
>> threads. For linux, SIGEV_THREAD_ID has been supported for a very long
>> time and we already associate the signal with the specified thread. So
>> the only issue is left for other unix, we can emulate the affinity by
>> using SIGEV_THREAD and repost the event to the specified thread.
>> As to timeout of poll, it has the affinity of threads.
>>
>> Resolution:
>> alarm_timer provides higher resolution, but do we care about it?
>
> With ppoll, is this true or just hearsay?
>
> (Without ppoll, indeed setitimer has 1 us resolution while poll has 1
> ms; too bad that select has other problems, because select has also 1 us
> resolution).
>
Paid some time to dig the kernel code, and find out that the
resolution lost by timeout of poll/select..etc is cause by the timeout
is a slack region.
See code in
do_poll()
   if (!poll_schedule_timeout(wait, TASK_INTERRUPTIBLE, to, slack))

Notice the slack param, it causes the lose of resolution.
The process default slack time  inherits from init_task and it is
      .timer_slack_ns = 50000, /* 50 usec default slack */
But we can fix it by PR_SET_TIMERSLACK to decrease it for select/poll/...

So ppoll with timerslack adjustment will meet our requirement. But
what about other non-linux system?

Regards,
Pingfan

> Paolo
>
>> easy-use:
>> The reset of the deadline as mentioned.
>>
>> Finally, I admit timeout of poll will save large chunk of platform-related 
>> code.
>



reply via email to

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