mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Petr Vandrovec <vandrove@vc.cvut.cz>
To: torvalds@transmeta.com
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu
Subject: [PATCH] Unexpected lockups in scheduler with 2.5.60-2.5.69
Date: Sat, 10 May 2003 02:42:32 +0200	[thread overview]
Message-ID: <20030510004231.GA12822@vana.vc.cvut.cz> (raw)

Hi Linus,
  there is problem with send_sig_info. This function can be invoked from
timer interrupt (timer_interrpt -> do_timer -> update_process_times ->
-> update_one_process -> ( do_process_times, do_it_prof, do_it_virt ) ->
-> send_sig -> send_sig_info) but it uses spin_unlock_irq instead of
correct spin_unlock_irqrestore.

  This enables interrupts, and later scheduler_tick() locks runqueue
(without disabling interrupts). And if we are unlucky, new interrupt
comes at this point. And if this interrupt tries to do wake_up()
(like RTC interrupt does), we deadlock on runqueue lock :-( And
it is bad...

  Problem was introduced by signal-fixes-2.5.59-A4, which spilt
original send_sig_info into two functions, and in one branch
it started using these unsafe spinlock variants (while group
variant uses irqsave/restore correctly).
					Best regards,
						Petr Vandrovec


diff -urdN linux/kernel/signal.c linux/kernel/signal.c
--- linux/kernel/signal.c	2003-05-09 04:35:12.000000000 +0200
+++ linux/kernel/signal.c	2003-05-10 01:55:24.000000000 +0200
@@ -1145,6 +1145,7 @@
 int
 send_sig_info(int sig, struct siginfo *info, struct task_struct *p)
 {
+	unsigned long flags;
 	int ret;
 
 	/*
@@ -1154,9 +1155,9 @@
 	 * going away or changing from under us.
 	 */
 	read_lock(&tasklist_lock);  
-	spin_lock_irq(&p->sighand->siglock);
+	spin_lock_irqsave(&p->sighand->siglock, flags);
 	ret = specific_send_sig_info(sig, info, p);
-	spin_unlock_irq(&p->sighand->siglock);
+	spin_unlock_irqrestore(&p->sighand->siglock, flags);
 	read_unlock(&tasklist_lock);
 	return ret;
 }

                 reply	other threads:[~2003-05-10  0:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20030510004231.GA12822@vana.vc.cvut.cz \
    --to=vandrove@vc.cvut.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@transmeta.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

all inboxes | Powered by JetHome®