Skip to content

Commit cb3e433

Browse files
committed
Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 mm changes from Ingo Molnar: "Misc smaller fixes: - a parse_setup_data() boot crash fix - a memblock and an __early_ioremap cleanup - turn the always-on CONFIG_ARCH_MEMORY_PROBE=y into a configurable option and turn it off - it's an unrobust debug facility, it shouldn't be enabled by default" * 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86: avoid remapping data in parse_setup_data() x86: Use memblock_set_current_limit() to set limit for memblock. mm: Remove unused variable idx0 in __early_ioremap() mm/hotplug, x86: Disable ARCH_MEMORY_PROBE by default
2 parents aafcd5d + 30e46b5 commit cb3e433

File tree

6 files changed

+31
-26
lines changed

6 files changed

+31
-26
lines changed

Documentation/memory-hotplug.txt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,15 @@ If memory device is found, memory hotplug code will be called.
210210

211211
4.2 Notify memory hot-add event by hand
212212
------------
213-
In some environments, especially virtualized environment, firmware will not
214-
notify memory hotplug event to the kernel. For such environment, "probe"
215-
interface is supported. This interface depends on CONFIG_ARCH_MEMORY_PROBE.
216-
217-
Now, CONFIG_ARCH_MEMORY_PROBE is supported only by powerpc but it does not
218-
contain highly architecture codes. Please add config if you need "probe"
219-
interface.
213+
On powerpc, the firmware does not notify a memory hotplug event to the kernel.
214+
Therefore, "probe" interface is supported to notify the event to the kernel.
215+
This interface depends on CONFIG_ARCH_MEMORY_PROBE.
216+
217+
CONFIG_ARCH_MEMORY_PROBE is supported on powerpc only. On x86, this config
218+
option is disabled by default since ACPI notifies a memory hotplug event to
219+
the kernel, which performs its hotplug operation as the result. Please
220+
enable this option if you need the "probe" interface for testing purposes
221+
on x86.
220222

221223
Probe interface is located at
222224
/sys/devices/system/memory/probe

arch/x86/Kconfig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1344,8 +1344,12 @@ config ARCH_SELECT_MEMORY_MODEL
13441344
depends on ARCH_SPARSEMEM_ENABLE
13451345

13461346
config ARCH_MEMORY_PROBE
1347-
def_bool y
1347+
bool "Enable sysfs memory/probe interface"
13481348
depends on X86_64 && MEMORY_HOTPLUG
1349+
help
1350+
This option enables a sysfs memory/probe interface for testing.
1351+
See Documentation/memory-hotplug.txt for more information.
1352+
If you are unsure how to answer this question, answer N.
13491353

13501354
config ARCH_PROC_KCORE_TEXT
13511355
def_bool y

arch/x86/include/asm/e820.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ extern void e820_setup_gap(void);
2929
extern int e820_search_gap(unsigned long *gapstart, unsigned long *gapsize,
3030
unsigned long start_addr, unsigned long long end_addr);
3131
struct setup_data;
32-
extern void parse_e820_ext(struct setup_data *data);
32+
extern void parse_e820_ext(u64 phys_addr, u32 data_len);
3333

3434
#if defined(CONFIG_X86_64) || \
3535
(defined(CONFIG_X86_32) && defined(CONFIG_HIBERNATION))

arch/x86/kernel/e820.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,15 +658,18 @@ __init void e820_setup_gap(void)
658658
* boot_params.e820_map, others are passed via SETUP_E820_EXT node of
659659
* linked list of struct setup_data, which is parsed here.
660660
*/
661-
void __init parse_e820_ext(struct setup_data *sdata)
661+
void __init parse_e820_ext(u64 phys_addr, u32 data_len)
662662
{
663663
int entries;
664664
struct e820entry *extmap;
665+
struct setup_data *sdata;
665666

667+
sdata = early_memremap(phys_addr, data_len);
666668
entries = sdata->len / sizeof(struct e820entry);
667669
extmap = (struct e820entry *)(sdata->data);
668670
__append_e820_map(extmap, entries);
669671
sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
672+
early_iounmap(sdata, data_len);
670673
printk(KERN_INFO "e820: extended physical RAM map:\n");
671674
e820_print_map("extended");
672675
}

arch/x86/kernel/setup.c

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -426,34 +426,31 @@ static void __init reserve_initrd(void)
426426
static void __init parse_setup_data(void)
427427
{
428428
struct setup_data *data;
429-
u64 pa_data;
429+
u64 pa_data, pa_next;
430430

431431
pa_data = boot_params.hdr.setup_data;
432432
while (pa_data) {
433-
u32 data_len, map_len;
433+
u32 data_len, map_len, data_type;
434434

435435
map_len = max(PAGE_SIZE - (pa_data & ~PAGE_MASK),
436436
(u64)sizeof(struct setup_data));
437437
data = early_memremap(pa_data, map_len);
438438
data_len = data->len + sizeof(struct setup_data);
439-
if (data_len > map_len) {
440-
early_iounmap(data, map_len);
441-
data = early_memremap(pa_data, data_len);
442-
map_len = data_len;
443-
}
439+
data_type = data->type;
440+
pa_next = data->next;
441+
early_iounmap(data, map_len);
444442

445-
switch (data->type) {
443+
switch (data_type) {
446444
case SETUP_E820_EXT:
447-
parse_e820_ext(data);
445+
parse_e820_ext(pa_data, data_len);
448446
break;
449447
case SETUP_DTB:
450448
add_dtb(pa_data);
451449
break;
452450
default:
453451
break;
454452
}
455-
pa_data = data->next;
456-
early_iounmap(data, map_len);
453+
pa_data = pa_next;
457454
}
458455
}
459456

@@ -1070,7 +1067,7 @@ void __init setup_arch(char **cmdline_p)
10701067

10711068
cleanup_highmap();
10721069

1073-
memblock.current_limit = ISA_END_ADDRESS;
1070+
memblock_set_current_limit(ISA_END_ADDRESS);
10741071
memblock_x86_fill();
10751072

10761073
/*
@@ -1103,7 +1100,7 @@ void __init setup_arch(char **cmdline_p)
11031100

11041101
setup_real_mode();
11051102

1106-
memblock.current_limit = get_max_mapped();
1103+
memblock_set_current_limit(get_max_mapped());
11071104
dma_contiguous_reserve(0);
11081105

11091106
/*

arch/x86/mm/ioremap.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ __early_ioremap(resource_size_t phys_addr, unsigned long size, pgprot_t prot)
487487
unsigned long offset;
488488
resource_size_t last_addr;
489489
unsigned int nrpages;
490-
enum fixed_addresses idx0, idx;
490+
enum fixed_addresses idx;
491491
int i, slot;
492492

493493
WARN_ON(system_state != SYSTEM_BOOTING);
@@ -540,8 +540,7 @@ __early_ioremap(resource_size_t phys_addr, unsigned long size, pgprot_t prot)
540540
/*
541541
* Ok, go for it..
542542
*/
543-
idx0 = FIX_BTMAP_BEGIN - NR_FIX_BTMAPS*slot;
544-
idx = idx0;
543+
idx = FIX_BTMAP_BEGIN - NR_FIX_BTMAPS*slot;
545544
while (nrpages > 0) {
546545
early_set_fixmap(idx, phys_addr, prot);
547546
phys_addr += PAGE_SIZE;

0 commit comments

Comments
 (0)