+ uml-ubd-driver-ubd_io_lock-usage-fixup.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     uml ubd driver: ubd_io_lock usage fixup
has been added to the -mm tree.  Its filename is
     uml-ubd-driver-ubd_io_lock-usage-fixup.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: uml ubd driver: ubd_io_lock usage fixup
From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@xxxxxxxx>

Add some comments about requirements for ubd_io_lock and expand its use.

When an irq signals that the "controller" (i.e.  another thread on the host,
which does the actual requests and is the only one blocked on I/O on the host)
has done some work, we call again the request function ourselves
(do_ubd_request).

We now do that with ubd_io_lock held - that's useful to protect against
concurrent calls to elv_next_request and so on.

XXX: Maybe we shouldn't call at all the request function.  Input needed on
this.  Are we supposed to plug and unplug the queue?  That code "indirectly"
does that by setting a flag, called do_ubd, which makes the request function
return (it's a residual of 2.4 block layer interface).

Meanwhile, however, merge this patch, which improves things.

Cc: Jens Axboe <axboe@xxxxxxx>
Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@xxxxxxxx>
Cc: Jeff Dike <jdike@xxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 arch/um/drivers/ubd_kern.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff -puN arch/um/drivers/ubd_kern.c~uml-ubd-driver-ubd_io_lock-usage-fixup arch/um/drivers/ubd_kern.c
--- a/arch/um/drivers/ubd_kern.c~uml-ubd-driver-ubd_io_lock-usage-fixup
+++ a/arch/um/drivers/ubd_kern.c
@@ -106,6 +106,8 @@ static inline void ubd_set_bit(__u64 bit
 
 #define DRIVER_NAME "uml-blkdev"
 
+/* Can be taken in interrupt context, and is passed to the block layer to lock
+ * the request queue. Kernel side code knows that. */
 static DEFINE_SPINLOCK(ubd_io_lock);
 
 static DEFINE_MUTEX(ubd_lock);
@@ -497,6 +499,8 @@ static void __ubd_finish(struct request 
 	end_request(req, 1);
 }
 
+/* Callable only from interrupt context - otherwise you need to do
+ * spin_lock_irq()/spin_lock_irqsave() */
 static inline void ubd_finish(struct request *req, int error)
 {
  	spin_lock(&ubd_io_lock);
@@ -504,7 +508,7 @@ static inline void ubd_finish(struct req
 	spin_unlock(&ubd_io_lock);
 }
 
-/* Called without ubd_io_lock held */
+/* Called without ubd_io_lock held, and only in interrupt context. */
 static void ubd_handler(void)
 {
 	struct io_thread_req req;
@@ -525,7 +529,9 @@ static void ubd_handler(void)
 
 	ubd_finish(rq, req.error);
 	reactivate_fd(thread_fd, UBD_IRQ);	
+	spin_lock(&ubd_io_lock);
 	do_ubd_request(ubd_queue);
+	spin_unlock(&ubd_io_lock);
 }
 
 static irqreturn_t ubd_intr(int irq, void *dev)
_

Patches currently in -mm which might be from blaisorblade@xxxxxxxx are

fix-remove-the-use-of-_syscallx-macros-in-uml.patch
uml-fix-compilation-options-for-user_objs.patch
uml-ubd-driver-allow-using-up-to-16-ubd-devices.patch
uml-ubd-driver-document-some-struct-fields.patch
uml-ubd-driver-var-renames.patch
uml-ubd-driver-give-better-names-to-some-functions.patch
uml-ubd-driver-change-ubd_lock-to-be-a-mutex.patch
uml-ubd-driver-ubd_io_lock-usage-fixup.patch
uml-ubd-driver-reformat-ubd_config.patch
uml-ubd-driver-convert-do_ubd-to-a-boolean-variable.patch
uml-ubd-driver-use-bitfields-where-possible.patch
uml-ubd-driver-do-not-store-error-codes-as-fd.patch
uml-ubd-driver-various-little-changes.patch
uml-fix-prototypes.patch
uml-make-execvp-safe-for-our-usage.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux