On 07/17, Mark McLoughlin wrote: > > On Wed, 2008-07-16 at 20:21 +0400, Oleg Nesterov wrote: > > On 07/16, Mark McLoughlin wrote: > > > > > > When a timer fires, posix_timer_event() zeroes out its > > > pre-allocated siginfo structure, initialises it and then > > > queues up the signal with send_sigqueue(). > > > > > > However, we may have previously queued up this signal, in > > > which case we only want to increment si_overrun and > > > re-initialising the siginfo structure is incorrect. > > > > Quoting Roland McGrath: > > > > > > I'm not clear on how the already-queued case could ever happen. Do we > > > really need that check at all? It shouldn't be possible for the > > timer to > > > be firing when it's already queued, because it won't have been > > reloaded. > > > It only reloads via do_schedule_next_timer after it's dequeued, or > > because > > > a 1 return value said it never was queued. > > The app can reload the timer itself before the signal has been dequeued > via signalfd ...
Indeed! Thanks Mark. Thomas, Roland, could you take a look? > > If we need this fix, perhaps it is better to modify posix_timer_event() > > to check !list_empty()? > > Yeah, I had considered that, but it's a tad more invasive. See below. > > I mainly don't like this patch Agreed, this one looks worse. I forgot (if ever knew ;) this code completely, but can't we make a simpler fix? posix_timer_event() can check list_empty() lockless, posix_timer_event() { if (!list_emtpy(sigq->list)) return 0; ... fill and send ->sigq... } When the signal will be dequeued, schedule_next_timer() should afaics set ->it_overrun_last which is copied to ->si_overrun then. Or we can increment timr->it_overrun before return if I misread hrtimer_forward(). What do you think? Another possible fix... we can change sys_timer_settime() to do sigqueue_free() and re-alloc ->sigq when it is pending. Not that I like this very much though. Oleg. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html