[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAE7jHC-Rbz0zA7UAAzs8iX9mHAC0bLUZY-igM8k7R258_sE0mA@mail.gmail.com>
Date: Wed, 14 Nov 2012 15:04:42 +0200
From: Constantine Shulyupin <const@...elinux.com>
To: Ryan Mallon <rmallon@...il.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] LDT - Linux Driver Template
On Wed, Nov 14, 2012 at 5:42 AM, Ryan Mallon <rmallon@...il.com> wrote:
> On 14/11/12 05:46, Constantine Shulyupin wrote:
>> From: Constantine Shulyupin <const@...eLinux.com>
>> + if (kfifo_is_empty(&in_fifo)) {
>
> Doesn't this require locking against whatever is filling the fifo?
I seems doesn't.
Note from include/linux/kfifo.h
/*
* Note about locking : There is no locking required until only * one reader
* and one writer is using the fifo and no kfifo_reset() will be * called
* kfifo_reset_out() can be safely used, until it will be only called
* in the reader thread.
* For multiple writer and one reader there is only a need to lock the writer.
* And vice versa for only one writer and multiple reader there is only a need
* to lock the reader.
*/
>> + if (mutex_lock_interruptible(&read_lock)) {
> The read_lock is only used here, so would only protect against
> concurrent reads. Isn't the read for a device function already
> synchronised against itself by the caller?
I can't find locking for read/write in sys_read, vfs_read
I just found lock misc_mtx for misc_open, misc_register.
>> + ret = kfifo_from_user(&out_fifo, buf, count, &copied);
> Shouldn't this function be grabbing fifo_lock to prevent concurrent
> access to the fifo by the tasklet function? write_lock has the same
> issues described for read_lock above.
Accordingly note about kfifo locking is shouldn't.
kfifo supports asynchronous i/o.
Thank you.
--
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