All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Yinghai Lu <yinghai@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Toshi Kani <toshi.kani@hp.com>, Huang Ying <ying.huang@intel.com>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>
Subject: Re: [BUG bisected]: apei_hest_parse explosion
Date: Fri, 22 Feb 2013 13:30:14 +0100	[thread overview]
Message-ID: <5350252.GArARx6b7p@vostro.rjw.lan> (raw)
In-Reply-To: <alpine.LFD.2.02.1302220903000.22263@ionos>

On Friday, February 22, 2013 09:22:15 AM Thomas Gleixner wrote:
> On Fri, 22 Feb 2013, Rafael J. Wysocki wrote:
> > On Friday, February 22, 2013 02:40:58 AM Rafael J. Wysocki wrote:
> > > It looks like the hest_tab memory mapping is unmapped between acpi_hest_init()
> > > and aer_acpi_firmware_first(), but I have no idea what may be responsible for
> > > that.
> > > 
> > > And the only relevant difference between now and before the commit above seems
> > > to be the change of the acpi_hest_init() ordering (which now is called earlier).
> > 
> > We actually don't really need to do that thing so early, I think.  It looks like
> > we only need to make it available early enough for the AER driver to be able to
> > use it, so I wonder if moving the acpi_hest_init() to a separate
> > subsys_initcall() will work around the problem.  That is, something like the
> > patch below.
> 
> Yes, that makes the machine boot.

Although for a reason I didn't think about.

> > But even if this helps, I will be wanting to understand what's up here.
> 
> It's very simple. I have "acpi=off" on the command line. With that
> acpi_hest_init is never called, so hest_disable is not set .....

Well, that explains things (and means that acpi=off doesn't really get much
test coverage these days).

> Brilliant stuff that.

The appended patch should fix the breakage too, can you please verify?

Rafael


---
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Subject: ACPI / APEI: Fix crash in apei_hest_parse() for acpi=off

After commit 92ef2a2 (ACPI: Change the ordering of PCI root bridge
driver registrarion), acpi_hest_init() is never called for acpi=off
(acpi_disabled), so hest_disable is not set, but hest_tab is NULL,
which causes apei_hest_parse() to crash when it is called from
aer_acpi_firmware_first().

Fix that by making apei_hest_parse() check if hest_tab is not NULL
in addition to checking hest_disable.  Also remove the now useless
acpi_disabled check from apei_hest_parse().

Reported-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/acpi/apei/hest.c |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Index: test/drivers/acpi/apei/hest.c
===================================================================
--- test.orig/drivers/acpi/apei/hest.c
+++ test/drivers/acpi/apei/hest.c
@@ -89,7 +89,7 @@ int apei_hest_parse(apei_hest_func_t fun
 	struct acpi_hest_header *hest_hdr;
 	int i, rc, len;
 
-	if (hest_disable)
+	if (hest_disable || !hest_tab)
 		return -EINVAL;
 
 	hest_hdr = (struct acpi_hest_header *)(hest_tab + 1);
@@ -216,9 +216,6 @@ void __init acpi_hest_init(void)
 		return;
 	}
 
-	if (acpi_disabled)
-		goto err;
-
 	status = acpi_get_table(ACPI_SIG_HEST, 0,
 				(struct acpi_table_header **)&hest_tab);
 	if (status == AE_NOT_FOUND)

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

  reply	other threads:[~2013-02-22 12:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-21 23:56 [BUG bisected]: apei_hest_parse explosion Thomas Gleixner
2013-02-22  0:15 ` Rafael J. Wysocki
2013-02-22  1:23   ` Yinghai Lu
2013-02-22  1:40     ` Rafael J. Wysocki
2013-02-22  2:19       ` Rafael J. Wysocki
2013-02-22  8:22         ` Thomas Gleixner
2013-02-22 12:30           ` Rafael J. Wysocki [this message]
2013-02-22 14:39             ` Thomas Gleixner
2013-02-22 21:00               ` Rafael J. Wysocki
2013-02-22 23:46             ` Yinghai Lu

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=5350252.GArARx6b7p@vostro.rjw.lan \
    --to=rjw@sisk.pl \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=toshi.kani@hp.com \
    --cc=ying.huang@intel.com \
    --cc=yinghai@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.