mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sharyathi Nagesh <sharyath@in.ibm.com>
To: Heiko Carstens <heiko.carstens@de.ibm.com>, linux-kernel@vger.kernel.org
Cc: zhuyaof@cn.ibm.com, Srivatsa Vaddagiri <vatsa@in.ibm.com>,
	Andrew Morton <akpm@osdl.org>,
	Arjan van de Ven <arjan@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>
Subject: Re: [patch] pi-futex: missing pi_waiters plist initialization
Date: Tue, 22 Aug 2006 17:58:07 +0530	[thread overview]
Message-ID: <1156249687.14883.68.camel@localhost.localdomain> (raw)
In-Reply-To: <20060724112112.GA16537@osiris.boeblingen.de.ibm.com>

[-- Attachment #1: Type: text/plain, Size: 935 bytes --]

On Mon, 2006-07-24 at 13:21 +0200, Heiko Carstens wrote:
> From: Heiko Carstens <heiko.carstens@de.ibm.com>
> 
> Initialize init task's pi_waiters plist. Otherwise cpu hotplug of cpu 0
> might crash, since rt_mutex_getprio() accesses an uninitialized list head.
> 
> call chain which led to crash:
> 
> take_cpu_down
> sched_idle_next
> __setscheduler
> rt_mutex_getprio
> 
> Using PLIST_HEAD_INIT in the INIT_TASK macro doesn't work unfortunately, since
> the pi_waiters member is only conditionally present.

Hi 
     I felt it would be more appropriate to put initialization of
pi_waiters in fork_init function rather than in sched_init function as
other init_task related initialization or happening in fork_init(). As
well we have rt_mutex_init_task() function in fork.c which can be reused
for initializing pi_waiters field of init_task. 
    Please go through the patch and let me know of your opinion.
Thanks 
Sharyathi Nagesh

[-- Attachment #2: pi_waiters.patch --]
[-- Type: text/x-patch, Size: 1288 bytes --]

Signed-off-by: <sharyath@in.ibm.com>
----


Index: linux-2.6.18-rc4/kernel/fork.c
===================================================================
--- linux-2.6.18-rc4.orig/kernel/fork.c	2006-08-06 23:50:11.000000000 +0530
+++ linux-2.6.18-rc4/kernel/fork.c	2006-08-22 13:03:03.000000000 +0530
@@ -122,6 +122,16 @@
 		free_task(tsk);
 }
 
+
+static inline void rt_mutex_init_task(struct task_struct *p)
+{
+#ifdef CONFIG_RT_MUTEXES
+	spin_lock_init(&p->pi_lock);
+	plist_head_init(&p->pi_waiters, &p->pi_lock);
+	p->pi_blocked_on = NULL;
+#endif
+}
+
 void __init fork_init(unsigned long mempages)
 {
 #ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
@@ -151,6 +161,7 @@
 	init_task.signal->rlim[RLIMIT_NPROC].rlim_max = max_threads/2;
 	init_task.signal->rlim[RLIMIT_SIGPENDING] =
 		init_task.signal->rlim[RLIMIT_NPROC];
+	rt_mutex_init_task(&init_task);
 }
 
 static struct task_struct *dup_task_struct(struct task_struct *orig)
@@ -919,15 +930,6 @@
 	return current->pid;
 }
 
-static inline void rt_mutex_init_task(struct task_struct *p)
-{
-#ifdef CONFIG_RT_MUTEXES
-	spin_lock_init(&p->pi_lock);
-	plist_head_init(&p->pi_waiters, &p->pi_lock);
-	p->pi_blocked_on = NULL;
-#endif
-}
-
 /*
  * This creates a new process as a copy of the old one,
  * but does not actually start it yet.

      reply	other threads:[~2006-08-22 12:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-24 11:21 Heiko Carstens
2006-08-22 12:28 ` Sharyathi Nagesh [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1156249687.14883.68.camel@localhost.localdomain \
    --to=sharyath@in.ibm.com \
    --cc=akpm@osdl.org \
    --cc=arjan@infradead.org \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=vatsa@in.ibm.com \
    --cc=zhuyaof@cn.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome