lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4B786110.9020806@kernel.org>
Date:	Sun, 14 Feb 2010 12:46:08 -0800
From:	Yinghai Lu <yinghai@...nel.org>
To:	Stephen Rothwell <sfr@...b.auug.org.au>
CC:	Ingo Molnar <mingo@...e.hu>, Thomas Gleixner <tglx@...utronix.de>,
	"H. Peter Anvin" <hpa@...or.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Jesse Barnes <jbarnes@...tuousgeek.org>,
	Christoph Lameter <cl@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org
Subject: Re: [PATCH 27/35] core: move early_res

On 02/14/2010 06:16 AM, Stephen Rothwell wrote:
> Hi,
> 
> On Wed, 10 Feb 2010 01:20:31 -0800 Yinghai Lu <yinghai@...nel.org> wrote:
>>
>> from arch/x86 to kernel/
>>
>> Signed-off-by: Yinghai Lu <yinghai@...nel.org>
>> ---
>>  arch/x86/include/asm/e820.h      |    2 +-
>>  arch/x86/include/asm/early_res.h |   21 --
>>  arch/x86/kernel/Makefile         |    2 +-
>>  arch/x86/kernel/e820.c           |    1 -
>>  arch/x86/kernel/early_res.c      |  523 --------------------------------------
>>  include/linux/early_res.h        |   21 ++
>>  kernel/Makefile                  |    2 +-
>>  kernel/early_res.c               |  522 +++++++++++++++++++++++++++++++++++++
>>  8 files changed, 546 insertions(+), 548 deletions(-)
>>  delete mode 100644 arch/x86/include/asm/early_res.h
>>  delete mode 100644 arch/x86/kernel/early_res.c
>>  create mode 100644 include/linux/early_res.h
>>  create mode 100644 kernel/early_res.c
> 
> From a powerpc pseries_defconfig build (and other configs) of tip/master
> (9d4a5dc3080c811f36bf8175f2de1f9a6f84b176 "Merge branch 'perf/urgent'"):
> 
> kernel/early_res.c:209: error: 'max_pfn_mapped' undeclared (first use in this function)
> 
> max_pfn_mapped is only defined for x86.
> 


please check

Subject: [PATCH -v2] x86: fix cross-arch compiling

Ingo found:
lots of cross-arch build failures in latest -tip:

/home/mingo/tip/kernel/early_res.c: In function '__check_and_double_early_res':
/home/mingo/tip/kernel/early_res.c:209: error: 'max_pfn_mapped' undeclared (first use in this function)
/home/mingo/tip/kernel/early_res.c:209: error: (Each undeclared identifier is reported only once
/home/mingo/tip/kernel/early_res.c:209: error: for each function it appears in.)
make[2]: *** [kernel/early_res.o] Error 1

max_pfn_mapped only defined in x86...

so add get_max_mapped function...

-v2: use that in get_free_all_memory_range() too

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

---
 arch/x86/kernel/e820.c    |    9 +++++++++
 include/linux/early_res.h |    1 +
 kernel/early_res.c        |   13 ++++++++++---
 3 files changed, 20 insertions(+), 3 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
@@ -752,6 +752,15 @@ u64 __init find_fw_memmap_area(u64 start
 {
 	return find_e820_area(start, end, size, align);
 }
+
+u64 __init get_max_mapped(void)
+{
+	u64 end = max_pfn_mapped;
+
+	end <<= PAGE_SHIFT;
+
+	return end;
+}
 /*
  * Find next free range after *start
  */
Index: linux-2.6/include/linux/early_res.h
===================================================================
--- linux-2.6.orig/include/linux/early_res.h
+++ linux-2.6/include/linux/early_res.h
@@ -13,6 +13,7 @@ u64 find_early_area(u64 ei_start, u64 ei
 u64 find_early_area_size(u64 ei_start, u64 ei_last, u64 start,
 			 u64 *sizep, u64 align);
 u64 find_fw_memmap_area(u64 start, u64 end, u64 size, u64 align);
+u64 get_max_mapped(void);
 #include <linux/range.h>
 int get_free_all_memory_range(struct range **rangep, int nodeid);
 
Index: linux-2.6/kernel/early_res.c
===================================================================
--- linux-2.6.orig/kernel/early_res.c
+++ linux-2.6/kernel/early_res.c
@@ -184,6 +184,13 @@ u64 __init __weak find_fw_memmap_area(u6
 	return -1ULL;
 }
 
+u64 __init __weak get_max_mapped(void)
+{
+	panic("should have get_max_mapped defined with arch");
+
+	return -1ULL;
+}
+
 static void __init __check_and_double_early_res(u64 ex_start, u64 ex_end)
 {
 	u64 start, end, size, mem;
@@ -206,7 +213,7 @@ static void __init __check_and_double_ea
 					 sizeof(struct early_res));
 	if (mem == -1ULL) {
 		start = ex_end;
-		end = max_pfn_mapped << PAGE_SHIFT;
+		end = get_max_mapped();
 		if (start + size < end)
 			mem = find_fw_memmap_area(start, end, size,
 						 sizeof(struct early_res));
@@ -342,11 +349,11 @@ int __init get_free_all_memory_range(str
 	count *= 2;
 
 	size = sizeof(struct range) * count;
+	end = get_max_mapped();
 #ifdef MAX_DMA32_PFN
-	if (max_pfn_mapped > MAX_DMA32_PFN)
+	if (end > (MAX_DMA32_PFN << PAGE_SHIFT))
 		start = MAX_DMA32_PFN << PAGE_SHIFT;
 #endif
-	end = max_pfn_mapped << PAGE_SHIFT;
 	mem = find_fw_memmap_area(start, end, size, sizeof(struct range));
 	if (mem == -1ULL)
 		panic("can not find more space for range free");
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