Re: [linux-drivers-review] [PATCH] x86/mm: Fix boot with some memory above MAXMEM

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, May 11, 2020 at 09:43:30AM -0700, Dave Hansen wrote:
> On 5/11/20 9:37 AM, Kirill A. Shutemov wrote:
> > -		memblock_add(entry->addr, entry->size);
> > +		if (entry->addr >= MAXMEM || end >= MAXMEM)
> > +			pr_err_once("Some physical memory is not addressable in the paging mode.\n");
> 
> Hi Kirill,
> 
> Thanks for fixing this!
> 
> Could we make the pr_err() a bit more informative, though?  It would be
> nice to print out how much memory (or which addresses at least) are
> being thrown away.
> 
> I was also thinking that it would be handy to tell folks how to rectify
> the situation.  Should we perhaps dump out the runtime status of
> X86_FEATURE_LA57?

Something like this (incremental patch)?

diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 022fe1de8940..172b4244069f 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -1280,8 +1280,8 @@ void __init e820__memory_setup(void)
 
 void __init e820__memblock_setup(void)
 {
+	u64 size, end, not_addressable = 0;
 	int i;
-	u64 end;
 
 	/*
 	 * The bootstrap memblock region count maximum is 128 entries
@@ -1307,16 +1307,24 @@ void __init e820__memblock_setup(void)
 		if (entry->type != E820_TYPE_RAM && entry->type != E820_TYPE_RESERVED_KERN)
 			continue;
 
-		if (entry->addr >= MAXMEM || end >= MAXMEM)
-			pr_err_once("Some physical memory is not addressable in the paging mode.\n");
-
-		if (entry->addr >= MAXMEM)
+		if (entry->addr >= MAXMEM) {
+			not_addressable += entry->size;
 			continue;
+		}
 
 		end = min_t(u64, end, MAXMEM - 1);
+		size = end - entry->addr;
+		not_addressable += entry->size - size;
 		memblock_add(entry->addr, end - entry->addr);
 	}
 
+	if (not_addressable) {
+		pr_err("%lldMB of physical memory is not addressable in the paging mode\n",
+		       not_addressable >> 20);
+		if (!pgtable_l5_enabled())
+			pr_err("Consider enabling 5-level paging\n");
+	}
+
 	/* Throw away partial pages: */
 	memblock_trim_memory(PAGE_SIZE);
 
-- 
 Kirill A. Shutemov



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux