All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Disabling interrupts before block device request call
  2001-05-25 23:20 Disabling interrupts before block device request call Alexandr Andreev
@ 2001-05-25 22:01 ` Jens Axboe
  2001-05-28 19:07   ` Why timer interrupt is disabled? Alexandr Andreev
  2001-05-28 19:24   ` Disabling interrupts before block device request call Alexandr Andreev
  0 siblings, 2 replies; 5+ messages in thread
From: Jens Axboe @ 2001-05-25 22:01 UTC (permalink / raw)
  To: Alexandr Andreev; +Cc: linux-kernel

On Fri, May 25 2001, Alexandr Andreev wrote:
> Hi, list
> In ll_rw_block.c, before calling block device specific request function 
> ( i mean do_hd_request, do_ftl_request, ... ) the io_request_lock is 
> locking, and all interrupts are disabling. I know, that request handler 
> routine have to be atomic, but when we read data from a flash device ( 
> for example ) we use a timeouts. Where do we have to enable timer 
> interrupts, or should we disable all interrupts?

Even with dropping io_request_lock, it's not recommended to sleep inside
the request_fn. WIth plugging, you are basically preventing the other
plugged queues from being run until you return.

You could use a timer or similar to call you on a specified timeout
instead.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Disabling interrupts before block device request call
@ 2001-05-25 23:20 Alexandr Andreev
  2001-05-25 22:01 ` Jens Axboe
  0 siblings, 1 reply; 5+ messages in thread
From: Alexandr Andreev @ 2001-05-25 23:20 UTC (permalink / raw)
  To: linux-kernel

Hi, list
In ll_rw_block.c, before calling block device specific request function 
( i mean do_hd_request, do_ftl_request, ... ) the io_request_lock is 
locking, and all interrupts are disabling. I know, that request handler 
routine have to be atomic, but when we read data from a flash device ( 
for example ) we use a timeouts. Where do we have to enable timer 
interrupts, or should we disable all interrupts?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Why timer interrupt is disabled?
  2001-05-28 19:07   ` Why timer interrupt is disabled? Alexandr Andreev
@ 2001-05-28 15:36     ` David Woodhouse
  0 siblings, 0 replies; 5+ messages in thread
From: David Woodhouse @ 2001-05-28 15:36 UTC (permalink / raw)
  To: Alexandr Andreev; +Cc: linux-mtd@lists.infrared.org


andreev@niisi.msk.ru said:
>  It may happen that one  CPU is reading and other CPU is writing data
> at the same time. So, the  flash memory can return status value
> instead of data, for example. Does  the chip->mutex lock provides
> necessary synchronization?

Yes. The flash driver is required to make that work correctly. The (blkdev)
request functions aren't required to be reentrant anyway, I believe.

> I look at the other block device drivers code and found, that
> io_request  handlers do sti() in some cases. If you still don`t want
> to do it, we  could use a softirq. In the do_fd_request(), the "bottom
> halves" is used  for example. We could use a "bottom halves" or even a
> tasklet in our  case. What do you think about this?

Take a look at the way it's done by the mtdblock device, with a kernel 
thread.

--
dwmw2

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Why timer interrupt is disabled?
  2001-05-25 22:01 ` Jens Axboe
@ 2001-05-28 19:07   ` Alexandr Andreev
  2001-05-28 15:36     ` David Woodhouse
  2001-05-28 19:24   ` Disabling interrupts before block device request call Alexandr Andreev
  1 sibling, 1 reply; 5+ messages in thread
From: Alexandr Andreev @ 2001-05-28 19:07 UTC (permalink / raw)
  To: dwmw2; +Cc: linux-mtd@lists.infrared.org

I had asked this question to linux-kernel@vger.kernel.org and there is 
the answer:

Jens Axboe wrote:

>On Fri, May 25 2001, Alexandr Andreev wrote:
>
>>Hi, list
>>In ll_rw_block.c, before calling block device specific request function 
>>( i mean do_hd_request, do_ftl_request, ... ) the io_request_lock is 
>>locking, and all interrupts are disabling. I know, that request handler 
>>routine have to be atomic, but when we read data from a flash device ( 
>>for example ) we use a timeouts. Where do we have to enable timer 
>>interrupts, or should we disable all interrupts?
>>
>
>Even with dropping io_request_lock, it's not recommended to sleep inside
>the request_fn. WIth plugging, you are basically preventing the other
>plugged queues from being run until you return.
>
>You could use a timer or similar to call you on a specified timeout
>instead.
>
... and nevertheless, this is a bad idea to unlock the io_request_lock 
inside the do_ftl_request. What about the SMP? It may happen that one 
CPU is reading and other CPU is writing data at the same time. So, the 
flash memory can return status value instead of data, for example. Does 
the chip->mutex lock provides  necessary synchronization?
I look at the other block device drivers code and found, that io_request 
handlers do sti() in some cases. If you still don`t want to do it, we 
could use a softirq. In the do_fd_request(), the "bottom halves" is used 
for example. We could use a "bottom halves" or even a tasklet in our 
case. What do you think about this?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Disabling interrupts before block device request call
  2001-05-25 22:01 ` Jens Axboe
  2001-05-28 19:07   ` Why timer interrupt is disabled? Alexandr Andreev
@ 2001-05-28 19:24   ` Alexandr Andreev
  1 sibling, 0 replies; 5+ messages in thread
From: Alexandr Andreev @ 2001-05-28 19:24 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-kernel@vger.kernel.org

Jens Axboe wrote

>
>Even with dropping io_request_lock, it's not recommended to sleep inside
>the request_fn. WIth plugging, you are basically preventing the other
>plugged queues from being run until you return.
>
>You could use a timer or similar to call you on a specified timeout
>instead.
>
Does it mean, that if i need timer interrupts in my block device driver, 
i need to do sti() instead of unlock io_request_lock? Is there any 
common rule for device drivers in such case?




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-05-28 15:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-05-25 23:20 Disabling interrupts before block device request call Alexandr Andreev
2001-05-25 22:01 ` Jens Axboe
2001-05-28 19:07   ` Why timer interrupt is disabled? Alexandr Andreev
2001-05-28 15:36     ` David Woodhouse
2001-05-28 19:24   ` Disabling interrupts before block device request call Alexandr Andreev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.