This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
RE: gettimeofday with interrupts disabled
- From: "Stone, Joshua I" <joshua dot i dot stone at intel dot com>
- To: "James Dickens" <jamesd dot wi at gmail dot com>
- Cc: <azizeker at gmail dot com>, <systemtap at sources dot redhat dot com>
- Date: Mon, 8 May 2006 15:29:28 -0700
- Subject: RE: gettimeofday with interrupts disabled
On Monday, May 08, 2006 3:12 PM, James Dickens wrote:
> On 5/8/06, Stone, Joshua I <joshua.i.stone@intel.com> wrote:
>> On Sunday, May 07, 2006 6:24 PM, Aziz Eker wrote:
>>> I want to get some measurements about the time scheduler_tick()
>>> function takes. To do that, I am finding time difference between the
>>> start and end of the function using 'gettimeofday_us'. However, the
>>> scheduler_tick() function is called with interrupts disabled. Does
>>> 'gettimeofday' continue to run even when interrupts are disabled? If
>>> not, is there anyway to count the RTC in systemtap?
>>
>> Calling gettimeofday is only a problem for probes in code sections
>> that hold a write lock on xtime_lock. See bug #2525 for more
>> details: http://sources.redhat.com/bugzilla/show_bug.cgi?id=2525
>>
> what if its an smp machine, and and someone else is calling
> gettimeofday? seems like a race to me..
A race for what? 'do_gettimeofday' only takes a read lock on
xtime_lock, and multiple read locks are perfectly fine.
Even if the read locks were exclusive, it still would not be a deadlock.
One thread would be left waiting for the other to release, but since
your scenario is running on independent CPUs, the lock will eventually
be released.
Josh