Re: [patch 4/6] ide: allow ide_dev_read_id() to be called from the IRQ context

David Miller
2009-06-23T23:23:00Z

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Date: Tue, 23 Jun 2009 23:29:11 +0200

> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Subject: [PATCH] ide: allow ide_dev_read_id() to be called from the IRQ context
>
> * Un-static __ide_wait_stat().
>
> * Allow ide_dev_read_id() helper to be called from the IRQ context by
> adding irq_ctx flag and using mdelay()/__ide_wait_stat() when needed.
>
> * Switch ide_driveid_update() to set irq_ctx flag.
>
> This change is needed for the consecutive patch which fixes races in
> handling of user-space SET XFER commands but for improved bisectability
> and clarity it is better to do it in a separate patch.
>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> ---
> I'm not completely happy with this version of patch since I originally
> intended to unify ide_busy_sleep() with __ide_wait_stat() first..

This and patch #5 seems way overkill for the problem being solved.

All requests programmed into the device get synchronized through the
block request queue, even these raw taskfile commands.

It seems to me that it should be possible to use the block request
layer facilities to plug the queue, wait all executing commands to
complete and for the device to quiesce, then push this single RAW
command from the user to the device, and finally unplug the queue.

Alternatively, if the block request layer can't help, we can put a
mutex around submissions, and have this user RAW command submission
take that mutex.

Anything other than moving code that does significant delays into
interrupt context.