All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Luck, Tony" <tony.luck@intel.com>
To: linux-ia64@vger.kernel.org
Subject: [PATCH 2.4 and 2.6] infinite loop in ia64_mca_wakeup_ipi_wait
Date: Mon, 13 Oct 2003 18:47:04 +0000	[thread overview]
Message-ID: <marc-linux-ia64-106607084613856@msgid-missing> (raw)

This bugfix has been hiding inside the MCA TLB patches.

There is an infinite loop in ia64_mca_wakeup_ipi_wait() because
the compiler optimizes away the test at the bottom of the while
loop.  It does this because IA64_MCA_WAKEUP_VECTOR is 0xf0, so
irr_bit is known to be the constant 0x30, a.k.a. 48 in decimal.
So when the compiler looks at the expression:

	while (!(irr & (1 << irr_bit)))

It observes that "1" (an *integer* constant) shifted left by 48
bits is 0, and so the value of "irr" becomes irrelevent.

The fix is to make sure that the compiler treats the "1" as unsigned
long:

--- old/arch/ia64/kernel/mca.c	2003-10-13 11:20:08.885518014 -0700
+++ new/arch/ia64/kernel/mca.c	2003-10-13 11:20:31.427509925 -0700
@@ -828,7 +828,7 @@
 			irr = ia64_getreg(_IA64_REG_CR_IRR3);
 			break;
 		}
-	} while (!(irr & (1 << irr_bit))) ;
+	} while (!(irr & (1UL << irr_bit))) ;
 }
 
 /*

                 reply	other threads:[~2003-10-13 18:47 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=marc-linux-ia64-106607084613856@msgid-missing \
    --to=tony.luck@intel.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.