[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <478B86DA.1010902@gmail.com>
Date: Mon, 14 Jan 2008 16:59:22 +0100
From: Jiri Slaby <jirislaby@...il.com>
To: Cyrill Gorcunov <gorcunov@...il.com>
CC: Paul Gortmaker <p_gortmaker@...oo.com>,
LKML <linux-kernel@...r.kernel.org>, Andi Kleen <ak@...e.de>,
Alexey Dobriyan <adobriyan@...il.com>
Subject: Re: [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).
--
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