public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/7] x86/range: check range in update range
       [not found] <4B22D4DA.2000104@kernel.org>
@ 2009-12-11 23:35 ` Yinghai Lu
  2009-12-11 23:35 ` [PATCH 3/7] x86/pci: use resource_size_t in update_res Yinghai Lu
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 22+ messages in thread
From: Yinghai Lu @ 2009-12-11 23:35 UTC (permalink / raw)
  To: Ingo Molnar, Jesse Barnes, Thomas Gleixner, H. Peter Anvin,
	Andrew Morton
  Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org


fend off wrong range

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 kernel/range.c |    9 +++++++++
 1 file changed, 9 insertions(+)

Index: linux-2.6/kernel/range.c
===================================================================
--- linux-2.6.orig/kernel/range.c
+++ linux-2.6/kernel/range.c
@@ -13,6 +13,9 @@
 
 int add_range(struct range *range, int az, int nr_range, u64 start, u64 end)
 {
+	if (start > end)
+		return nr_range;
+
 	/* Out of slots: */
 	if (nr_range >= az)
 		return nr_range;
@@ -30,6 +33,9 @@ int add_range_with_merge(struct range *r
 {
 	int i;
 
+	if (start > end)
+		return nr_range;
+
 	/* Try to merge it with old one: */
 	for (i = 0; i < nr_range; i++) {
 		u64 final_start, final_end;
@@ -59,6 +65,9 @@ void subtract_range(struct range *range,
 {
 	int i, j;
 
+	if (start > end)
+		return;
+
 	for (j = 0; j < az; j++) {
 		if (!range[j].end)
 			continue;


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 3/7] x86/pci: use resource_size_t in update_res
       [not found] <4B22D4DA.2000104@kernel.org>
  2009-12-11 23:35 ` [PATCH 2/7] x86/range: check range in update range Yinghai Lu
@ 2009-12-11 23:35 ` Yinghai Lu
  2009-12-11 23:35 ` [PATCH 4/7] x86/pci: amd one chain system to use pci read out res Yinghai Lu
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 22+ messages in thread
From: Yinghai Lu @ 2009-12-11 23:35 UTC (permalink / raw)
  To: Ingo Molnar, Jesse Barnes, Thomas Gleixner, H. Peter Anvin,
	Andrew Morton
  Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org



prepare to enable 32bit intel and amd bus

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
 arch/x86/pci/bus_numa.c |   16 ++++++++--------
 arch/x86/pci/bus_numa.h |    4 ++--
 2 files changed, 10 insertions(+), 10 deletions(-)

Index: linux-2.6/arch/x86/pci/bus_numa.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/bus_numa.c
+++ linux-2.6/arch/x86/pci/bus_numa.c
@@ -51,8 +51,8 @@ void x86_pci_root_bus_res_quirks(struct
 	}
 }
 
-void __init update_res(struct pci_root_info *info, size_t start,
-			      size_t end, unsigned long flags, int merge)
+void __init update_res(struct pci_root_info *info, resource_size_t start,
+		       resource_size_t end, unsigned long flags, int merge)
 {
 	int i;
 	struct resource *res;
@@ -65,20 +65,20 @@ void __init update_res(struct pci_root_i
 
 	/* try to merge it with old one */
 	for (i = 0; i < info->res_num; i++) {
-		size_t final_start, final_end;
-		size_t common_start, common_end;
+		resource_size_t final_start, final_end;
+		resource_size_t common_start, common_end;
 
 		res = &info->res[i];
 		if (res->flags != flags)
 			continue;
 
-		common_start = max((size_t)res->start, start);
-		common_end = min((size_t)res->end, end);
+		common_start = max(res->start, start);
+		common_end = min(res->end, end);
 		if (common_start > common_end + 1)
 			continue;
 
-		final_start = min((size_t)res->start, start);
-		final_end = max((size_t)res->end, end);
+		final_start = min(res->start, start);
+		final_end = max(res->end, end);
 
 		res->start = final_start;
 		res->end = final_end;
Index: linux-2.6/arch/x86/pci/bus_numa.h
===================================================================
--- linux-2.6.orig/arch/x86/pci/bus_numa.h
+++ linux-2.6/arch/x86/pci/bus_numa.h
@@ -22,6 +22,6 @@ extern int pci_root_num;
 extern struct pci_root_info pci_root_info[PCI_ROOT_NR];
 extern int found_all_numa_early;
 
-extern void update_res(struct pci_root_info *info, size_t start,
-			      size_t end, unsigned long flags, int merge);
+extern void update_res(struct pci_root_info *info, resource_size_t start,
+		      resource_size_t end, unsigned long flags, int merge);
 #endif


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 4/7] x86/pci: amd one chain system to use pci read out res
       [not found] <4B22D4DA.2000104@kernel.org>
  2009-12-11 23:35 ` [PATCH 2/7] x86/range: check range in update range Yinghai Lu
  2009-12-11 23:35 ` [PATCH 3/7] x86/pci: use resource_size_t in update_res Yinghai Lu
@ 2009-12-11 23:35 ` Yinghai Lu
  2009-12-11 23:35 ` [PATCH 5/7] x86/pci: use u64 instead of size_t in amd_bus.c Yinghai Lu
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 22+ messages in thread
From: Yinghai Lu @ 2009-12-11 23:35 UTC (permalink / raw)
  To: Ingo Molnar, Jesse Barnes, Thomas Gleixner, H. Peter Anvin,
	Andrew Morton
  Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	Gertjan van Wingerde


found MSI amd k8 based laptops is hiding [0x70000000, 0x80000000) RAM from
e820.

enable amd one chain even for all.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/x86/pci/amd_bus.c  |    7 ++++---
 arch/x86/pci/bus_numa.c |    5 -----
 arch/x86/pci/bus_numa.h |    1 -
 3 files changed, 4 insertions(+), 9 deletions(-)

Index: linux-2.6/arch/x86/pci/amd_bus.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/amd_bus.c
+++ linux-2.6/arch/x86/pci/amd_bus.c
@@ -87,11 +87,12 @@ static int __init early_fill_mp_bus_info
 	struct range range[RANGE_NUM];
 	u64 val;
 	u32 address;
+	int found;
 
 	if (!early_pci_allowed())
 		return -1;
 
-	found_all_numa_early = 0;
+	found = 0;
 	for (i = 0; i < ARRAY_SIZE(pci_probes); i++) {
 		u32 id;
 		u16 device;
@@ -105,12 +106,12 @@ static int __init early_fill_mp_bus_info
 		device = (id>>16) & 0xffff;
 		if (pci_probes[i].vendor == vendor &&
 		    pci_probes[i].device == device) {
-			found_all_numa_early = 1;
+			found = 1;
 			break;
 		}
 	}
 
-	if (!found_all_numa_early)
+	if (!found)
 		return 0;
 
 	pci_root_num = 0;
Index: linux-2.6/arch/x86/pci/bus_numa.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/bus_numa.c
+++ linux-2.6/arch/x86/pci/bus_numa.c
@@ -5,7 +5,6 @@
 
 int pci_root_num;
 struct pci_root_info pci_root_info[PCI_ROOT_NR];
-int found_all_numa_early;
 
 void x86_pci_root_bus_res_quirks(struct pci_bus *b)
 {
@@ -21,10 +20,6 @@ void x86_pci_root_bus_res_quirks(struct
 	if (!pci_root_num)
 		return;
 
-	/* for amd, if only one root bus, don't need to do anything */
-	if (pci_root_num < 2 && found_all_numa_early)
-		return;
-
 	for (i = 0; i < pci_root_num; i++) {
 		if (pci_root_info[i].bus_min == b->number)
 			break;
Index: linux-2.6/arch/x86/pci/bus_numa.h
===================================================================
--- linux-2.6.orig/arch/x86/pci/bus_numa.h
+++ linux-2.6/arch/x86/pci/bus_numa.h
@@ -20,7 +20,6 @@ struct pci_root_info {
 #define PCI_ROOT_NR 4
 extern int pci_root_num;
 extern struct pci_root_info pci_root_info[PCI_ROOT_NR];
-extern int found_all_numa_early;
 
 extern void update_res(struct pci_root_info *info, resource_size_t start,
 		      resource_size_t end, unsigned long flags, int merge);


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 5/7] x86/pci: use u64 instead of size_t in amd_bus.c
       [not found] <4B22D4DA.2000104@kernel.org>
                   ` (2 preceding siblings ...)
  2009-12-11 23:35 ` [PATCH 4/7] x86/pci: amd one chain system to use pci read out res Yinghai Lu
@ 2009-12-11 23:35 ` Yinghai Lu
  2009-12-11 23:55   ` H. Peter Anvin
  2009-12-12  2:10   ` [PATCH 5/7] x86/pci: use u64 instead of size_t in amd_bus.c -v2 Yinghai Lu
  2009-12-11 23:35 ` [PATCH 6/7] x86/pci: enable pci root res read out for 32bit too Yinghai Lu
  2009-12-11 23:35 ` [PATCH 7/7] x86: increase MAX_EARLY_RES Yinghai Lu
  5 siblings, 2 replies; 22+ messages in thread
From: Yinghai Lu @ 2009-12-11 23:35 UTC (permalink / raw)
  To: Ingo Molnar, Jesse Barnes, Thomas Gleixner, H. Peter Anvin,
	Andrew Morton
  Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	Gertjan van Wingerde



prepare to enable it for 32bit

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/x86/pci/amd_bus.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6/arch/x86/pci/amd_bus.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/amd_bus.c
+++ linux-2.6/arch/x86/pci/amd_bus.c
@@ -82,8 +82,8 @@ static int __init early_fill_mp_bus_info
 	struct pci_root_info *info;
 	u32 reg;
 	struct resource *res;
-	size_t start;
-	size_t end;
+	u64 start;
+	u64 end;
 	struct range range[RANGE_NUM];
 	u64 val;
 	u32 address;


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 6/7] x86/pci: enable pci root res read out for 32bit too
       [not found] <4B22D4DA.2000104@kernel.org>
                   ` (3 preceding siblings ...)
  2009-12-11 23:35 ` [PATCH 5/7] x86/pci: use u64 instead of size_t in amd_bus.c Yinghai Lu
@ 2009-12-11 23:35 ` Yinghai Lu
  2009-12-12  2:11   ` [PATCH 61/7] x86/pci: add cap_4g Yinghai Lu
  2009-12-12  2:13   ` [PATCH 6/7] x86/pci: enable pci root res read out for 32bit too -v2 Yinghai Lu
  2009-12-11 23:35 ` [PATCH 7/7] x86: increase MAX_EARLY_RES Yinghai Lu
  5 siblings, 2 replies; 22+ messages in thread
From: Yinghai Lu @ 2009-12-11 23:35 UTC (permalink / raw)
  To: Ingo Molnar, Jesse Barnes, Thomas Gleixner, H. Peter Anvin,
	Andrew Morton
  Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	Gertjan van Wingerde


should be good for 32bit too.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/x86/pci/Makefile   |    3 +--
 arch/x86/pci/amd_bus.c  |   17 +++--------------
 arch/x86/pci/bus_numa.h |    4 ++--
 arch/x86/pci/i386.c     |    4 ----
 4 files changed, 6 insertions(+), 22 deletions(-)

Index: linux-2.6/arch/x86/pci/Makefile
===================================================================
--- linux-2.6.orig/arch/x86/pci/Makefile
+++ linux-2.6/arch/x86/pci/Makefile
@@ -14,8 +14,7 @@ obj-$(CONFIG_X86_VISWS)		+= visws.o
 obj-$(CONFIG_X86_NUMAQ)		+= numaq_32.o
 
 obj-y				+= common.o early.o
-obj-y				+= amd_bus.o
-obj-$(CONFIG_X86_64)		+= bus_numa.o intel_bus.o
+obj-y				+= amd_bus.o bus_numa.o intel_bus.o
 
 ifeq ($(CONFIG_PCI_DEBUG),y)
 EXTRA_CFLAGS += -DDEBUG
Index: linux-2.6/arch/x86/pci/amd_bus.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/amd_bus.c
+++ linux-2.6/arch/x86/pci/amd_bus.c
@@ -6,9 +6,7 @@
 
 #include <asm/pci_x86.h>
 
-#ifdef CONFIG_X86_64
 #include <asm/pci-direct.h>
-#endif
 
 #include "bus_numa.h"
 
@@ -17,8 +15,6 @@
  * also get peer root bus resource for io,mmio
  */
 
-#ifdef CONFIG_X86_64
-
 struct pci_hostbridge_probe {
 	u32 bus;
 	u32 slot;
@@ -207,7 +203,7 @@ static int __init early_fill_mp_bus_info
 	address = MSR_K8_TOP_MEM1;
 	rdmsrl(address, val);
 	end = (val & 0xffffff800000ULL);
-	printk(KERN_INFO "TOM: %016lx aka %ldM\n", end, end>>20);
+	printk(KERN_INFO "TOM: %016llx aka %lldM\n", (u64)end, (u64)end>>20);
 	if (end < (1ULL<<32))
 		subtract_range(range, RANGE_NUM, 0, end - 1);
 
@@ -301,7 +297,8 @@ static int __init early_fill_mp_bus_info
 		address = MSR_K8_TOP_MEM2;
 		rdmsrl(address, val);
 		end = (val & 0xffffff800000ULL);
-		printk(KERN_INFO "TOM2: %016lx aka %ldM\n", end, end>>20);
+		printk(KERN_INFO "TOM2: %016llx aka %lldM\n", (u64)end,
+							 (u64)end>>20);
 		subtract_range(range, RANGE_NUM, 1ULL<<32, end - 1);
 	}
 
@@ -347,14 +344,6 @@ static int __init early_fill_mp_bus_info
 	return 0;
 }
 
-#else  /* !CONFIG_X86_64 */
-
-static int __init early_fill_mp_bus_info(void) { return 0; }
-
-#endif /* !CONFIG_X86_64 */
-
-/* common 32/64 bit code */
-
 #define ENABLE_CF8_EXT_CFG      (1ULL << 46)
 
 static void enable_pci_io_ecs(void *unused)
Index: linux-2.6/arch/x86/pci/i386.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/i386.c
+++ linux-2.6/arch/x86/pci/i386.c
@@ -257,10 +257,6 @@ void __init pcibios_resource_survey(void
  */
 fs_initcall(pcibios_assign_resources);
 
-void __weak x86_pci_root_bus_res_quirks(struct pci_bus *b)
-{
-}
-
 /*
  *  If we set up a device for bus mastering, we need to check the latency
  *  timer as certain crappy BIOSes forget to set it properly.
Index: linux-2.6/arch/x86/pci/bus_numa.h
===================================================================
--- linux-2.6.orig/arch/x86/pci/bus_numa.h
+++ linux-2.6/arch/x86/pci/bus_numa.h
@@ -1,5 +1,5 @@
-#ifdef CONFIG_X86_64
-
+#ifndef __BUS_NUMA_H
+#define __BUS_NUMA_H
 /*
  * sub bus (transparent) will use entres from 3 to store extra from
  * root, so need to make sure we have enough slot there, Should we



^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 7/7] x86: increase MAX_EARLY_RES
       [not found] <4B22D4DA.2000104@kernel.org>
                   ` (4 preceding siblings ...)
  2009-12-11 23:35 ` [PATCH 6/7] x86/pci: enable pci root res read out for 32bit too Yinghai Lu
@ 2009-12-11 23:35 ` Yinghai Lu
  2009-12-15  2:06   ` [PATCH 1/3] x86: call early_res_to_bootmem one time Yinghai Lu
  2009-12-17  1:01   ` [tip:x86/urgent] x86: Increase MAX_EARLY_RES; insufficient on 32-bit NUMA tip-bot for Yinghai Lu
  5 siblings, 2 replies; 22+ messages in thread
From: Yinghai Lu @ 2009-12-11 23:35 UTC (permalink / raw)
  To: Ingo Molnar, Jesse Barnes, Thomas Gleixner, H. Peter Anvin,
	Andrew Morton
  Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org



32bit numa run out of it, because recent change with wakeup and mptable.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/x86/kernel/e820.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/arch/x86/kernel/e820.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/e820.c
+++ linux-2.6/arch/x86/kernel/e820.c
@@ -724,7 +724,7 @@ core_initcall(e820_mark_nvs_memory);
 /*
  * Early reserved memory areas.
  */
-#define MAX_EARLY_RES 20
+#define MAX_EARLY_RES 32
 
 struct early_res {
 	u64 start, end;


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 5/7] x86/pci: use u64 instead of size_t in amd_bus.c
  2009-12-11 23:35 ` [PATCH 5/7] x86/pci: use u64 instead of size_t in amd_bus.c Yinghai Lu
@ 2009-12-11 23:55   ` H. Peter Anvin
  2009-12-12  0:42     ` Yinghai Lu
  2009-12-12  2:10   ` [PATCH 5/7] x86/pci: use u64 instead of size_t in amd_bus.c -v2 Yinghai Lu
  1 sibling, 1 reply; 22+ messages in thread
From: H. Peter Anvin @ 2009-12-11 23:55 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Ingo Molnar, Jesse Barnes, Thomas Gleixner, Andrew Morton,
	linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	Gertjan van Wingerde

On 12/11/2009 03:35 PM, Yinghai Lu wrote:
> 
> 
> prepare to enable it for 32bit
> 
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> 
> ---
>  arch/x86/pci/amd_bus.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> Index: linux-2.6/arch/x86/pci/amd_bus.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/pci/amd_bus.c
> +++ linux-2.6/arch/x86/pci/amd_bus.c
> @@ -82,8 +82,8 @@ static int __init early_fill_mp_bus_info
>  	struct pci_root_info *info;
>  	u32 reg;
>  	struct resource *res;
> -	size_t start;
> -	size_t end;
> +	u64 start;
> +	u64 end;
>  	struct range range[RANGE_NUM];
>  	u64 val;
>  	u32 address;
> 

Shouldn't this be resource_size_t?

	-hpa


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 5/7] x86/pci: use u64 instead of size_t in amd_bus.c
  2009-12-11 23:55   ` H. Peter Anvin
@ 2009-12-12  0:42     ` Yinghai Lu
  0 siblings, 0 replies; 22+ messages in thread
From: Yinghai Lu @ 2009-12-12  0:42 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Ingo Molnar, Jesse Barnes, Thomas Gleixner, Andrew Morton,
	linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	Gertjan van Wingerde

H. Peter Anvin wrote:
> On 12/11/2009 03:35 PM, Yinghai Lu wrote:
>>
>> prepare to enable it for 32bit
>>
>> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>>
>> ---
>>  arch/x86/pci/amd_bus.c |    4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> Index: linux-2.6/arch/x86/pci/amd_bus.c
>> ===================================================================
>> --- linux-2.6.orig/arch/x86/pci/amd_bus.c
>> +++ linux-2.6/arch/x86/pci/amd_bus.c
>> @@ -82,8 +82,8 @@ static int __init early_fill_mp_bus_info
>>  	struct pci_root_info *info;
>>  	u32 reg;
>>  	struct resource *res;
>> -	size_t start;
>> -	size_t end;
>> +	u64 start;
>> +	u64 end;
>>  	struct range range[RANGE_NUM];
>>  	u64 val;
>>  	u32 address;
>>
> 
> Shouldn't this be resource_size_t?

it seems we should use u64, and check the if the sizeof(resource_size_t) != sizeof(u64)
and cap some vale.

YH

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 5/7] x86/pci: use u64 instead of size_t in amd_bus.c -v2
  2009-12-11 23:35 ` [PATCH 5/7] x86/pci: use u64 instead of size_t in amd_bus.c Yinghai Lu
  2009-12-11 23:55   ` H. Peter Anvin
@ 2009-12-12  2:10   ` Yinghai Lu
  1 sibling, 0 replies; 22+ messages in thread
From: Yinghai Lu @ 2009-12-12  2:10 UTC (permalink / raw)
  To: Ingo Molnar, Jesse Barnes, Thomas Gleixner, H. Peter Anvin,
	Andrew Morton
  Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	Gertjan van Wingerde

prepare to enable it for 32bit

-v2: remove not needed cast

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/x86/pci/amd_bus.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Index: linux-2.6/arch/x86/pci/amd_bus.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/amd_bus.c
+++ linux-2.6/arch/x86/pci/amd_bus.c
@@ -82,8 +82,8 @@ static int __init early_fill_mp_bus_info
 	struct pci_root_info *info;
 	u32 reg;
 	struct resource *res;
-	size_t start;
-	size_t end;
+	u64 start;
+	u64 end;
 	struct range range[RANGE_NUM];
 	u64 val;
 	u32 address;
@@ -173,7 +173,7 @@ static int __init early_fill_mp_bus_info
 
 		info = &pci_root_info[j];
 		printk(KERN_DEBUG "node %d link %d: io port [%llx, %llx]\n",
-		       node, link, (u64)start, (u64)end);
+		       node, link, start, end);
 
 		/* kernel only handle 16 bit only */
 		if (end > 0xffff)
@@ -207,7 +207,7 @@ static int __init early_fill_mp_bus_info
 	address = MSR_K8_TOP_MEM1;
 	rdmsrl(address, val);
 	end = (val & 0xffffff800000ULL);
-	printk(KERN_INFO "TOM: %016lx aka %ldM\n", end, end>>20);
+	printk(KERN_INFO "TOM: %016llx aka %lldM\n", end, end>>20);
 	if (end < (1ULL<<32))
 		subtract_range(range, RANGE_NUM, 0, end - 1);
 
@@ -246,7 +246,7 @@ static int __init early_fill_mp_bus_info
 		info = &pci_root_info[j];
 
 		printk(KERN_DEBUG "node %d link %d: mmio [%llx, %llx]",
-		       node, link, (u64)start, (u64)end);
+		       node, link, start, end);
 		/*
 		 * some sick allocation would have range overlap with fam10h
 		 * mmconf range, so need to update start and end.
@@ -272,13 +272,13 @@ static int __init early_fill_mp_bus_info
 				endx = fam10h_mmconf_start - 1;
 				update_res(info, start, endx, IORESOURCE_MEM, 0);
 				subtract_range(range, RANGE_NUM, start, endx);
-				printk(KERN_CONT " ==> [%llx, %llx]", (u64)start, endx);
+				printk(KERN_CONT " ==> [%llx, %llx]", start, endx);
 				start = fam10h_mmconf_end + 1;
 				changed = 1;
 			}
 			if (changed) {
 				if (start <= end) {
-					printk(KERN_CONT " %s [%llx, %llx]", endx?"and":"==>", (u64)start, (u64)end);
+					printk(KERN_CONT " %s [%llx, %llx]", endx?"and":"==>", start, end);
 				} else {
 					printk(KERN_CONT "%s\n", endx?"":" ==> none");
 					continue;
@@ -301,7 +301,7 @@ static int __init early_fill_mp_bus_info
 		address = MSR_K8_TOP_MEM2;
 		rdmsrl(address, val);
 		end = (val & 0xffffff800000ULL);
-		printk(KERN_INFO "TOM2: %016lx aka %ldM\n", end, end>>20);
+		printk(KERN_INFO "TOM2: %016llx aka %lldM\n", end, end>>20);
 		subtract_range(range, RANGE_NUM, 1ULL<<32, end - 1);
 	}
 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 61/7] x86/pci: add cap_4g
  2009-12-11 23:35 ` [PATCH 6/7] x86/pci: enable pci root res read out for 32bit too Yinghai Lu
@ 2009-12-12  2:11   ` Yinghai Lu
  2009-12-12  2:16     ` H. Peter Anvin
  2009-12-12  2:13   ` [PATCH 6/7] x86/pci: enable pci root res read out for 32bit too -v2 Yinghai Lu
  1 sibling, 1 reply; 22+ messages in thread
From: Yinghai Lu @ 2009-12-12  2:11 UTC (permalink / raw)
  To: Ingo Molnar, Jesse Barnes, Thomas Gleixner, H. Peter Anvin,
	Andrew Morton
  Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	Gertjan van Wingerde


prepare for 32bit pci root bus

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/x86/pci/amd_bus.c   |    7 ++++---
 arch/x86/pci/bus_numa.c  |    4 ++++
 arch/x86/pci/intel_bus.c |    5 ++++-
 include/linux/range.h    |   10 ++++++++++
 4 files changed, 22 insertions(+), 4 deletions(-)

Index: linux-2.6/arch/x86/pci/amd_bus.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/amd_bus.c
+++ linux-2.6/arch/x86/pci/amd_bus.c
@@ -201,7 +201,7 @@ static int __init early_fill_mp_bus_info
 
 	memset(range, 0, sizeof(range));
 	/* 0xfd00000000-0xffffffffff for HT */
-	range[0].end = (0xfdULL<<32) - 1;
+	range[0].end = cap_4g((0xfdULL<<32) - 1);
 
 	/* need to take out [0, TOM) for RAM*/
 	address = MSR_K8_TOP_MEM1;
@@ -286,7 +286,7 @@ static int __init early_fill_mp_bus_info
 			}
 		}
 
-		update_res(info, start, end, IORESOURCE_MEM, 1);
+		update_res(info, cap_4g(start), cap_4g(end), IORESOURCE_MEM, 1);
 		subtract_range(range, RANGE_NUM, start, end);
 		printk(KERN_CONT "\n");
 	}
@@ -321,7 +321,8 @@ static int __init early_fill_mp_bus_info
 			if (!range[i].end)
 				continue;
 
-			update_res(info, range[i].start, range[i].end,
+			update_res(info, cap_4g(range[i].start),
+				   cap_4g(range[i].end),
 				   IORESOURCE_MEM, 1);
 		}
 	}
Index: linux-2.6/arch/x86/pci/bus_numa.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/bus_numa.c
+++ linux-2.6/arch/x86/pci/bus_numa.c
@@ -55,6 +55,10 @@ void __init update_res(struct pci_root_i
 	if (start > end)
 		return;
 
+	if (sizeof(resource_size_t) < sizeof(u64) &&
+	    start == 0xffffffff)
+		return;
+
 	if (!merge)
 		goto addit;
 
Index: linux-2.6/arch/x86/pci/intel_bus.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/intel_bus.c
+++ linux-2.6/arch/x86/pci/intel_bus.c
@@ -6,6 +6,8 @@
 #include <linux/dmi.h>
 #include <linux/pci.h>
 #include <linux/init.h>
+#include <linux/range.h>
+
 #include <asm/pci_x86.h>
 
 #include "bus_numa.h"
@@ -81,7 +83,8 @@ static void __devinit pci_root_bus_res(s
 	mmioh_base |= ((u64)(dword & 0x7ffff)) << 32;
 	pci_read_config_dword(dev, IOH_LMMIOH_LIMITU, &dword);
 	mmioh_end |= ((u64)(dword & 0x7ffff)) << 32;
-	update_res(info, mmioh_base, mmioh_end, IORESOURCE_MEM, 0);
+	update_res(info, cap_4g(mmioh_base), cap_4g(mmioh_end),
+			 IORESOURCE_MEM, 0);
 
 	print_ioh_resources(info);
 }
Index: linux-2.6/include/linux/range.h
===================================================================
--- linux-2.6.orig/include/linux/range.h
+++ linux-2.6/include/linux/range.h
@@ -19,4 +19,14 @@ int clean_sort_range(struct range *range
 
 void sort_range(struct range *range, int nr_range);
 
+static inline u64 cap_4g(u64 val)
+{
+	if (sizeof(resource_size_t) >= sizeof(u64))
+		return val;
+
+	if (val < 1ULL)
+		return val;
+
+	return 0xffffffff;
+}
 #endif

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 6/7] x86/pci: enable pci root res read out for 32bit too -v2
  2009-12-11 23:35 ` [PATCH 6/7] x86/pci: enable pci root res read out for 32bit too Yinghai Lu
  2009-12-12  2:11   ` [PATCH 61/7] x86/pci: add cap_4g Yinghai Lu
@ 2009-12-12  2:13   ` Yinghai Lu
  2009-12-12  3:28     ` [PATCH 6/7] x86/pci: enable pci root res read out for 32bit too -v3 Yinghai Lu
  1 sibling, 1 reply; 22+ messages in thread
From: Yinghai Lu @ 2009-12-12  2:13 UTC (permalink / raw)
  To: Ingo Molnar, Jesse Barnes, Thomas Gleixner, H. Peter Anvin,
	Andrew Morton
  Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	Gertjan van Wingerde


should be good for 32bit too.

v2: split out cap_4g to 61

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/x86/pci/Makefile   |    3 +--
 arch/x86/pci/amd_bus.c  |   12 ------------
 arch/x86/pci/bus_numa.h |    4 ++--
 arch/x86/pci/i386.c     |    4 ----
 4 files changed, 3 insertions(+), 20 deletions(-)

Index: linux-2.6/arch/x86/pci/Makefile
===================================================================
--- linux-2.6.orig/arch/x86/pci/Makefile
+++ linux-2.6/arch/x86/pci/Makefile
@@ -14,8 +14,7 @@ obj-$(CONFIG_X86_VISWS)		+= visws.o
 obj-$(CONFIG_X86_NUMAQ)		+= numaq_32.o
 
 obj-y				+= common.o early.o
-obj-y				+= amd_bus.o
-obj-$(CONFIG_X86_64)		+= bus_numa.o intel_bus.o
+obj-y				+= amd_bus.o bus_numa.o intel_bus.o
 
 ifeq ($(CONFIG_PCI_DEBUG),y)
 EXTRA_CFLAGS += -DDEBUG
Index: linux-2.6/arch/x86/pci/amd_bus.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/amd_bus.c
+++ linux-2.6/arch/x86/pci/amd_bus.c
@@ -6,9 +6,7 @@
 
 #include <asm/pci_x86.h>
 
-#ifdef CONFIG_X86_64
 #include <asm/pci-direct.h>
-#endif
 
 #include "bus_numa.h"
 
@@ -17,8 +15,6 @@
  * also get peer root bus resource for io,mmio
  */
 
-#ifdef CONFIG_X86_64
-
 struct pci_hostbridge_probe {
 	u32 bus;
 	u32 slot;
@@ -348,14 +344,6 @@ static int __init early_fill_mp_bus_info
 	return 0;
 }
 
-#else  /* !CONFIG_X86_64 */
-
-static int __init early_fill_mp_bus_info(void) { return 0; }
-
-#endif /* !CONFIG_X86_64 */
-
-/* common 32/64 bit code */
-
 #define ENABLE_CF8_EXT_CFG      (1ULL << 46)
 
 static void enable_pci_io_ecs(void *unused)
Index: linux-2.6/arch/x86/pci/i386.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/i386.c
+++ linux-2.6/arch/x86/pci/i386.c
@@ -257,10 +257,6 @@ void __init pcibios_resource_survey(void
  */
 fs_initcall(pcibios_assign_resources);
 
-void __weak x86_pci_root_bus_res_quirks(struct pci_bus *b)
-{
-}
-
 /*
  *  If we set up a device for bus mastering, we need to check the latency
  *  timer as certain crappy BIOSes forget to set it properly.
Index: linux-2.6/arch/x86/pci/bus_numa.h
===================================================================
--- linux-2.6.orig/arch/x86/pci/bus_numa.h
+++ linux-2.6/arch/x86/pci/bus_numa.h
@@ -1,5 +1,5 @@
-#ifdef CONFIG_X86_64
-
+#ifndef __BUS_NUMA_H
+#define __BUS_NUMA_H
 /*
  * sub bus (transparent) will use entres from 3 to store extra from
  * root, so need to make sure we have enough slot there, Should we

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 61/7] x86/pci: add cap_4g
  2009-12-12  2:11   ` [PATCH 61/7] x86/pci: add cap_4g Yinghai Lu
@ 2009-12-12  2:16     ` H. Peter Anvin
  2009-12-12  2:20       ` Yinghai Lu
  0 siblings, 1 reply; 22+ messages in thread
From: H. Peter Anvin @ 2009-12-12  2:16 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Ingo Molnar, Jesse Barnes, Thomas Gleixner, Andrew Morton,
	linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	Gertjan van Wingerde

On 12/11/2009 06:11 PM, Yinghai Lu wrote:
>  
> +static inline u64 cap_4g(u64 val)
> +{
> +	if (sizeof(resource_size_t) >= sizeof(u64))
> +		return val;
> +
> +	if (val < 1ULL)
> +		return val;
> +
> +	return 0xffffffff;
> +}
>  #endif

How about:

static inline resource_size_t cap_resource(u64 val)
{
	if (val > ~(resource_size_t)0)
		return ~(resource_size_t)0;
	else
		return val;
}


-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 61/7] x86/pci: add cap_4g
  2009-12-12  2:16     ` H. Peter Anvin
@ 2009-12-12  2:20       ` Yinghai Lu
  2009-12-12  2:25         ` H. Peter Anvin
  0 siblings, 1 reply; 22+ messages in thread
From: Yinghai Lu @ 2009-12-12  2:20 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Ingo Molnar, Jesse Barnes, Thomas Gleixner, Andrew Morton,
	linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	Gertjan van Wingerde

H. Peter Anvin wrote:
> On 12/11/2009 06:11 PM, Yinghai Lu wrote:
>>  
>> +static inline u64 cap_4g(u64 val)
>> +{
>> +	if (sizeof(resource_size_t) >= sizeof(u64))
>> +		return val;
>> +
>> +	if (val < 1ULL)
>> +		return val;
>> +
>> +	return 0xffffffff;
>> +}
>>  #endif
> 
> How about:
> 
> static inline resource_size_t cap_resource(u64 val)
> {
> 	if (val > ~(resource_size_t)0)
> 		return ~(resource_size_t)0;
> 	else
> 		return val;
> }

ok

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 61/7] x86/pci: add cap_4g
  2009-12-12  2:20       ` Yinghai Lu
@ 2009-12-12  2:25         ` H. Peter Anvin
  2009-12-12  3:29           ` [PATCH 61/7] x86/pci: add cap_resource -v2 Yinghai Lu
  0 siblings, 1 reply; 22+ messages in thread
From: H. Peter Anvin @ 2009-12-12  2:25 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Ingo Molnar, Jesse Barnes, Thomas Gleixner, Andrew Morton,
	linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	Gertjan van Wingerde

On 12/11/2009 06:20 PM, Yinghai Lu wrote:
>>
>> How about:
>>
>> static inline resource_size_t cap_resource(u64 val)
>> {
>> 	if (val > ~(resource_size_t)0)
>> 		return ~(resource_size_t)0;
>> 	else
>> 		return val;
>> }
> 
> ok

Stylisically I guess the idiom:

	(resource_size_t)~0

... is better, not that it matters in this case, but the (type)~0 idiom
gets the correct answer even when sizeof(type) < sizeof(int).

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 6/7] x86/pci: enable pci root res read out for 32bit too -v3
  2009-12-12  2:13   ` [PATCH 6/7] x86/pci: enable pci root res read out for 32bit too -v2 Yinghai Lu
@ 2009-12-12  3:28     ` Yinghai Lu
  0 siblings, 0 replies; 22+ messages in thread
From: Yinghai Lu @ 2009-12-12  3:28 UTC (permalink / raw)
  To: Ingo Molnar, Jesse Barnes, Thomas Gleixner, H. Peter Anvin,
	Andrew Morton
  Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	Gertjan van Wingerde



should be good for 32bit too.

-v3: cast res->start

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/x86/pci/Makefile    |    3 +--
 arch/x86/pci/amd_bus.c   |   14 +-------------
 arch/x86/pci/bus_numa.h  |    4 ++--
 arch/x86/pci/i386.c      |    4 ----
 arch/x86/pci/intel_bus.c |    2 +-
 5 files changed, 5 insertions(+), 22 deletions(-)

Index: linux-2.6/arch/x86/pci/Makefile
===================================================================
--- linux-2.6.orig/arch/x86/pci/Makefile
+++ linux-2.6/arch/x86/pci/Makefile
@@ -14,8 +14,7 @@ obj-$(CONFIG_X86_VISWS)		+= visws.o
 obj-$(CONFIG_X86_NUMAQ)		+= numaq_32.o
 
 obj-y				+= common.o early.o
-obj-y				+= amd_bus.o
-obj-$(CONFIG_X86_64)		+= bus_numa.o intel_bus.o
+obj-y				+= amd_bus.o bus_numa.o intel_bus.o
 
 ifeq ($(CONFIG_PCI_DEBUG),y)
 EXTRA_CFLAGS += -DDEBUG
Index: linux-2.6/arch/x86/pci/amd_bus.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/amd_bus.c
+++ linux-2.6/arch/x86/pci/amd_bus.c
@@ -6,9 +6,7 @@
 
 #include <asm/pci_x86.h>
 
-#ifdef CONFIG_X86_64
 #include <asm/pci-direct.h>
-#endif
 
 #include "bus_numa.h"
 
@@ -17,8 +15,6 @@
  * also get peer root bus resource for io,mmio
  */
 
-#ifdef CONFIG_X86_64
-
 struct pci_hostbridge_probe {
 	u32 bus;
 	u32 slot;
@@ -342,21 +338,13 @@ static int __init early_fill_mp_bus_info
 			printk(KERN_DEBUG "bus: %02x index %x %s: [%llx, %llx]\n",
 			       busnum, j,
 			       (res->flags & IORESOURCE_IO)?"io port":"mmio",
-			       res->start, res->end);
+			       (u64)res->start, (u64)res->end);
 		}
 	}
 
 	return 0;
 }
 
