fix wait_queue rmmod deadlock, wait_queue2, add insrm.sh that was used to test wait_queue lock, which obsoletes workqueue_cheat.sh

This commit is contained in:
Ciro Santilli
2017-06-07 08:27:56 +01:00
parent d62826bee2
commit e496f5d538
4 changed files with 18 additions and 17 deletions

View File

@@ -39,8 +39,6 @@ static int kthread_func1(void *data)
wake_up(&queue);
i++;
}
i = !i;
wake_up_interruptible(&queue);
return 0;
}
@@ -50,7 +48,7 @@ static int kthread_func2(void *data)
while (!kthread_should_stop()) {
pr_info("2 %u\n", i);
i++;
wait_event_interruptible(queue, atomic_read(&awake));
wait_event(queue, atomic_read(&awake));
atomic_set(&awake, 0);
schedule();
}
@@ -69,8 +67,9 @@ static int myinit(void)
static void myexit(void)
{
kthread_stop(kthread1);
/* 2 must be stopped before, or else we can deadlock. */
kthread_stop(kthread2);
kthread_stop(kthread1);
}
module_init(myinit)

View File

@@ -28,8 +28,6 @@ static int kthread_wake_func(void *data)
wake_up(&queue);
i++;
}
i = !i;
wake_up_interruptible(&queue);
return 0;
}
@@ -73,7 +71,7 @@ int init_module(void)
void cleanup_module(void)
{
kthread_stop(kthread_wake);
kthread_stop(kthread_sleep1);
kthread_stop(kthread_sleep2);
kthread_stop(kthread_sleep1);
kthread_stop(kthread_wake);
}