public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: "Siddha, Suresh B" <suresh.b.siddha@intel.com>
Cc: Andreas Herrmann3 <andreas.herrmann3@amd.com>,
	Venki Pallipadi <venkatesh.pallipadi@intel.com>,
	ak@muc.de, ebiederm@xmission.com, rdreier@cisco.com,
	torvalds@linux-foundation.org, gregkh@suse.de, airlied@skynet.ie,
	davej@redhat.com, tglx@linutronix.de, hpa@zytor.com,
	akpm@linux-foundation.org, arjan@infradead.org,
	jesse.barnes@intel.com, davem@davemloft.net,
	linux-kernel@vger.kernel.org
Subject: Re: [patch 0/4] x86: PAT followup - Incremental changes and bug fixes
Date: Thu, 17 Jan 2008 22:42:09 +0100	[thread overview]
Message-ID: <20080117214209.GA12811@elte.hu> (raw)
In-Reply-To: <20080117213131.GA25389@linux-os.sc.intel.com>


* Siddha, Suresh B <suresh.b.siddha@intel.com> wrote:

> On Thu, Jan 17, 2008 at 10:13:08PM +0100, Ingo Molnar wrote:
> > but in general we must be robust enough in this case and just degrade 
> > any overlapping page to UC (and emit a warning perhaps) - instead of 
> > failing the ioremap and thus failing the driver (and the bootup).
> 
> But then, this will cause an attribute conflicit. Old one was 
> specifying WB in PAT (ioremap with noflags) and the new ioremap 
> specifies UC.

we could fix up all aliases of that page as well and degrade them to UC?

> As Linus mentioned, main problem is to figure out the correct 
> attribute for ioremap() which doesn't specify the actual attribute to 
> be used.

i think the problem is the proximity of some ACPI tables to actual 
device mmio areas - they share the same physical page. The ACPI tables 
will be mapped WB, the device mmio areas will be UC most of the time.

> One mechanism to fix the issue generically (somewhat atleast) is to 
> use MTRR's and figure out the default MTRR attribute for that physical 
> address and use it for ioremap().

how would this solve the problem at hand? I dont think it's possible to 
guarantee that all the BIOS data pages and mmio areas will have 
compatible attributes. BIOS data pages might be in plain RAM that we 
intend to map WB. Or they might be in reserved areas near the mmio 
addresses.

but if we fixed up aliases (only for that single conflicting page), so 
that all mappings are degraded to UC, we'd have uniform behavior all 
across and the least amount of surprise to drivers. Hm?

> > but i have not seen this message in your boot log. Could you boot 
> > with early_ioremap_debug and send us the dmesg - i'm curious which 
> > ACPI tables are actively mapped while those devices are initialized.
> 
> In this scenario, ACPI is using ioremap() leaving some dangling 
> references. Venki is looking to fix this code. Getting the attribute 
> for MTRR for ioremap noflags, might solve some of these issues aswell. 
> Will look into this.

ok. Resolving that would be nice anyway because the ACPI table might be 
in plain RAM which might be reused by the kernel later on, etc. FYI, 
there's also the patch from Yinghai Lu on lkml, for one such dangling 
reference problem in the SRAT table.

	Ingo

---------------->
From: Yinghai Lu <Yinghai.Lu@Sun.COM>
Subject: [PATCH] x86: copy srat table and unmap in acpi_parse_table

[PATCH] x86: copy srat table and unmap in acpi_parse_table


the old acpi_numa_slit_init was saving old address in early stage acpi_slit
and acpi_parse_table can not unmap address that.
the patch copy the slit in the callback,
so we could unmap table in acpi_parse_table instead of outside track it.

need to revert
"
commit d8d28f25f33c6a035cdfb1d421c79293d16e5c58
Author: Ingo Molnar <mingo@elte.hu>
Date:   Thu Jan 17 15:26:42 2008 +0100

    x86: ACPI: fix mapping leaks

    ioremap_early() is stateful, hence we cannot tolerate mapping leaks.
"

before appling this patch

Signed-off-by: Yinghai Lu <yinghai.lu@sun.com>

Index: linux-2.6/arch/x86/mm/srat_64.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/srat_64.c
+++ linux-2.6/arch/x86/mm/srat_64.c
@@ -23,7 +23,9 @@
 
 int acpi_numa __initdata;
 
-static struct acpi_table_slit *acpi_slit;
+static int slit_copied;
+static u64 slit_locality_count;
+static u8 slit_entry[MAX_NUMNODES * MAX_NUMNODES];
 
 static nodemask_t nodes_parsed __initdata;
 static struct bootnode nodes[MAX_NUMNODES] __initdata;
@@ -130,7 +132,16 @@ void __init acpi_numa_slit_init(struct a
 		printk(KERN_INFO "ACPI: SLIT table looks invalid. Not used.\n");
 		return;
 	}
-	acpi_slit = slit;
+
+	if (slit->locality_count > MAX_NUMNODES)
+		return;
+
+	slit_locality_count = slit->locality_count;
+
+	memcpy(slit_entry, slit->entry,
+	       slit_locality_count * slit_locality_count);
+
+	slit_copied = 1;
 }
 
 /* Callback for Proximity Domain -> LAPIC mapping */