-#else  /* !CONFIG_X86_64 */
-
-static int __init early_fill_mp_bus_info(void) { return 0; }
-
-#endif /* !CONFIG_X86_64 */
-
-/* common 32/64 bit code */
-
 #define ENABLE_CF8_EXT_CFG      (1ULL << 46)
 
 static void enable_pci_io_ecs(void *unused)
Index: linux-2.6/arch/x86/pci/i386.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/i386.c
+++ linux-2.6/arch/x86/pci/i386.c
@@ -257,10 +257,6 @@ void __init pcibios_resource_survey(void
  */
 fs_initcall(pcibios_assign_resources);
 
-void __weak x86_pci_root_bus_res_quirks(struct pci_bus *b)
-{
-}
-
 /*
  *  If we set up a device for bus mastering, we need to check the latency
  *  timer as certain crappy BIOSes forget to set it properly.
Index: linux-2.6/arch/x86/pci/bus_numa.h
===================================================================
--- linux-2.6.orig/arch/x86/pci/bus_numa.h
+++ linux-2.6/arch/x86/pci/bus_numa.h
@@ -1,5 +1,5 @@
-#ifdef CONFIG_X86_64
-
+#ifndef __BUS_NUMA_H
+#define __BUS_NUMA_H
 /*
  * sub bus (transparent) will use entres from 3 to store extra from
  * root, so need to make sure we have enough slot there, Should we
Index: linux-2.6/arch/x86/pci/intel_bus.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/intel_bus.c
+++ linux-2.6/arch/x86/pci/intel_bus.c
@@ -30,7 +30,7 @@ static inline void print_ioh_resources(s
 			busnum, i,
 			(res->flags & IORESOURCE_IO) ? "io port" :
 							"mmio",
-			res->start, res->end);
+			(u64)res->start, (u64)res->end);
 	}
 }
 

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 61/7] x86/pci: add cap_resource -v2
  2009-12-12  2:25         ` H. Peter Anvin
@ 2009-12-12  3:29           ` Yinghai Lu
  0 siblings, 0 replies; 22+ messages in thread
From: Yinghai Lu @ 2009-12-12  3:29 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Ingo Molnar, Jesse Barnes, Thomas Gleixner, Andrew Morton,
	linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org,
	Gertjan van Wingerde


prepare for 32bit pci root bus

-v2: hpa said we should compare with (resource_size_t)~0

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/x86/pci/amd_bus.c   |    8 +++++---
 arch/x86/pci/bus_numa.c  |    3 +++
 arch/x86/pci/intel_bus.c |    5 ++++-
 include/linux/range.h    |    8 ++++++++
 4 files changed, 20 insertions(+), 4 deletions(-)

Index: linux-2.6/arch/x86/pci/amd_bus.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/amd_bus.c
+++ linux-2.6/arch/x86/pci/amd_bus.c
@@ -201,7 +201,7 @@ static int __init early_fill_mp_bus_info
 
 	memset(range, 0, sizeof(range));
 	/* 0xfd00000000-0xffffffffff for HT */
-	range[0].end = (0xfdULL<<32) - 1;
+	range[0].end = cap_resource((0xfdULL<<32) - 1);
 
 	/* need to take out [0, TOM) for RAM*/
 	address = MSR_K8_TOP_MEM1;
@@ -286,7 +286,8 @@ static int __init early_fill_mp_bus_info
 			}
 		}
 
-		update_res(info, start, end, IORESOURCE_MEM, 1);
+		update_res(info, cap_resource(start), cap_resource(end),
+				 IORESOURCE_MEM, 1);
 		subtract_range(range, RANGE_NUM, start, end);
 		printk(KERN_CONT "\n");
 	}
@@ -321,7 +322,8 @@ static int __init early_fill_mp_bus_info
 			if (!range[i].end)
 				continue;
 
-			update_res(info, range[i].start, range[i].end,
+			update_res(info, cap_resource(range[i].start),
+				   cap_resource(range[i].end),
 				   IORESOURCE_MEM, 1);
 		}
 	}
Index: linux-2.6/arch/x86/pci/bus_numa.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/bus_numa.c
+++ linux-2.6/arch/x86/pci/bus_numa.c
@@ -55,6 +55,9 @@ void __init update_res(struct pci_root_i
 	if (start > end)
 		return;
 
+	if (start == (resource_size_t)~0)
+		return;
+
 	if (!merge)
 		goto addit;
 
Index: linux-2.6/arch/x86/pci/intel_bus.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/intel_bus.c
+++ linux-2.6/arch/x86/pci/intel_bus.c
@@ -6,6 +6,8 @@
 #include <linux/dmi.h>
 #include <linux/pci.h>
 #include <linux/init.h>
+#include <linux/range.h>
+
 #include <asm/pci_x86.h>
 
 #include "bus_numa.h"
@@ -81,7 +83,8 @@ static void __devinit pci_root_bus_res(s
 	mmioh_base |= ((u64)(dword & 0x7ffff)) << 32;
 	pci_read_config_dword(dev, IOH_LMMIOH_LIMITU, &dword);
 	mmioh_end |= ((u64)(dword & 0x7ffff)) << 32;
-	update_res(info, mmioh_base, mmioh_end, IORESOURCE_MEM, 0);
+	update_res(info, cap_resource(mmioh_base), cap_resource(mmioh_end),
+			 IORESOURCE_MEM, 0);
 
 	print_ioh_resources(info);
 }
Index: linux-2.6/include/linux/range.h
===================================================================
--- linux-2.6.orig/include/linux/range.h
+++ linux-2.6/include/linux/range.h
@@ -19,4 +19,12 @@ int clean_sort_range(struct range *range
 
 void sort_range(struct range *range, int nr_range);
 
+
+static inline resource_size_t cap_resource(u64 val)
+{
+	if (val > (resource_size_t)~0)
+		return (resource_size_t)~0;
+	else
+		return val;
+}
 #endif

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 1/3] x86: call early_res_to_bootmem one time
  2009-12-11 23:35 ` [PATCH 7/7] x86: increase MAX_EARLY_RES Yinghai Lu
@ 2009-12-15  2:06   ` Yinghai Lu
  2009-12-15  2:07     ` [PATCH 2/3] x86: introduce max_early_res and early_res_count Yinghai Lu
  2009-12-17  1:01   ` [tip:x86/urgent] x86: Increase MAX_EARLY_RES; insufficient on 32-bit NUMA tip-bot for Yinghai Lu
  1 sibling, 1 reply; 22+ messages in thread
From: Yinghai Lu @ 2009-12-15  2:06 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin; +Cc: linux-kernel@vger.kernel.org


simplify setup_node_mem, do use bootmem from other node.
instead just find_e820_area in early_node_mem.

so we can keep the boundary between early_res and boot mem more clear.
and only call civertion one time instead of for all nodes.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/x86/kernel/setup.c |    1 
 arch/x86/mm/init_32.c   |    1 
 arch/x86/mm/init_64.c   |    3 --
 arch/x86/mm/numa_64.c   |   62 +++++++++++++++---------------------------------
 4 files changed, 22 insertions(+), 45 deletions(-)

Index: linux-2.6/arch/x86/kernel/setup.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/setup.c
+++ linux-2.6/arch/x86/kernel/setup.c
@@ -942,6 +942,7 @@ void __init setup_arch(char **cmdline_p)
 #endif
 
 	initmem_init(0, max_pfn, acpi, k8);
+	early_res_to_bootmem(0, max_low_pfn<<PAGE_SHIFT);
 
 #ifdef CONFIG_X86_64
 	/*
Index: linux-2.6/arch/x86/mm/init_32.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/init_32.c
+++ linux-2.6/arch/x86/mm/init_32.c
@@ -764,7 +764,6 @@ static unsigned long __init setup_node_b
 	printk(KERN_INFO "  node %d bootmap %08lx - %08lx\n",
 		 nodeid, bootmap, bootmap + bootmap_size);
 	free_bootmem_with_active_regions(nodeid, end_pfn);
-	early_res_to_bootmem(start_pfn<<PAGE_SHIFT, end_pfn<<PAGE_SHIFT);
 
 	return bootmap + bootmap_size;
 }
Index: linux-2.6/arch/x86/mm/init_64.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/init_64.c
+++ linux-2.6/arch/x86/mm/init_64.c
@@ -578,13 +578,12 @@ void __init initmem_init(unsigned long s
 				 PAGE_SIZE);
 	if (bootmap == -1L)
 		panic("Cannot find bootmem map of size %ld\n", bootmap_size);
+	reserve_early(bootmap, bootmap + bootmap_size, "BOOTMAP");
 	/* don't touch min_low_pfn */
 	bootmap_size = init_bootmem_node(NODE_DATA(0), bootmap >> PAGE_SHIFT,
 					 0, end_pfn);
 	e820_register_active_regions(0, start_pfn, end_pfn);
 	free_bootmem_with_active_regions(0, end_pfn);
-	early_res_to_bootmem(0, end_pfn<<PAGE_SHIFT);
-	reserve_bootmem(bootmap, bootmap_size, BOOTMEM_DEFAULT);
 }
 #endif
 
Index: linux-2.6/arch/x86/mm/numa_64.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/numa_64.c
+++ linux-2.6/arch/x86/mm/numa_64.c
@@ -164,18 +164,21 @@ static void * __init early_node_mem(int
 				    unsigned long align)
 {
 	unsigned long mem = find_e820_area(start, end, size, align);
-	void *ptr;
 
 	if (mem != -1L)
 		return __va(mem);
 
-	ptr = __alloc_bootmem_nopanic(size, align, __pa(MAX_DMA_ADDRESS));
-	if (ptr == NULL) {
-		printk(KERN_ERR "Cannot find %lu bytes in node %d\n",
+
+	start = __pa(MAX_DMA_ADDRESS);
+	end = max_low_pfn_mapped << PAGE_SHIFT;
+	mem = find_e820_area(start, end, size, align);
+	if (mem != -1L)
+		return __va(mem);
+
+	printk(KERN_ERR "Cannot find %lu bytes in node %d\n",
 		       size, nodeid);
-		return NULL;
-	}
-	return ptr;
+
+	return NULL;
 }
 
 /* Initialize bootmem allocator for a node */
@@ -211,8 +214,12 @@ setup_node_bootmem(int nodeid, unsigned
 	if (node_data[nodeid] == NULL)
 		return;
 	nodedata_phys = __pa(node_data[nodeid]);
+	reserve_early(nodedata_phys, nodedata_phys + pgdat_size, "NODE_DATA");
 	printk(KERN_INFO "  NODE_DATA [%016lx - %016lx]\n", nodedata_phys,
 		nodedata_phys + pgdat_size - 1);
+	nid = phys_to_nid(nodedata_phys);
+	if (nid != nodeid)
+		printk(KERN_INFO "    NODE_DATA(%d) on node %d\n", nodeid, nid);
 
 	memset(NODE_DATA(nodeid), 0, sizeof(pg_data_t));
 	NODE_DATA(nodeid)->bdata = &bootmem_node_data[nodeid];
@@ -227,11 +234,7 @@ setup_node_bootmem(int nodeid, unsigned
 	 * of alloc_bootmem, that could clash with reserved range
 	 */
 	bootmap_pages = bootmem_bootmap_pages(last_pfn - start_pfn);
-	nid = phys_to_nid(nodedata_phys);
-	if (nid == nodeid)
-		bootmap_start = roundup(nodedata_phys + pgdat_size, PAGE_SIZE);
-	else
-		bootmap_start = roundup(start, PAGE_SIZE);
+	bootmap_start = roundup(nodedata_phys + pgdat_size, PAGE_SIZE);
 	/*
 	 * SMP_CACHE_BYTES could be enough, but init_bootmem_node like
 	 * to use that to align to PAGE_SIZE
@@ -239,18 +242,13 @@ setup_node_bootmem(int nodeid, unsigned
 	bootmap = early_node_mem(nodeid, bootmap_start, end,
 				 bootmap_pages<<PAGE_SHIFT, PAGE_SIZE);
 	if (bootmap == NULL)  {
-		if (nodedata_phys < start || nodedata_phys >= end) {
-			/*
-			 * only need to free it if it is from other node
-			 * bootmem
-			 */
-			if (nid != nodeid)
-				free_bootmem(nodedata_phys, pgdat_size);
-		}
+		free_early(nodedata_phys, nodedata_phys + pgdat_size);
 		node_data[nodeid] = NULL;
 		return;
 	}
 	bootmap_start = __pa(bootmap);
+	reserve_early(bootmap_start, bootmap_start+(bootmap_pages<<PAGE_SHIFT),
+			"BOOTMAP");
 
 	bootmap_size = init_bootmem_node(NODE_DATA(nodeid),
 					 bootmap_start >> PAGE_SHIFT,
@@ -259,31 +257,11 @@ setup_node_bootmem(int nodeid, unsigned
 	printk(KERN_INFO "  bootmap [%016lx -  %016lx] pages %lx\n",
 		 bootmap_start, bootmap_start + bootmap_size - 1,
 		 bootmap_pages);
-
-	free_bootmem_with_active_regions(nodeid, end);
-
-	/*
-	 * convert early reserve to bootmem reserve earlier
-	 * otherwise early_node_mem could use early reserved mem
-	 * on previous node
-	 */
-	early_res_to_bootmem(start, end);
-
-	/*
-	 * in some case early_node_mem could use alloc_bootmem
-	 * to get range on other node, don't reserve that again
-	 */
-	if (nid != nodeid)
-		printk(KERN_INFO "    NODE_DATA(%d) on node %d\n", nodeid, nid);
-	else
-		reserve_bootmem_node(NODE_DATA(nodeid), nodedata_phys,
-					pgdat_size, BOOTMEM_DEFAULT);
 	nid = phys_to_nid(bootmap_start);
 	if (nid != nodeid)
 		printk(KERN_INFO "    bootmap(%d) on node %d\n", nodeid, nid);
-	else
-		reserve_bootmem_node(NODE_DATA(nodeid), bootmap_start,
-				 bootmap_pages<<PAGE_SHIFT, BOOTMEM_DEFAULT);
+
+	free_bootmem_with_active_regions(nodeid, end);
 
 	node_set_online(nodeid);
 }

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 2/3] x86: introduce max_early_res and early_res_count
  2009-12-15  2:06   ` [PATCH 1/3] x86: call early_res_to_bootmem one time Yinghai Lu
@ 2009-12-15  2:07     ` Yinghai Lu
  2009-12-15  2:08       ` [PATCH 3/3] x86: dynamic increase early_res array size Yinghai Lu
  0 siblings, 1 reply; 22+ messages in thread
From: Yinghai Lu @ 2009-12-15  2:07 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin; +Cc: linux-kernel@vger.kernel.org


to prepare allocate early res array from fine_e820_area

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/x86/kernel/e820.c |   47 ++++++++++++++++++++++++++++++++---------------
 1 file changed, 32 insertions(+), 15 deletions(-)

Index: linux-2.6/arch/x86/kernel/e820.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/e820.c
+++ linux-2.6/arch/x86/kernel/e820.c
@@ -724,14 +724,18 @@ core_initcall(e820_mark_nvs_memory);
 /*
  * Early reserved memory areas.
  */
-#define MAX_EARLY_RES 32
+/*
+ * need to make sure this one is bigger enough before
+ * find_e820_area could be used
+ */
+#define MAX_EARLY_RES_X 32
 
 struct early_res {
 	u64 start, end;
-	char name[16];
+	char name[15];
 	char overlap_ok;
 };
-static struct early_res early_res[MAX_EARLY_RES] __initdata = {
+static struct early_res early_res_x[MAX_EARLY_RES_X] __initdata = {
 	{ 0, PAGE_SIZE, "BIOS data page", 1 },	/* BIOS data page */
 #ifdef CONFIG_X86_32
 	/*
@@ -745,12 +749,22 @@ static struct early_res early_res[MAX_EA
 	{}
 };
 
+static int max_early_res __initdata = MAX_EARLY_RES_X;
+static struct early_res *early_res __initdata = &early_res_x[0];
+static int early_res_count __initdata =
+#ifdef CONFIG_X86_32
+	2
+#else
+	1
+#endif
+	;
+
 static int __init find_overlapped_early(u64 start, u64 end)
 {
 	int i;
 	struct early_res *r;
 
-	for (i = 0; i < MAX_EARLY_RES && early_res[i].end; i++) {
+	for (i = 0; i < max_early_res && early_res[i].end; i++) {
 		r = &early_res[i];
 		if (end > r->start && start < r->end)
 			break;
@@ -768,13 +782,14 @@ static void __init drop_range(int i)
 {
 	int j;
 
-	for (j = i + 1; j < MAX_EARLY_RES && early_res[j].end; j++)
+	for (j = i + 1; j < max_early_res && early_res[j].end; j++)
 		;
 
 	memmove(&early_res[i], &early_res[i + 1],
 	       (j - 1 - i) * sizeof(struct early_res));
 
 	early_res[j - 1].end = 0;
+	early_res_count--;
 }
 
 /*
@@ -793,9 +808,9 @@ static void __init drop_overlaps_that_ar
 	struct early_res *r;
 	u64 lower_start, lower_end;
 	u64 upper_start, upper_end;
-	char name[16];
+	char name[15];
 
-	for (i = 0; i < MAX_EARLY_RES && early_res[i].end; i++) {
+	for (i = 0; i < max_early_res && early_res[i].end; i++) {
 		r = &early_res[i];
 
 		/* Continue past non-overlapping ranges */
@@ -851,7 +866,7 @@ static void __init __reserve_early(u64 s
 	struct early_res *r;
 
 	i = find_overlapped_early(start, end);
-	if (i >= MAX_EARLY_RES)
+	if (i >= max_early_res)
 		panic("Too many early reservations");
 	r = &early_res[i];
 	if (r->end)
@@ -864,6 +879,7 @@ static void __init __reserve_early(u64 s
 	r->overlap_ok = overlap_ok;
 	if (name)
 		strncpy(r->name, name, sizeof(r->name) - 1);
+	early_res_count++;
 }
 
 /*
@@ -916,7 +932,7 @@ void __init free_early(u64 start, u64 en
 
 	i = find_overlapped_early(start, end);
 	r = &early_res[i];
-	if (i >= MAX_EARLY_RES || r->end != end || r->start != start)
+	if (i >= max_early_res || r->end != end || r->start != start)
 		panic("free_early on not reserved area: %llx-%llx!",
 			 start, end - 1);
 
@@ -927,14 +943,15 @@ void __init early_res_to_bootmem(u64 sta
 {
 	int i, count;
 	u64 final_start, final_end;
+	int idx = 0;
 
 	count  = 0;
-	for (i = 0; i < MAX_EARLY_RES && early_res[i].end; i++)
+	for (i = 0; i < max_early_res && early_res[i].end; i++)
 		count++;
 
-	printk(KERN_INFO "(%d early reservations) ==> bootmem [%010llx - %010llx]\n",
-			 count, start, end);
-	for (i = 0; i < count; i++) {
+	printk(KERN_INFO "(%d/%d early reservations) ==> bootmem [%010llx - %010llx]\n",
+			 count - idx, max_early_res, start, end);
+	for (i = idx; i < count; i++) {
 		struct early_res *r = &early_res[i];
 		printk(KERN_INFO "  #%d [%010llx - %010llx] %16s", i,
 			r->start, r->end, r->name);
@@ -961,7 +978,7 @@ static inline int __init bad_addr(u64 *a
 again:
 	i = find_overlapped_early(addr, addr + size);
 	r = &early_res[i];
-	if (i < MAX_EARLY_RES && r->end) {
+	if (i < max_early_res && r->end) {
 		*addrp = addr = round_up(r->end, align);
 		changed = 1;
 		goto again;
@@ -978,7 +995,7 @@ static inline int __init bad_addr_size(u
 	int changed = 0;
 again:
 	last = addr + size;
-	for (i = 0; i < MAX_EARLY_RES && early_res[i].end; i++) {
+	for (i = 0; i < max_early_res && early_res[i].end; i++) {
 		struct early_res *r = &early_res[i];
 		if (last > r->start && addr < r->start) {
 			size = r->start - addr;

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 3/3] x86: dynamic increase early_res array size
  2009-12-15  2:07     ` [PATCH 2/3] x86: introduce max_early_res and early_res_count Yinghai Lu
@ 2009-12-15  2:08       ` Yinghai Lu
  2009-12-16  1:11         ` [PATCH 4/3] x86: make early_node_mem get mem > 4g if possible -v2 Yinghai Lu
  0 siblings, 1 reply; 22+ messages in thread
From: Yinghai Lu @ 2009-12-15  2:08 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin; +Cc: linux-kernel@vger.kernel.org



use early_res_count to track the num, and use find_e820 to get new buffer.
and copy from old to new one.

also clear early_res to prevent later invalid using

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/x86/kernel/e820.c |   54 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

Index: linux-2.6/arch/x86/kernel/e820.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/e820.c
+++ linux-2.6/arch/x86/kernel/e820.c
@@ -908,6 +908,49 @@ void __init reserve_early_overlap_ok(u64
 	__reserve_early(start, end, name, 1);
 }
 
+static void __init __check_and_double_early_res(void)
+{
+	u64 size;
+	u64 mem;
+	struct early_res *new;
+
+	/* do we have enough slots left ? */
+	if ((max_early_res - early_res_count) > max(max_early_res/8, 2))
+		return;
+
+	/* double it */
+	size = sizeof(struct early_res) * max_early_res * 2;
+	mem = find_e820_area(0, max_pfn_mapped << PAGE_SHIFT, size,
+		 sizeof(struct early_res));
+
+	if (mem == -1ULL)
+		panic("can not find more space for early_res array");
+
+	new = __va(mem);
+	/* save the first one for own */
+	new[0].start = mem;
+	new[0].end = mem + size;
+	new[0].overlap_ok = 0;
+	/* copy old to new */
+	if (early_res == early_res_x) {
+		memcpy(&new[1], &early_res[0],
+			 sizeof(struct early_res) * max_early_res);
+		memset(&new[max_early_res+1], 0,
+			 sizeof(struct early_res) * (max_early_res - 1));
+		early_res_count++;
+	} else {
+		memcpy(&new[1], &early_res[1],
+			 sizeof(struct early_res) * (max_early_res - 1));
+		memset(&new[max_early_res], 0,
+			 sizeof(struct early_res) * max_early_res);
+	}
+	memset(&early_res[0], 0, sizeof(struct early_res) * max_early_res);
+	early_res = new;
+	max_early_res *= 2;
+	printk(KERN_DEBUG "early_res array is doubled to %d at [%llx - %llx]\n",
+		max_early_res, mem, mem + size - 1);
+}
+
 /*
  * Most early reservations come here.
  *
@@ -921,6 +964,8 @@ void __init reserve_early(u64 start, u64
 	if (start >= end)
 		return;
 
+	__check_and_double_early_res();
+
 	drop_overlaps_that_are_ok(start, end);
 	__reserve_early(start, end, name, 0);
 }
@@ -949,6 +994,10 @@ void __init early_res_to_bootmem(u64 sta
 	for (i = 0; i < max_early_res && early_res[i].end; i++)
 		count++;
 
+	/* need to skip first one ?*/
+	if (early_res != early_res_x)
+		idx = 1;
+
 	printk(KERN_INFO "(%d/%d early reservations) ==> bootmem [%010llx - %010llx]\n",
 			 count - idx, max_early_res, start, end);
 	for (i = idx; i < count; i++) {
@@ -966,6 +1015,11 @@ void __init early_res_to_bootmem(u64 sta
 		reserve_bootmem_generic(final_start, final_end - final_start,
 				BOOTMEM_DEFAULT);
 	}
+	/* clear them */
+	memset(&early_res[0], 0, sizeof(struct early_res) * max_early_res);
+	early_res = NULL;
+	max_early_res = 0;
+	early_res_count = 0;
 }
 
 /* Check for already reserved areas */

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 4/3] x86: make early_node_mem get mem > 4g if possible -v2
  2009-12-15  2:08       ` [PATCH 3/3] x86: dynamic increase early_res array size Yinghai Lu
@ 2009-12-16  1:11         ` Yinghai Lu
  0 siblings, 0 replies; 22+ messages in thread
