From: Vivek Satpute <vivek@linsyssoft.com>
To: linux-rt-users@vger.kernel.org
Cc: prtproj@linsyssoft.com, Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH-rt 1/1] Fix spinlock issue in net/core/sock.c
Date: Thu, 25 Jun 2009 17:37:25 +0530 [thread overview]
Message-ID: <1245931645.6269.15.camel@localhost.localdomain> (raw)
Kernel panic's and reboot while doing network operations such ifconfig
and ping on MIPS architecture after RT-patches applied.
In case of CONFIG_PREEMPT_RT, after releasing the lock with
"spin_unlock", context switch might occur before enabling the bottom
half with local_bh_enable and this causes the kernel to panic.
The issue is resolved by releasing the lock afer acquiring the mutex
using spin_unlock_bh.
Tested the fix on MIPS and X86 architecture.
Signed-off-by: Vivek Satpute <vivek@linsyssoft.com>
---
net/core/sock.c | 8 ++++++++
1 file changed, 8 insertions(+)
Index: linux-2.6.28.4/net/core/sock.c
===================================================================
--- linux-2.6.28.4.orig/net/core/sock.c
+++ linux-2.6.28.4/net/core/sock.c
@@ -1752,12 +1752,20 @@ void lock_sock_nested(struct sock *sk, i
if (sk->sk_lock.owned)
__lock_sock(sk);
sk->sk_lock.owned = 1;
+
+#ifndef CONFIG_PREEMPT_RT
spin_unlock(&sk->sk_lock.slock);
+#endif
/*
* The sk_lock has mutex_lock() semantics here:
*/
mutex_acquire(&sk->sk_lock.dep_map, subclass, 0, _RET_IP_);
+
+#ifdef CONFIG_PREEMPT_RT
+ spin_unlock_bh(&sk->sk_lock.slock);
+#else
local_bh_enable();
+#endif
}
EXPORT_SYMBOL(lock_sock_nested);
Thanks and Regards,
Vivek Satpute
System Software Engineer
LinSysSoft Technologies, Pune
next reply other threads:[~2009-06-25 12:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-25 12:07 Vivek Satpute [this message]
2009-06-29 11:57 ` [PATCH-rt 1/1] Fix spinlock issue in net/core/sock.c Jan Blunck
[not found] ` <fae6a9700906290649j176493f7u39c4ce674a3a66fc@mail.gmail.com>
2009-06-29 13:54 ` Vivek Satpute
2009-12-27 8:15 ` Vivek Satpute
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=1245931645.6269.15.camel@localhost.localdomain \
--to=vivek@linsyssoft.com \
--cc=linux-rt-users@vger.kernel.org \
--cc=prtproj@linsyssoft.com \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).