@@ -502,11 +513,11 @@ int __node_distance(int a, int b)
 {
 	int index;
 
-	if (!acpi_slit)
+	if (!slit_copied)
 		return null_slit_node_compare(a, b) ? LOCAL_DISTANCE :
 						      REMOTE_DISTANCE;
-	index = acpi_slit->locality_count * node_to_pxm(a);
-	return acpi_slit->entry[index + node_to_pxm(b)];
+	index = slit_locality_count * node_to_pxm(a);
+	return slit_entry[index + node_to_pxm(b)];
 }
 
 EXPORT_SYMBOL(__node_distance);
Index: linux-2.6/drivers/acpi/tables.c
===================================================================
--- linux-2.6.orig/drivers/acpi/tables.c
+++ linux-2.6/drivers/acpi/tables.c
@@ -260,6 +260,7 @@ int __init acpi_table_parse(char *id, ac
 
 	if (table) {
 		handler(table);
+		acpi_os_unmap_memory(table, table->length);
 		return 0;
 	} else
 		return 1;

  parent reply	other threads:[~2008-01-17 21:49 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-16  2:39 [patch 0/4] x86: PAT followup - Incremental changes and bug fixes venkatesh.pallipadi
2008-01-16  2:39 ` [patch 1/4] x86: PAT followup - Do not fold two bits in _PAGE_PCD venkatesh.pallipadi
2008-01-16  2:39 ` [patch 2/4] x86: PAT followup - Remove KERNPG_TABLE from pte entry venkatesh.pallipadi
2008-01-16  8:14   ` Mika Penttilä
2008-01-16 18:17     ` Pallipadi, Venkatesh
2008-01-17  0:18     ` Venki Pallipadi
2008-01-16  2:39 ` [patch 3/4] x86: PAT followup - Remove reserved pages mapping to zero page and not map them venkatesh.pallipadi
2008-01-16  2:39 ` [patch 4/4] x86: PAT followup - use ioremap for devmem read of reserved regions venkatesh.pallipadi
2008-01-16  7:33   ` Ingo Molnar
2008-01-16  7:29 ` [patch 0/4] x86: PAT followup - Incremental changes and bug fixes Ingo Molnar
2008-01-16 18:57 ` Andreas Herrmann
2008-01-16 19:05   ` Pallipadi, Venkatesh
2008-01-16 19:37   ` Pallipadi, Venkatesh
2008-01-16 20:24   ` Ingo Molnar
2008-01-16 20:33   ` Venki Pallipadi
2008-01-16 22:01     ` Andi Kleen
2008-01-16 22:14       ` Pallipadi, Venkatesh
2008-01-16 22:29         ` Andi Kleen
2008-01-17 19:12     ` Andreas Herrmann3
2008-01-17 19:54       ` Andreas Herrmann3
2008-01-17 20:36       ` Ingo Molnar
2008-01-17 20:33         ` H. Peter Anvin
2008-01-17 20:56           ` Ingo Molnar
2008-01-17 20:57           ` Linus Torvalds
2008-01-17 20:44         ` Ingo Molnar
2008-01-17 21:03         ` Andreas Herrmann3
2008-01-17 21:13           ` Ingo Molnar
2008-01-17 21:22             ` Ingo Molnar
2008-01-17 21:31             ` Siddha, Suresh B
2008-01-17 21:38               ` H. Peter Anvin
2008-01-24 20:22                 ` Eric W. Biederman
2008-01-24 21:36                   ` H. Peter Anvin
2008-01-17 21:42               ` Ingo Molnar [this message]
2008-01-17 22:06                 ` Andreas Herrmann3
2008-01-17 22:05                   ` H. Peter Anvin
2008-01-17 22:15                   ` Ingo Molnar
2008-01-17 22:52                     ` Andreas Herrmann3
2008-01-17 23:04                       ` Venki Pallipadi
2008-01-17 23:24                         ` Andreas Herrmann3
2008-01-17 23:42                           ` Pallipadi, Venkatesh
2008-01-18 16:10                         ` Andreas Herrmann3
2008-01-18 17:13                           ` Pallipadi, Venkatesh
2008-01-18 17:33                             ` Balbir Singh
2008-01-18  4:25               ` Andi Kleen
2008-01-17 21:42             ` Andreas Herrmann3
2008-01-17 22:13               ` Ingo Molnar
2008-01-17 22:16               ` Andreas Herrmann3
2008-01-17 22:26               ` Andreas Herrmann3
2008-01-17 22:35                 ` Ingo Molnar
2008-01-17 23:06                   ` Andreas Herrmann3

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=20080117214209.GA12811@elte.hu \
    --to=mingo@elte.hu \
    --cc=airlied@skynet.ie \
    --cc=ak@muc.de \
    --cc=akpm@linux-foundation.org \
    --cc=andreas.herrmann3@amd.com \
    --cc=arjan@infradead.org \
    --cc=davej@redhat.com \
    --cc=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=gregkh@suse.de \
    --cc=hpa@zytor.com \
    --cc=jesse.barnes@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rdreier@cisco.com \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=venkatesh.pallipadi@intel.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