From: Yinghai Lu @ 2009-12-16  1:11 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin, Christoph Lameter
  Cc: linux-kernel@vger.kernel.org, FUJITA Tomonori


so we could put pgdata for the node high, and later sparse
vmmap will get the section nr that need.

with this patch will make <4g ram will not use sparse vmmap

before this patch, will get, before swiotlb try get bootmem
[    0.000000] nid=1 start=0 end=2080000 aligned=1
[    0.000000]   free [10 - 96]
[    0.000000]   free [b12 - 1000]
[    0.000000]   free [359f - 38a3]
[    0.000000]   free [38b5 - 3a00]
[    0.000000]   free [41e01 - 42000]
[    0.000000]   free [73dde - 73e00]
[    0.000000]   free [73fdd - 74000]
[    0.000000]   free [741dd - 74200]
[    0.000000]   free [743dd - 74400]
[    0.000000]   free [745dd - 74600]
[    0.000000]   free [747dd - 74800]
[    0.000000]   free [749dd - 74a00]
[    0.000000]   free [74bdd - 74c00]
[    0.000000]   free [74ddd - 74e00]
[    0.000000]   free [74fdd - 75000]
[    0.000000]   free [751dd - 75200]
[    0.000000]   free [753dd - 75400]
[    0.000000]   free [755dd - 75600]
[    0.000000]   free [757dd - 75800]
[    0.000000]   free [759dd - 75a00]
[    0.000000]   free [75bdd - 7bf5f]
[    0.000000]   free [7f730 - 7f750]
[    0.000000]   free [100000 - 2080000]
[    0.000000]   total free 1f87170
[   93.301474] Placing 64MB software IO TLB between ffff880075bdd000 - ffff880079bdd000
[   93.311814] software IO TLB at phys 0x75bdd000 - 0x79bdd000

with this patch will get: before swiotlb try get bootmem
[    0.000000] nid=1 start=0 end=2080000 aligned=1
[    0.000000]   free [a - 96]
[    0.000000]   free [702 - 1000]
[    0.000000]   free [359f - 3600]
[    0.000000]   free [37de - 3800]
[    0.000000]   free [39dd - 3a00]
[    0.000000]   free [3bdd - 3c00]
[    0.000000]   free [3ddd - 3e00]
[    0.000000]   free [3fdd - 4000]
[    0.000000]   free [41dd - 4200]
[    0.000000]   free [43dd - 4400]
[    0.000000]   free [45dd - 4600]
[    0.000000]   free [47dd - 4800]
[    0.000000]   free [49dd - 4a00]
[    0.000000]   free [4bdd - 4c00]
[    0.000000]   free [4ddd - 4e00]
[    0.000000]   free [4fdd - 5000]
[    0.000000]   free [51dd - 5200]
[    0.000000]   free [53dd - 5400]
[    0.000000]   free [55dd - 7bf5f]
[    0.000000]   free [7f730 - 7f750]
[    0.000000]   free [100428 - 100600]
[    0.000000]   free [13ea01 - 13ec00]
[    0.000000]   free [170800 - 2080000]
[    0.000000]   total free 1f87170

[   92.689485] PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
[   92.699799] Placing 64MB software IO TLB between ffff8800055dd000 - ffff8800095dd000
[   92.710916] software IO TLB at phys 0x55dd000 - 0x95dd000

so will get enough space below 4G, aka pfn 0x100000

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/x86/mm/numa_64.c |   19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

Index: linux-2.6/arch/x86/mm/numa_64.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/numa_64.c
+++ linux-2.6/arch/x86/mm/numa_64.c
@@ -163,14 +163,27 @@ static void * __init early_node_mem(int
 				    unsigned long end, unsigned long size,
 				    unsigned long align)
 {
-	unsigned long mem = find_e820_area(start, end, size, align);
+	unsigned long mem;
 
+	/*
+	 * put it on high as possible
+	 * something will go with NODE_DATA
+	 */
+	if (start < (MAX_DMA_PFN<<PAGE_SHIFT))
+		start = MAX_DMA_PFN<<PAGE_SHIFT;
+	if (start < (MAX_DMA32_PFN<<PAGE_SHIFT) &&
+	    end > (MAX_DMA32_PFN<<PAGE_SHIFT))
+		start = MAX_DMA32_PFN<<PAGE_SHIFT;
+	mem = find_e820_area(start, end, size, align);
 	if (mem != -1L)
 		return __va(mem);
 
 
-	start = __pa(MAX_DMA_ADDRESS);
-	end = max_low_pfn_mapped << PAGE_SHIFT;
+	end = max_pfn_mapped << PAGE_SHIFT;
+	if (end > (MAX_DMA32_PFN<<PAGE_SHIFT))
+		start = MAX_DMA32_PFN<<PAGE_SHIFT;
+	else
+		start = MAX_DMA_PFN<<PAGE_SHIFT;
 	mem = find_e820_area(start, end, size, align);
 	if (mem != -1L)
 		return __va(mem);

^ permalink raw reply	[flat|nested] 22+ messages in thread

* [tip:x86/urgent] x86: Increase MAX_EARLY_RES; insufficient on 32-bit NUMA
  2009-12-11 23:35 ` [PATCH 7/7] x86: increase MAX_EARLY_RES Yinghai Lu
  2009-12-15  2:06   ` [PATCH 1/3] x86: call early_res_to_bootmem one time Yinghai Lu
@ 2009-12-17  1:01   ` tip-bot for Yinghai Lu
  1 sibling, 0 replies; 22+ messages in thread
From: tip-bot for Yinghai Lu @ 2009-12-17  1:01 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, yinghai, tglx

Commit-ID:  6a1e008a0915f502eb026fb995ea3e49d5b017f7
Gitweb:     http://git.kernel.org/tip/6a1e008a0915f502eb026fb995ea3e49d5b017f7
Author:     Yinghai Lu <yinghai@kernel.org>
AuthorDate: Tue, 15 Dec 2009 17:59:03 -0800
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Wed, 16 Dec 2009 16:46:23 -0800

x86: Increase MAX_EARLY_RES; insufficient on 32-bit NUMA

Due to recent changes wakeup and mptable, we run out of early
reservations on 32-bit NUMA.  Thus, adjust the available number.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
LKML-Reference: <4B22D754.2020706@kernel.org>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/kernel/e820.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index f50447d..05ed7ab 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -724,7 +724,7 @@ core_initcall(e820_mark_nvs_memory);
 /*
  * Early reserved memory areas.
  */
-#define MAX_EARLY_RES 20
+#define MAX_EARLY_RES 32
 
 struct early_res {
 	u64 start, end;

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 6/7] x86/pci: enable pci root res read out for 32bit too -v3
       [not found] <4B2BE063.4040704@kernel.org>
@ 2009-12-18 20:09 ` Yinghai Lu
  0 siblings, 0 replies; 22+ messages in thread
From: Yinghai Lu @ 2009-12-18 20:09 UTC (permalink / raw)
  To: Jesse Barnes, Ingo Molnar, Thomas Gleixner, H. Peter Anvin
  Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org


should be good for 32bit too.

-v3: cast res->start

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/x86/pci/Makefile    |    3 +--
 arch/x86/pci/amd_bus.c   |   14 +-------------
 arch/x86/pci/bus_numa.h  |    4 ++--
 arch/x86/pci/i386.c      |    4 ----
 arch/x86/pci/intel_bus.c |    2 +-
 5 files changed, 5 insertions(+), 22 deletions(-)

Index: linux-2.6/arch/x86/pci/Makefile
===================================================================
--- linux-2.6.orig/arch/x86/pci/Makefile
+++ linux-2.6/arch/x86/pci/Makefile
@@ -14,8 +14,7 @@ obj-$(CONFIG_X86_VISWS)		+= visws.o
 obj-$(CONFIG_X86_NUMAQ)		+= numaq_32.o
 
 obj-y				+= common.o early.o
-obj-y				+= amd_bus.o
-obj-$(CONFIG_X86_64)		+= bus_numa.o intel_bus.o
+obj-y				+= amd_bus.o bus_numa.o intel_bus.o
 
 ifeq ($(CONFIG_PCI_DEBUG),y)
 EXTRA_CFLAGS += -DDEBUG
Index: linux-2.6/arch/x86/pci/amd_bus.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/amd_bus.c
+++ linux-2.6/arch/x86/pci/amd_bus.c
@@ -6,9 +6,7 @@
 
 #include <asm/pci_x86.h>
 
-#ifdef CONFIG_X86_64
 #include <asm/pci-direct.h>
-#endif
 
 #include "bus_numa.h"
 
@@ -17,8 +15,6 @@
  * also get peer root bus resource for io,mmio
  */
 
-#ifdef CONFIG_X86_64
-
 struct pci_hostbridge_probe {
 	u32 bus;
 	u32 slot;
@@ -342,21 +338,13 @@ static int __init early_fill_mp_bus_info
 			printk(KERN_DEBUG "bus: %02x index %x %s: [%llx, %llx]\n",
 			       busnum, j,
 			       (res->flags & IORESOURCE_IO)?"io port":"mmio",
-			       res->start, res->end);
+			       (u64)res->start, (u64)res->end);
 		}
 	}
 
 	return 0;
 }
 
-#else  /* !CONFIG_X86_64 */
-
-static int __init early_fill_mp_bus_info(void) { return 0; }
-
-#endif /* !CONFIG_X86_64 */
-
-/* common 32/64 bit code */
-
 #define ENABLE_CF8_EXT_CFG      (1ULL << 46)
 
 static void enable_pci_io_ecs(void *unused)
Index: linux-2.6/arch/x86/pci/i386.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/i386.c
+++ linux-2.6/arch/x86/pci/i386.c
@@ -257,10 +257,6 @@ void __init pcibios_resource_survey(void
  */
 fs_initcall(pcibios_assign_resources);
 
-void __weak x86_pci_root_bus_res_quirks(struct pci_bus *b)
-{
-}
-
 /*
  *  If we set up a device for bus mastering, we need to check the latency
  *  timer as certain crappy BIOSes forget to set it properly.
Index: linux-2.6/arch/x86/pci/bus_numa.h
===================================================================
--- linux-2.6.orig/arch/x86/pci/bus_numa.h
+++ linux-2.6/arch/x86/pci/bus_numa.h
@@ -1,5 +1,5 @@
-#ifdef CONFIG_X86_64
-
+#ifndef __BUS_NUMA_H
+#define __BUS_NUMA_H
 /*
  * sub bus (transparent) will use entres from 3 to store extra from
  * root, so need to make sure we have enough slot there, Should we
Index: linux-2.6/arch/x86/pci/intel_bus.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/intel_bus.c
+++ linux-2.6/arch/x86/pci/intel_bus.c
@@ -30,7 +30,7 @@ static inline void print_ioh_resources(s
 			busnum, i,
 			(res->flags & IORESOURCE_IO) ? "io port" :
 							"mmio",
-			res->start, res->end);
+			(u64)res->start, (u64)res->end);
 	}
 }
 


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2009-12-18 20:11 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <4B22D4DA.2000104@kernel.org>
2009-12-11 23:35 ` [PATCH 2/7] x86/range: check range in update range Yinghai Lu
2009-12-11 23:35 ` [PATCH 3/7] x86/pci: use resource_size_t in update_res Yinghai Lu
2009-12-11 23:35 ` [PATCH 4/7] x86/pci: amd one chain system to use pci read out res Yinghai Lu
2009-12-11 23:35 ` [PATCH 5/7] x86/pci: use u64 instead of size_t in amd_bus.c Yinghai Lu
2009-12-11 23:55   ` H. Peter Anvin
2009-12-12  0:42     ` Yinghai Lu
2009-12-12  2:10   ` [PATCH 5/7] x86/pci: use u64 instead of size_t in amd_bus.c -v2 Yinghai Lu
2009-12-11 23:35 ` [PATCH 6/7] x86/pci: enable pci root res read out for 32bit too Yinghai Lu
2009-12-12  2:11   ` [PATCH 61/7] x86/pci: add cap_4g Yinghai Lu
2009-12-12  2:16     ` H. Peter Anvin
2009-12-12  2:20       ` Yinghai Lu
2009-12-12  2:25         ` H. Peter Anvin
2009-12-12  3:29           ` [PATCH 61/7] x86/pci: add cap_resource -v2 Yinghai Lu
2009-12-12  2:13   ` [PATCH 6/7] x86/pci: enable pci root res read out for 32bit too -v2 Yinghai Lu
2009-12-12  3:28     ` [PATCH 6/7] x86/pci: enable pci root res read out for 32bit too -v3 Yinghai Lu
2009-12-11 23:35 ` [PATCH 7/7] x86: increase MAX_EARLY_RES Yinghai Lu
2009-12-15  2:06   ` [PATCH 1/3] x86: call early_res_to_bootmem one time Yinghai Lu
2009-12-15  2:07     ` [PATCH 2/3] x86: introduce max_early_res and early_res_count Yinghai Lu
2009-12-15  2:08       ` [PATCH 3/3] x86: dynamic increase early_res array size Yinghai Lu
2009-12-16  1:11         ` [PATCH 4/3] x86: make early_node_mem get mem > 4g if possible -v2 Yinghai Lu
2009-12-17  1:01   ` [tip:x86/urgent] x86: Increase MAX_EARLY_RES; insufficient on 32-bit NUMA tip-bot for Yinghai Lu
     [not found] <4B2BE063.4040704@kernel.org>
2009-12-18 20:09 ` [PATCH 6/7] x86/pci: enable pci root res read out for 32bit too -v3 Yinghai Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox