[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1314974233.30505.9.camel@lenny>
Date: Fri, 02 Sep 2011 10:37:12 -0400
From: Colin Walters <walters@...bum.org>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: linux-kernel@...r.kernel.org
Subject: TFD_CANCEL_ON_SET race when making a wall clock
Hi,
So I was recently making GNOME use the new timerfd TFD_CANCEL_ON_SET so
we get woken up when the system clock changes. It works generally well,
except Ryan Lortie pointed out a race condition in my use of
timerfd_settime() that I think anyone using it to make a wall clock
display might not realize at first:
https://bugzilla.gnome.org/show_bug.cgi?id=655129#c36
For the link-averse, basically the system clock can move backwards
between when the process gets the current time, and computes the wakeup
(typically for the next minute).
I was able to work around it in userspace with this patch:
http://bugzilla-attachments.gnome.org/attachment.cgi?id=195252
But it's clearly not what I'd call beautiful.
I don't see a nice way to handle this in the kernel given the current
API, but maybe someone else does?
TFD_CANCEL_ON_SET isn't documented in man-pages at all right now...maybe
this is just a useful note for a future patch to
man-pages/man2/timerfd_create.2.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists