+ hot-add-mem-x86_64-valid-add-range-check.patch added to -mm tree

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

 



The patch titled

     hot-add-mem x86_64: valid add range check

has been added to the -mm tree.  Its filename is

     hot-add-mem-x86_64-valid-add-range-check.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: hot-add-mem x86_64: valid add range check
From: Keith Mannthey <kmannth@xxxxxxxxxx>

Introduce and implement valid_add_memory_range to MEMORY_HOTPLUG.  The RESERVE
path needs to be careful about check to make sure it only onlines correct
memory.  The SPASRMEM path is using resource code to do this so it gets a
no-op check.  This frame work makes it was to add specific checks for valid
add memory ranges as the need arises.

Signed-off-by: Keith Mannthey<kmannth@xxxxxxxxxx>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx>
Cc: Andi Kleen <ak@xxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---


diff -puN arch/x86_64/mm/srat.c~hot-add-mem-x86_64-valid-add-range-check arch/x86_64/mm/srat.c
--- a/arch/x86_64/mm/srat.c~hot-add-mem-x86_64-valid-add-range-check
+++ a/arch/x86_64/mm/srat.c
@@ -203,6 +203,12 @@ static inline int save_add_info(void)
 {
 	return hotadd_percent > 0;
 }
+
+inline int valid_add_memory_range(int nid, u64 start, u64 size) {
+	if (nodes_add[nid].start <= start && nodes_add[nid].end >= (start+size))
+		return 1;
+	return 0;
+}
 #else
 int update_end_of_memory(unsigned long end) {return 0;}
 static int hotadd_enough_memory(struct bootnode *nd) {return 1;}
diff -puN include/linux/memory_hotplug.h~hot-add-mem-x86_64-valid-add-range-check include/linux/memory_hotplug.h
--- a/include/linux/memory_hotplug.h~hot-add-mem-x86_64-valid-add-range-check
+++ a/include/linux/memory_hotplug.h
@@ -159,7 +159,7 @@ static inline int mhp_notimplemented(con
 	dump_stack();
 	return -ENOSYS;
 }
-
+extern int valid_add_memory_range(int nid, u64 start, u64 size);
 #endif /* ! CONFIG_MEMORY_HOTPLUG */
 static inline int __remove_pages(struct zone *zone, unsigned long start_pfn,
 	unsigned long nr_pages)
diff -puN mm/memory_hotplug.c~hot-add-mem-x86_64-valid-add-range-check mm/memory_hotplug.c
--- a/mm/memory_hotplug.c~hot-add-mem-x86_64-valid-add-range-check
+++ a/mm/memory_hotplug.c
@@ -190,6 +190,11 @@ int online_pages(unsigned long pfn, unsi
 	vm_total_pages = nr_free_pagecache_pages();
 	return 0;
 }
+
+inline int valid_add_memory_range(int nid, u64 start, u64 size) {
+	return 1;
+}
+
 #endif /* CONFIG_MEMORY_HOTPLUG_SPARSE */
 
 static pg_data_t *hotadd_new_pgdat(int nid, u64 start)
@@ -258,6 +263,9 @@ int add_memory(int nid, u64 start, u64 s
 	struct resource *res;
 	int ret;
 
+	if (!valid_add_memory_range(nid,start,size))
+		return -EINVAL;
+
 	res = register_memory_resource(start, size);
 	if (!res)
 		return -EEXIST;
_

Patches currently in -mm which might be from kmannth@xxxxxxxxxx are

memory-hotadd-fixes-enhance-collistion-check.patch
hot-add-mem-x86_64-acpi-motherboard-fix.patch
hot-add-mem-x86_64-fixup-externs.patch
hot-add-mem-x86_64-kconfig-changes.patch
hot-add-mem-x86_64-enable-sparsemem-in-sratc.patch
hot-add-mem-x86_64-memory_add_physaddr_to_nid-enable.patch
hot-add-mem-x86_64-memory_add_physaddr_to_nid-node-fixup.patch
hot-add-mem-x86_64-x86_64-kernel-mapping-fix.patch
hot-add-mem-x86_64-use-config_memory_hotplug_sparse.patch
hot-add-mem-x86_64-use-config_memory_hotplug_reserve.patch
hot-add-mem-x86_64-valid-add-range-check.patch
convert-i386-numa-kva-space-to-bootmem.patch
convert-i386-numa-kva-space-to-bootmem-tidy.patch
convert-i386-summit-subarch-to-use-srat-info-for-apicid_to_node-calls.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux