Re: [patch] Real-Time Preemption, -RT-2.6.10-rc2-mm3-V0.7.32-15

From: Ingo Molnar
Date: Mon Dec 13 2004 - 01:50:54 EST



* Fernando Lopez-Lezcano <nando@xxxxxxxxxxxxxxxxxx> wrote:

> Something that just happened to me: running 0.7.32-14
> (PREEMPT_DESKTOP) and trying to install 0.7.32-19 from a custom built
> rpm package completely hangs the machine (p4 laptop - I tried twice).
> No clues left behind. If I boot into 0.7.32-9 I can install 0.7.32-19
> with no problems.

does 0.7.32-19 work better if you reverse (patch -R) the loop.h and
loop.c bits (see below)?

Ingo

--- linux/drivers/block/loop.c.orig
+++ linux/drivers/block/loop.c
@@ -378,7 +378,7 @@ static void loop_add_bio(struct loop_dev
lo->lo_bio = lo->lo_biotail = bio;
spin_unlock_irqrestore(&lo->lo_lock, flags);

- up(&lo->lo_bh_mutex);
+ complete(&lo->lo_bh_done);
}

/*
@@ -427,7 +427,7 @@ static int loop_make_request(request_que
return 0;
err:
if (atomic_dec_and_test(&lo->lo_pending))
- up(&lo->lo_bh_mutex);
+ complete(&lo->lo_bh_done);
out:
bio_io_error(old_bio, old_bio->bi_size);
return 0;
@@ -495,12 +495,12 @@ static int loop_thread(void *data)
/*
* up sem, we are running
*/
- up(&lo->lo_sem);
+ complete(&lo->lo_done);

for (;;) {
- down_interruptible(&lo->lo_bh_mutex);
+ wait_for_completion_interruptible(&lo->lo_bh_done);
/*
- * could be upped because of tear-down, not because of
+ * could be completed because of tear-down, not because of
* pending work
*/
if (!atomic_read(&lo->lo_pending))
@@ -521,7 +521,7 @@ static int loop_thread(void *data)
break;
}

- up(&lo->lo_sem);
+ complete(&lo->lo_done);
return 0;
}

@@ -708,7 +708,7 @@ static int loop_set_fd(struct loop_devic
set_blocksize(bdev, lo_blocksize);

kernel_thread(loop_thread, lo, CLONE_KERNEL);
- down(&lo->lo_sem);
+ wait_for_completion(&lo->lo_done);
return 0;

out_putf:
@@ -773,10 +773,10 @@ static int loop_clr_fd(struct loop_devic
spin_lock_irq(&lo->lo_lock);
lo->lo_state = Lo_rundown;
if (atomic_dec_and_test(&lo->lo_pending))
- up(&lo->lo_bh_mutex);
+ complete(&lo->lo_bh_done);
spin_unlock_irq(&lo->lo_lock);

- down(&lo->lo_sem);
+ wait_for_completion(&lo->lo_done);

lo->lo_backing_file = NULL;

@@ -1153,8 +1153,8 @@ int __init loop_init(void)
if (!lo->lo_queue)
goto out_mem4;
init_MUTEX(&lo->lo_ctl_mutex);
- init_MUTEX_LOCKED(&lo->lo_sem);
- init_MUTEX_LOCKED(&lo->lo_bh_mutex);
+ init_completion(&lo->lo_done);
+ init_completion(&lo->lo_bh_done);
lo->lo_number = i;
spin_lock_init(&lo->lo_lock);
disk->major = LOOP_MAJOR;
--- linux/include/linux/loop.h.orig
+++ linux/include/linux/loop.h
@@ -58,9 +58,9 @@ struct loop_device {
struct bio *lo_bio;
struct bio *lo_biotail;
int lo_state;
- struct semaphore lo_sem;
+ struct completion lo_done;
+ struct completion lo_bh_done;
struct semaphore lo_ctl_mutex;
- struct semaphore lo_bh_mutex;
atomic_t lo_pending;

request_queue_t *lo_queue;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/