Skip to contentSkip to conversation

firmware_map : unify argument of firmware_map_add_early/hotplug

PATCH In review Yasuaki Ishimatsu 1 participant 2 messages Jul 17, 2012 – Jul 24, 2012 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 firmware_map : unify argument of firmware_map_add_early/hotplug

There are two ways to create /sys/firmware/memmap/X sysfs:

- firmware_map_add_early
When the system starts, it is calledd from e820_reserve_resources()
- firmware_map_add_hotplug
When the memory is hot plugged, it is called from add_memory()

But these functions are called without unifying value of end argument as below:

- end argument of firmware_map_add_early() : start + size - 1
- end argument of firmware_map_add_hogplug() : start + size

The patch unifies them to "start + size". Even if applying the patch, /sys/firmware/memmap/X/end file content does not change.

CC Thomas Gleixner <[email protected]>
CC Ingo Molnar <[email protected]>
CC H. Peter Anvin <[email protected]>
CC Tejun Heo <[email protected]>
CC Andrew Morton <[email protected]>
---
 arch/x86/kernel/e820.c    |    2 +-
 drivers/firmware/memmap.c |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
arch/x86/kernel/e820.c +1 -1
Index: linux-next/arch/x86/kernel/e820.c
===================================================================
@@ -944,7 +944,7 @@
 	for (i = 0; i < e820_saved.nr_map; i++) {
 		struct e820entry *entry = &e820_saved.map[i];
 		firmware_map_add_early(entry->addr,
-			entry->addr + entry->size - 1,
+			entry->addr + entry->size,
 			e820_type_to_string(entry->type));
 	}
 }
drivers/firmware/memmap.c +4 -4
Index: linux-next/drivers/firmware/memmap.c
===================================================================
@@ -98,7 +98,7 @@
 /**
  * firmware_map_add_entry() - Does the real work to add a firmware memmap entry.
  * @start: Start of the memory range.
- * @end:   End of the memory range (inclusive).
+ * @end:   End of the memory range.
  * @type:  Type of the memory range.
  * @entry: Pre-allocated (either kmalloc() or bootmem allocator), uninitialised
  *         entry.
@@ -113,7 +113,7 @@
 	BUG_ON(start > end);
 
 	entry->start = start;
-	entry->end = end;
+	entry->end = end - 1;
 	entry->type = type;
 	INIT_LIST_HEAD(&entry->list);
 	kobject_init(&entry->kobj, &memmap_ktype);
@@ -148,7 +148,7 @@
  * firmware_map_add_hotplug() - Adds a firmware mapping entry when we do
  * memory hotplug.
  * @start: Start of the memory range.
- * @end:   End of the memory range (inclusive).
+ * @end:   End of the memory range.
  * @type:  Type of the memory range.
  *
  * Adds a firmware mapping entry. This function is for memory hotplug, it is
@@ -175,7 +175,7 @@
 /**
  * firmware_map_add_early() - Adds a firmware mapping entry.
  * @start: Start of the memory range.
- * @end:   End of the memory range (inclusive).
+ * @end:   End of the memory range.
  * @type:  Type of the memory range.
  *
  * Adds a firmware mapping entry. This function uses the bootmem allocator
#1 lore raw

The patch is bugfix. So I want you to review it and merge into linux-3.6.

Quoted 88 lines · Yasuaki Ishimatsu

There are two ways to create /sys/firmware/memmap/X sysfs:

- firmware_map_add_early
When the system starts, it is calledd from e820_reserve_resources()
- firmware_map_add_hotplug
When the memory is hot plugged, it is called from add_memory()

But these functions are called without unifying value of end argument as below:

- end argument of firmware_map_add_early() : start + size - 1
- end argument of firmware_map_add_hogplug() : start + size

The patch unifies them to "start + size". Even if applying the patch, /sys/firmware/memmap/X/end file content does not change.

CC Thomas Gleixner <[email protected]>
CC Ingo Molnar <[email protected]>
CC H. Peter Anvin <[email protected]>
CC Tejun Heo <[email protected]>
CC Andrew Morton <[email protected]>
---
  arch/x86/kernel/e820.c    |    2 +-
  drivers/firmware/memmap.c |    8 ++++----
  2 files changed, 5 insertions(+), 5 deletions(-)

Index: linux-next/arch/x86/kernel/e820.c
===================================================================

arch/x86/kernel/e820.c +1 -1
@@ -944,7 +944,7 @@
  	for (i = 0; i < e820_saved.nr_map; i++) {
  		struct e820entry *entry = &e820_saved.map[i];
  		firmware_map_add_early(entry->addr,
-			entry->addr + entry->size - 1,
+			entry->addr + entry->size,
  			e820_type_to_string(entry->type));
  	}
  }

Index: linux-next/drivers/firmware/memmap.c
===================================================================

drivers/firmware/memmap.c +4 -5
@@ -98,7 +98,7 @@
  /**
   * firmware_map_add_entry() - Does the real work to add a firmware memmap entry.
   * @start: Start of the memory range.
- * @end:   End of the memory range (inclusive).
+ * @end:   End of the memory range.
   * @type:  Type of the memory range.
   * @entry: Pre-allocated (either kmalloc() or bootmem allocator), uninitialised
   *         entry.
@@ -113,7 +113,7 @@
  	BUG_ON(start > end);
 
  	entry->start = start;
-	entry->end = end;
+	entry->end = end - 1;
  	entry->type = type;
  	INIT_LIST_HEAD(&entry->list);
  	kobject_init(&entry->kobj, &memmap_ktype);
@@ -148,7 +148,7 @@
   * firmware_map_add_hotplug() - Adds a firmware mapping entry when we do
   * memory hotplug.
   * @start: Start of the memory range.
- * @end:   End of the memory range (inclusive).
+ * @end:   End of the memory range.
   * @type:  Type of the memory range.
   *
   * Adds a firmware mapping entry. This function is for memory hotplug, it is
@@ -175,7 +175,7 @@
  /**
   * firmware_map_add_early() - Adds a firmware mapping entry.
   * @start: Start of the memory range.
- * @end:   End of the memory range (inclusive).
+ * @end:   End of the memory range.
   * @type:  Type of the memory range.
   *
   * Adds a firmware mapping entry. This function uses the bootmem allocator
 
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/