public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
From: Zoltan Menyhart <Zoltan.Menyhart@bull.net>
To: linux-ia64@vger.kernel.org
Subject: ia64_mca_cpe_int_handler
Date: Fri, 22 Feb 2008 17:14:20 +0000	[thread overview]
Message-ID: <47BF02EC.4080102@bull.net> (raw)

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

The ia64_mca_cpe_int_handler() in 2.6.24 goes something like this:

ia64_mca_cpe_int_handler (int cpe_irq, void *arg)
{
...
	/* SAL spec states this should run w/ interrupts enabled */
	local_irq_enable();

	spin_lock(&cpe_history_lock);
...
	spin_unlock(&cpe_history_lock);

	ia64_mca_log_sal_error_record(SAL_INFO_TYPE_CPE);
}

I think the interrupts are enabled too early. I just have caught a dead lock:
I have got nested ia64_mca_cpe_int_handler()-s, the first instance has
been interrupted somewhere between spin_lock(&cpe_history_lock) and
spin_unlock(&cpe_history_lock). Obviously, the second instance will never get
the lock.
The previous versions, e.g. 2.6.18, were not safe either:

ia64_mca_cpe_int_handler (int cpe_irq, void *arg, struct pt_regs *ptregs)
{
...
        /* SAL spec states this should run w/ interrupts enabled */
        local_irq_enable();

        /* Get the CPE error record and log it */
        ia64_mca_log_sal_error_record(SAL_INFO_TYPE_CPE);

        spin_lock(&cpe_history_lock);
...
	spin_unlock(&cpe_history_lock);
}

I think the interrupts have to be blocked while we are inside the lock-
protected region.
I can think of something like this below. Please have a look at this patch.

Thanks,

Zoltan Menyhart


[-- Attachment #2: mca.c-patch --]
[-- Type: text/plain, Size: 1103 bytes --]

--- linux-2.6.24-old/arch/ia64/kernel/mca.c	2008-02-22 18:09:12.000000000 +0100
+++ linux-2.6.24/arch/ia64/kernel/mca.c	2008-02-22 18:09:26.000000000 +0100
@@ -436,6 +436,10 @@
 	static const char * const rec_name[] = { "MCA", "INIT", "CMC", "CPE" };
 #endif
 
+	if (irq_safe){
+		/* SAL spec states this should run w/ interrupts enabled */
+		local_irq_enable();
+	}
 	size = ia64_log_get(sal_info_type, &buffer, irq_safe);
 	if (!size)
 		return;
@@ -512,9 +516,6 @@
 	IA64_MCA_DEBUG("%s: received interrupt vector = %#x on CPU %d\n",
 		       __FUNCTION__, cpe_irq, smp_processor_id());
 
-	/* SAL spec states this should run w/ interrupts enabled */
-	local_irq_enable();
-
 	spin_lock(&cpe_history_lock);
 	if (!cpe_poll_enabled && cpe_vector >= 0) {
 
@@ -1324,9 +1325,6 @@
 	IA64_MCA_DEBUG("%s: received interrupt vector = %#x on CPU %d\n",
 		       __FUNCTION__, cmc_irq, smp_processor_id());
 
-	/* SAL spec states this should run w/ interrupts enabled */
-	local_irq_enable();
-
 	spin_lock(&cmc_history_lock);
 	if (!cmc_polling_enabled) {
 		int i, count = 1; /* we know 1 happened now */

             reply	other threads:[~2008-02-22 17:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-22 17:14 Zoltan Menyhart [this message]
2008-02-22 22:32 ` ia64_mca_cpe_int_handler Luck, Tony
2008-02-22 23:44 ` ia64_mca_cpe_int_handler Russ Anderson
2008-02-23  0:02 ` ia64_mca_cpe_int_handler Luck, Tony
2008-02-25 17:05 ` ia64_mca_cpe_int_handler Zoltan Menyhart
2008-02-26 21:01 ` ia64_mca_cpe_int_handler Russ Anderson
2008-02-27 10:06 ` ia64_mca_cpe_int_handler Zoltan Menyhart
2008-02-27 10:53 ` ia64_mca_cpe_int_handler Robin Holt
2008-02-27 12:18 ` ia64_mca_cpe_int_handler Zoltan Menyhart
2008-02-27 16:29 ` ia64_mca_cpe_int_handler Russ Anderson

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=47BF02EC.4080102@bull.net \
    --to=zoltan.menyhart@bull.net \
    --cc=linux-ia64@vger.kernel.org \
    /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