public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rt/workqueue: fix an early crash and some warnings
@ 2008-12-13 23:50 Frederic Weisbecker
  2008-12-14 17:06 ` Steven Rostedt
  0 siblings, 1 reply; 2+ messages in thread
From: Frederic Weisbecker @ 2008-12-13 23:50 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Peter Zijlstra, Linux Kernel, Gregory Haskins, Ingo Molnar

Impact: fix early crash and build warnings

While building the broken/rt/workqueue topic, I got various warnings:

kernel/workqueue.c: In function ‘delayed_work_timer_fn’:
kernel/workqueue.c:214: attention : passing argument 3 of ‘__queue_work’ makes integer from pointer without a cast

This one is the cause of an early crash: the adress of the priority is passed instead of its
value, hence the following BUG_ON() triggering on sched.c:rt_mutex_setprio()

BUG_ON(prio < 0 || prio > MAX_PRIO)

Various warnings are displayed because of confusion between common linked-list and priority
sorted linked-list:

kernel/workqueue.c: In function ‘flush_work’:
kernel/workqueue.c:527: attention : passing argument 1 of ‘list_empty’ from incompatible pointer type
kernel/workqueue.c:535: attention : assignment from incompatible pointer type
kernel/workqueue.c:539: attention : assignment from incompatible pointer type

This patch fixes them (hopefully correctly).

broken/rt/workqueue boots correctly now.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
---
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index f0c32ff..b704c40 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -211,7 +211,7 @@ static void delayed_work_timer_fn(unsigned long __data)
 	struct workqueue_struct *wq = cwq->wq;
 
 	__queue_work(wq_per_cpu(wq, smp_processor_id()),
-		     &dwork->work, &dwork->prio);
+		     &dwork->work, dwork->prio);
 }
 
 /**
@@ -511,7 +511,7 @@ EXPORT_SYMBOL_GPL(flush_workqueue);
 int flush_work(struct work_struct *work)
 {
 	struct cpu_workqueue_struct *cwq;
-	struct list_head *prev;
+	struct plist_head *prev;
 	struct wq_barrier barr;
 
 	might_sleep();
@@ -524,7 +524,7 @@ int flush_work(struct work_struct *work)
 
 	prev = NULL;
 	spin_lock_irq(&cwq->lock);
-	if (!list_empty(&work->entry)) {
+	if (!plist_node_empty(&work->entry)) {
 		/*
 		 * See the comment near try_to_grab_pending()->smp_rmb().
 		 * If it was re-queued under us we are not going to wait.
@@ -532,7 +532,7 @@ int flush_work(struct work_struct *work)
 		smp_rmb();
 		if (unlikely(cwq != get_wq_data(work)))
 			goto out;
-		prev = &work->entry;
+		prev = &work->entry.plist;
 	} else {
 		if (cwq->current_work != work)
 			goto out;
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] rt/workqueue: fix an early crash and some warnings
  2008-12-13 23:50 [PATCH] rt/workqueue: fix an early crash and some warnings Frederic Weisbecker
@ 2008-12-14 17:06 ` Steven Rostedt
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2008-12-14 17:06 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: Peter Zijlstra, Linux Kernel, Gregory Haskins, Ingo Molnar,
	Clark Williams



On Sun, 14 Dec 2008, Frederic Weisbecker wrote:

> Impact: fix early crash and build warnings
> 
> While building the broken/rt/workqueue topic, I got various warnings:
> 
> kernel/workqueue.c: In function ?delayed_work_timer_fn?:
> kernel/workqueue.c:214: attention : passing argument 3 of ?__queue_work? makes integer from pointer without a cast
> 
> This one is the cause of an early crash: the adress of the priority is passed instead of its
> value, hence the following BUG_ON() triggering on sched.c:rt_mutex_setprio()
> 
> BUG_ON(prio < 0 || prio > MAX_PRIO)
> 
> Various warnings are displayed because of confusion between common linked-list and priority
> sorted linked-list:
> 
> kernel/workqueue.c: In function ?flush_work?:
> kernel/workqueue.c:527: attention : passing argument 1 of ?list_empty? from incompatible pointer type
> kernel/workqueue.c:535: attention : assignment from incompatible pointer type
> kernel/workqueue.c:539: attention : assignment from incompatible pointer type
> 
> This patch fixes them (hopefully correctly).
> 
> broken/rt/workqueue boots correctly now.
> 
> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>

Thanks! I'll give this a try on Monday.

-- Steve


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-12-14 17:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-13 23:50 [PATCH] rt/workqueue: fix an early crash and some warnings Frederic Weisbecker
2008-12-14 17:06 ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox