Skip to contentSkip to conversation

block/IDE/interrupt lockup

PATCH Manfred Spraul 1 participant 1 message Apr 1, 2002 Block layer

lore
Share & tools
lore
#0 lore raw

I've attached an alternative patch:
ide assumes that blk_init_queue doesn't sleep or enable interrupts. As a quick fix, make block_grow_request_list() nonblocking:
both spin_lock_irqsave() and SLAB_ATOMIC allocations. Just spin_lock_irqsave() with SLAB_KERNEL allocations doesn't fix the problem.

The better fix would be cleaning up init_irq() in drivers/ide/ide-probe.c, but that's something for 2.5 or someone who understand the ide code.

--
Manfred

drivers/block/ll_rw_blk.c +8 -5
@@ -336,14 +336,17 @@
  */
 int blk_grow_request_list(request_queue_t *q, int nr_requests)
 {
-	spin_lock_irq(&io_request_lock);
+	unsigned long flags;
+	/* Several broken drivers assume that this function doesn't sleep,
+	 * this causes system hangs during boot.
+	 * As a temporary fix, make the the function non-blocking.
+	 */
+	spin_lock_irqsave(&io_request_lock, flags);
 	while (q->nr_requests < nr_requests) {
 		struct request *rq;
 		int rw;
 
-		spin_unlock_irq(&io_request_lock);
-		rq = kmem_cache_alloc(request_cachep, SLAB_KERNEL);
-		spin_lock_irq(&io_request_lock);
+		rq = kmem_cache_alloc(request_cachep, SLAB_ATOMIC);
 		if (rq == NULL)
 			break;
 		memset(rq, 0, sizeof(*rq));
@@ -356,7 +359,7 @@
 	q->batch_requests = q->nr_requests / 4;
 	if (q->batch_requests > 32)
 		q->batch_requests = 32;
-	spin_unlock_irq(&io_request_lock);
+	spin_unlock_irqrestore(&io_request_lock, flags);
 	return q->nr_requests;
 }