The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Ard -kwaak- van Breemen <ard@telegraafnet.nl>
To: Andrew Morton <akpm@osdl.org>
Cc: Greg KH <greg@kroah.com>,
	"Zhang, Yanmin" <yanmin.zhang@intel.com>,
	Chuck Ebbert <76306.1226@compuserve.com>,
	Yinghai Lu <yinghai.lu@amd.com>,
	take@libero.it, agalanin@mera.ru, linux-kernel@vger.kernel.org,
	bugme-daemon@bugzilla.kernel.org,
	"Eric W. Biederman" <ebiederm@xmission.com>
Subject: Re: [Bug 7505] Linux-2.6.18 fails to boot on AMD64 machine
Date: Fri, 29 Dec 2006 15:10:58 +0100	[thread overview]
Message-ID: <20061229141058.GM912@telegraafnet.nl> (raw)
In-Reply-To: <20061229132759.GL912@telegraafnet.nl>

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

On Fri, Dec 29, 2006 at 02:27:59PM +0100, Ard -kwaak- van Breemen wrote:
> I will clean up the patches found on this list to fix and detect this.

Preliminary patches:
- pci fix of Andrews patches
- parse-one detection of Yanmin
- start_kernel detection and workaround (disable them again)

These are the patches that I am about to test in the next 2
hours... :-)
Anyway: I think it is possible that other drivers are also
potential irq enablers as soon as they are called from parse_one.
Usually I compile network drivers as modules, but in diskless
setups this might not be the case :-).
-- 
program signature;
begin  { telegraaf.com
} writeln("<ard@telegraafnet.nl> TEM2");
end
.

[-- Attachment #2: pci-prevent-downread.patch --]
[-- Type: text/plain, Size: 1292 bytes --]

--- linux-2.6.19.vanilla/drivers/pci/search.c	2006-11-29 21:57:37.000000000 +0000
+++ linux-2.6.19/drivers/pci/search.c	2006-12-29 13:58:51.000000000 +0000
@@ -193,6 +193,17 @@
 	struct pci_dev *dev;
 
 	WARN_ON(in_interrupt());
+
+	/*
+	 * pci_find_subsys() can be called on the ide_setup() path, super-early
+	 * in boot.  But the down_read() will enable local interrupts, which
+	 * can cause some machines to crash.  So here we detect and flag that
+	 * situation and bail out early.
+	 */
+	if(unlikely(list_empty(&pci_devices))) {
+		printk(KERN_INFO "pci_find_subsys() called while pci_devices is still empty\n");
+		return NULL;
+	}
 	down_read(&pci_bus_sem);
 	n = from ? from->global_list.next : pci_devices.next;
 
@@ -259,6 +270,16 @@
 	struct pci_dev *dev;
 
 	WARN_ON(in_interrupt());
+	/*
+	 * pci_get_subsys() can potentially be called by drivers super-early
+	 * in boot.  But the down_read() will enable local interrupts, which
+	 * can cause some machines to crash.  So here we detect and flag that
+	 * situation and bail out early.
+	 */
+	if(unlikely(list_empty(&pci_devices))) {
+		printk(KERN_NOTICE "pci_get_subsys() called while pci_devices is still empty\n");
+		return NULL;
+	}
 	down_read(&pci_bus_sem);
 	n = from ? from->global_list.next : pci_devices.next;
 

[-- Attachment #3: param-parse-irq-enable-detection.patch --]
[-- Type: text/plain, Size: 749 bytes --]

--- linux-2.6.19.vanilla/kernel/params.c	2006-11-29 21:57:37.000000000 +0000
+++ linux-2.6.19/kernel/params.c	2006-12-29 14:02:48.000000000 +0000
@@ -53,13 +53,20 @@
 		     int (*handle_unknown)(char *param, char *val))
 {
 	unsigned int i;
+	int result;
+	int irq_was_disabled;
 
 	/* Find parameter */
 	for (i = 0; i < num_params; i++) {
 		if (parameq(param, params[i].name)) {
 			DEBUGP("They are equal!  Calling %p\n",
 			       params[i].set);
-			return params[i].set(val, &params[i]);
+			irq_was_disabled = irqs_disabled();
+			result=params[i].set(val, &params[i]);
+			if (irq_was_disabled && !irqs_disabled()) {
+				printk(KERN_WARNING "[BUG] parse_one: kerneloption '%s' enabled irq!\n",param);
+			}
+			return result;
 		}
 	}
 

[-- Attachment #4: main-irq-enable-detection-and-disable-again.patch --]
[-- Type: text/plain, Size: 493 bytes --]

--- linux-2.6.19.vanilla/init/main.c	2006-11-29 21:57:37.000000000 +0000
+++ linux-2.6.19/init/main.c	2006-12-29 13:58:37.000000000 +0000
@@ -525,6 +525,10 @@
 	parse_args("Booting kernel", command_line, __start___param,
 		   __stop___param - __start___param,
 		   &unknown_bootoption);
+	if (!irqs_disabled()) {
+		printk(KERN_WARNING "start_kernel(): bug: interrupts were enabled *very* early, fixing it\n");
+		local_irq_disable();
+	}
 	sort_main_extable();
 	trap_init();
 	rcu_init();

  reply	other threads:[~2006-12-29 14:11 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-22  4:41 [Bug 7505] Linux-2.6.18 fails to boot on AMD64 machine Zhang, Yanmin
2006-12-22  8:22 ` Ard -kwaak- van Breemen
2006-12-22  8:30   ` Andrew Morton
2006-12-22  9:32     ` Stefano Takekawa
2006-12-22  9:43       ` Andrew Morton
2006-12-22 13:23         ` Stefano Takekawa
2006-12-22 10:30     ` Ard -kwaak- van Breemen
2006-12-22 14:00       ` Ard -kwaak- van Breemen
2006-12-22 14:16         ` Ard -kwaak- van Breemen
2006-12-22 19:10           ` Andrew Morton
2006-12-22 14:35     ` Ard -kwaak- van Breemen
2006-12-29 15:08       ` Ard -kwaak- van Breemen
2006-12-22 14:41     ` Ard -kwaak- van Breemen
2006-12-22 15:42       ` Ard -kwaak- van Breemen
2006-12-28 23:51         ` Andrew Morton
2006-12-29 10:18           ` Stefano Takekawa
2006-12-29 12:51           ` Ard -kwaak- van Breemen
2006-12-29 13:27             ` Ard -kwaak- van Breemen
2006-12-29 14:10               ` Ard -kwaak- van Breemen [this message]
2006-12-29 15:01                 ` Ard -kwaak- van Breemen
2006-12-29 15:05                   ` Ard -kwaak- van Breemen
2006-12-29 15:24                   ` Ard -kwaak- van Breemen
2006-12-29 15:42                   ` Ard -kwaak- van Breemen
2006-12-30 19:46                     ` [PATCH 2.6.20-rc2-git1] start_kernel: Test if irq's got enabled early, barf, and disable them again Ard -kwaak- van Breemen
2008-03-03 22:46                       ` Tony Luck
2008-03-04  0:34                         ` Stephen Rothwell
2006-12-30 19:58                     ` [PATCH 2.6.20-rc2-git1] kernelparams: detect if and which parameter parsing enabled irq's Ard -kwaak- van Breemen
2006-12-30 20:15                     ` [PATCH 2.6.20-rc2-git1] PCI: prevent down_read when pci_devices is empty Ard -kwaak- van Breemen
  -- strict thread matches above, loose matches on Subject: below --
2006-12-21  8:04 [Bug 7505] Linux-2.6.18 fails to boot on AMD64 machine Zhang, Yanmin
2006-12-21 19:52 ` Ard -kwaak- van Breemen
2006-12-21 20:11   ` Andrew Morton
2006-12-21 21:05 ` Ard -kwaak- van Breemen
2006-12-22 18:42 ` Ard -kwaak- van Breemen
2006-12-22 19:39   ` Stefano Takekawa
2006-12-20  9:59 Chuck Ebbert
2006-12-20 10:12 ` Yinghai Lu
2006-12-20 10:37 ` Andrew Morton
2006-12-20 10:55   ` Arjan van de Ven
2006-12-20  6:42 Chuck Ebbert
2006-12-20  9:11 ` Yinghai Lu
     [not found] <200612181543.kBIFhcIc001555@fire-2.osdl.org>
2006-12-18 16:48 ` Eric W. Biederman
2006-12-20  1:29   ` Andrew Morton

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=20061229141058.GM912@telegraafnet.nl \
    --to=ard@telegraafnet.nl \
    --cc=76306.1226@compuserve.com \
    --cc=agalanin@mera.ru \
    --cc=akpm@osdl.org \
    --cc=bugme-daemon@bugzilla.kernel.org \
    --cc=ebiederm@xmission.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=take@libero.it \
    --cc=yanmin.zhang@intel.com \
    --cc=yinghai.lu@amd.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