lkml.org 
[lkml]   [2008]   [Jan]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] driver: ip27-rtc - convert ioctl to unlocked_ioctl
On 01/14/2008 04:38 PM, Cyrill Gorcunov wrote:
> Jiri, I mean rtc_open() is protected by spinlock+status from being
> opened simultaneously by a few processes. *But* lets imagine the
> following situation - this fd (file descriptor) is opened by one
> multithreaded application so all threads have an access to this
> fd. Then one thread reads rtc periodically thru unlocked_ioctl
> and another thread set new time from time to time. So the question
> I have - is it possible to get second thread stopped at attemption to
> get rtc spinlock while another thread is setting the new time? Or
> this situation never-ever could be? i'm not really familiar with
> process management in Linux and as result could be wrong.

Access to global variable 'rtc' (the rtc itself) is serialized through the
spinlock, I see no problem there. If you call read-read-write-read from 4 tasks
in userspace, it might be _still_ (no change) reordered to e.g.
write-read-read-read by the scheduler.

In fact, the reading process is stopped while the another one is writing the
time (due to spinlock).


\
 
 \ /
  Last update: 2008-01-14 17:03    [W:0.051 / U:0.572 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site