Skip to content

Commit 8816ead

Browse files
committed
Merge branches 'perf-urgent-for-linus', 'sched-urgent-for-linus', 'timers-urgent-for-linus' and 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: tools/perf: Fix static build of perf tool tracing: Fix regression in printk_formats file * 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: generic-ipi: Fix kexec boot crash by initializing call_single_queue before enabling interrupts * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: clocksource: Make watchdog robust vs. interruption timerfd: Fix wakeup of processes when timer is cancelled on clock change * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: x86, MAINTAINERS: Add x86 MCE people x86, efi: Do not reserve boot services regions within reserved areas
5 parents 357ed6b + 203db29 + d8ad7d1 + b519951 + c1f5c54 commit 8816ead

File tree

12 files changed

+61
-29
lines changed

12 files changed

+61
-29
lines changed

MAINTAINERS

+7
Original file line numberDiff line numberDiff line change
@@ -7007,6 +7007,13 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/mjg59/platform-drivers-x86.
70077007
S: Maintained
70087008
F: drivers/platform/x86
70097009

7010+
X86 MCE INFRASTRUCTURE
7011+
M: Tony Luck <[email protected]>
7012+
M: Borislav Petkov <[email protected]>
7013+
7014+
S: Maintained
7015+
F: arch/x86/kernel/cpu/mcheck/*
7016+
70107017
XEN HYPERVISOR INTERFACE
70117018
M: Jeremy Fitzhardinge <[email protected]>
70127019
M: Konrad Rzeszutek Wilk <[email protected]>

arch/x86/include/asm/memblock.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#define ARCH_DISCARD_MEMBLOCK
55

66
u64 memblock_x86_find_in_range_size(u64 start, u64 *sizep, u64 align);
7-
void memblock_x86_to_bootmem(u64 start, u64 end);
87

98
void memblock_x86_reserve_range(u64 start, u64 end, char *name);
109
void memblock_x86_free_range(u64 start, u64 end);
@@ -19,5 +18,6 @@ u64 memblock_x86_hole_size(u64 start, u64 end);
1918
u64 memblock_x86_find_in_range_node(int nid, u64 start, u64 end, u64 size, u64 align);
2019
u64 memblock_x86_free_memory_in_range(u64 addr, u64 limit);
2120
u64 memblock_x86_memory_in_range(u64 addr, u64 limit);
21+
bool memblock_x86_check_reserved_size(u64 *addrp, u64 *sizep, u64 align);
2222

2323
#endif

arch/x86/mm/memblock.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <linux/range.h>
99

1010
/* Check for already reserved areas */
11-
static bool __init check_with_memblock_reserved_size(u64 *addrp, u64 *sizep, u64 align)
11+
bool __init memblock_x86_check_reserved_size(u64 *addrp, u64 *sizep, u64 align)
1212
{
1313
struct memblock_region *r;
1414
u64 addr = *addrp, last;
@@ -59,7 +59,7 @@ u64 __init memblock_x86_find_in_range_size(u64 start, u64 *sizep, u64 align)
5959
if (addr >= ei_last)
6060
continue;
6161
*sizep = ei_last - addr;
62-
while (check_with_memblock_reserved_size(&addr, sizep, align))
62+
while (memblock_x86_check_reserved_size(&addr, sizep, align))
6363
;
6464

6565
if (*sizep)

arch/x86/platform/efi/efi.c

+25-4
Original file line numberDiff line numberDiff line change
@@ -310,14 +310,31 @@ void __init efi_reserve_boot_services(void)
310310

311311
for (p = memmap.map; p < memmap.map_end; p += memmap.desc_size) {
312312
efi_memory_desc_t *md = p;
313-
unsigned long long start = md->phys_addr;
314-
unsigned long long size = md->num_pages << EFI_PAGE_SHIFT;
313+
u64 start = md->phys_addr;
314+
u64 size = md->num_pages << EFI_PAGE_SHIFT;
315315

316316
if (md->type != EFI_BOOT_SERVICES_CODE &&
317317
md->type != EFI_BOOT_SERVICES_DATA)
318318
continue;
319-
320-
memblock_x86_reserve_range(start, start + size, "EFI Boot");
319+
/* Only reserve where possible:
320+
* - Not within any already allocated areas
321+
* - Not over any memory area (really needed, if above?)
322+
* - Not within any part of the kernel
323+
* - Not the bios reserved area
324+
*/
325+
if ((start+size >= virt_to_phys(_text)
326+
&& start <= virt_to_phys(_end)) ||
327+
!e820_all_mapped(start, start+size, E820_RAM) ||
328+
memblock_x86_check_reserved_size(&start, &size,
329+
1<<EFI_PAGE_SHIFT)) {
330+
/* Could not reserve, skip it */
331+
md->num_pages = 0;
332+
memblock_dbg(PFX "Could not reserve boot range "
333+
"[0x%010llx-0x%010llx]\n",
334+
start, start+size-1);
335+
} else
336+
memblock_x86_reserve_range(start, start+size,
337+
"EFI Boot");
321338
}
322339
}
323340

@@ -334,6 +351,10 @@ static void __init efi_free_boot_services(void)
334351
md->type != EFI_BOOT_SERVICES_DATA)
335352
continue;
336353

354+
/* Could not reserve boot area */
355+
if (!size)
356+
continue;
357+
337358
free_bootmem_late(start, size);
338359
}
339360
}

fs/timerfd.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ static enum hrtimer_restart timerfd_tmrproc(struct hrtimer *htmr)
6161

6262
/*
6363
* Called when the clock was set to cancel the timers in the cancel
64-
* list.
64+
* list. This will wake up processes waiting on these timers. The
65+
* wake-up requires ctx->ticks to be non zero, therefore we increment
66+
* it before calling wake_up_locked().
6567
*/
6668
void timerfd_clock_was_set(void)
6769
{
@@ -76,6 +78,7 @@ void timerfd_clock_was_set(void)
7678
spin_lock_irqsave(&ctx->wqh.lock, flags);
7779
if (ctx->moffs.tv64 != moffs.tv64) {
7880
ctx->moffs.tv64 = KTIME_MAX;
81+
ctx->ticks++;
7982
wake_up_locked(&ctx->wqh);
8083
}
8184
spin_unlock_irqrestore(&ctx->wqh.lock, flags);

include/linux/clocksource.h

+1
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ struct clocksource {
188188
#ifdef CONFIG_CLOCKSOURCE_WATCHDOG
189189
/* Watchdog related data, used by the framework */
190190
struct list_head wd_list;
191+
cycle_t cs_last;
191192
cycle_t wd_last;
192193
#endif
193194
} ____cacheline_aligned;

include/linux/smp.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,15 @@ int smp_call_function_any(const struct cpumask *mask,
8585
* Generic and arch helpers
8686
*/
8787
#ifdef CONFIG_USE_GENERIC_SMP_HELPERS
88+
void __init call_function_init(void);
8889
void generic_smp_call_function_single_interrupt(void);
8990
void generic_smp_call_function_interrupt(void);
9091
void ipi_call_lock(void);
9192
void ipi_call_unlock(void);
9293
void ipi_call_lock_irq(void);
9394
void ipi_call_unlock_irq(void);
95+
#else
96+
static inline void call_function_init(void) { }
9497
#endif
9598

9699
/*
@@ -134,7 +137,7 @@ static inline void smp_send_reschedule(int cpu) { }
134137
#define smp_prepare_boot_cpu() do {} while (0)
135138
#define smp_call_function_many(mask, func, info, wait) \
136139
(up_smp_call_function(func, info))
137-
static inline void init_call_single_data(void) { }
140+
static inline void call_function_init(void) { }
138141

139142
static inline int
140143
smp_call_function_any(const struct cpumask *mask, smp_call_func_t func,

init/main.c

+1
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,7 @@ asmlinkage void __init start_kernel(void)
542542
timekeeping_init();
543543
time_init();
544544
profile_init();
545+
call_function_init();
545546
if (!irqs_disabled())
546547
printk(KERN_CRIT "start_kernel(): bug: interrupts were "
547548
"enabled early\n");

kernel/smp.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static struct notifier_block __cpuinitdata hotplug_cfd_notifier = {
7474
.notifier_call = hotplug_cfd,
7575
};
7676

77-
static int __cpuinit init_call_single_data(void)
77+
void __init call_function_init(void)
7878
{
7979
void *cpu = (void *)(long)smp_processor_id();
8080
int i;
@@ -88,10 +88,7 @@ static int __cpuinit init_call_single_data(void)
8888

8989
hotplug_cfd(&hotplug_cfd_notifier, CPU_UP_PREPARE, cpu);
9090
register_cpu_notifier(&hotplug_cfd_notifier);
91-
92-
return 0;
9391
}
94-
early_initcall(init_call_single_data);
9592

9693
/*
9794
* csd_lock/csd_unlock used to serialize access to per-cpu csd resources

kernel/time/clocksource.c

+13-11
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ static struct clocksource *watchdog;
185185
static struct timer_list watchdog_timer;
186186
static DECLARE_WORK(watchdog_work, clocksource_watchdog_work);
187187
static DEFINE_SPINLOCK(watchdog_lock);
188-
static cycle_t watchdog_last;
189188
static int watchdog_running;
190189

191190
static int clocksource_watchdog_kthread(void *data);
@@ -254,11 +253,6 @@ static void clocksource_watchdog(unsigned long data)
254253
if (!watchdog_running)
255254
goto out;
256255

257-
wdnow = watchdog->read(watchdog);
258-
wd_nsec = clocksource_cyc2ns((wdnow - watchdog_last) & watchdog->mask,
259-
watchdog->mult, watchdog->shift);
260-
watchdog_last = wdnow;
261-
262256
list_for_each_entry(cs, &watchdog_list, wd_list) {
263257

264258
/* Clocksource already marked unstable? */
@@ -268,19 +262,28 @@ static void clocksource_watchdog(unsigned long data)
268262
continue;
269263
}
270264

265+
local_irq_disable();
271266
csnow = cs->read(cs);
267+
wdnow = watchdog->read(watchdog);
268+
local_irq_enable();
272269

273270
/* Clocksource initialized ? */
274271
if (!(cs->flags & CLOCK_SOURCE_WATCHDOG)) {
275272
cs->flags |= CLOCK_SOURCE_WATCHDOG;
276-
cs->wd_last = csnow;
273+
cs->wd_last = wdnow;
274+
cs->cs_last = csnow;
277275
continue;
278276
}
279277

280-
/* Check the deviation from the watchdog clocksource. */
281-
cs_nsec = clocksource_cyc2ns((csnow - cs->wd_last) &
278+
wd_nsec = clocksource_cyc2ns((wdnow - cs->wd_last) & watchdog->mask,
279+
watchdog->mult, watchdog->shift);
280+
281+
cs_nsec = clocksource_cyc2ns((csnow - cs->cs_last) &
282282
cs->mask, cs->mult, cs->shift);
283-
cs->wd_last = csnow;
283+
cs->cs_last = csnow;
284+
cs->wd_last = wdnow;
285+
286+
/* Check the deviation from the watchdog clocksource. */
284287
if (abs(cs_nsec - wd_nsec) > WATCHDOG_THRESHOLD) {
285288
clocksource_unstable(cs, cs_nsec - wd_nsec);
286289
continue;
@@ -318,7 +321,6 @@ static inline void clocksource_start_watchdog(void)
318321
return;
319322
init_timer(&watchdog_timer);
320323
watchdog_timer.function = clocksource_watchdog;
321-
watchdog_last = watchdog->read(watchdog);
322324
watchdog_timer.expires = jiffies + WATCHDOG_INTERVAL;
323325
add_timer_on(&watchdog_timer, cpumask_first(cpu_online_mask));
324326
watchdog_running = 1;

kernel/trace/trace_printk.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,10 @@ static const char **find_next(void *v, loff_t *pos)
240240
const char **fmt = v;
241241
int start_index;
242242

243-
if (!fmt)
244-
fmt = __start___trace_bprintk_fmt + *pos;
245-
246243
start_index = __stop___trace_bprintk_fmt - __start___trace_bprintk_fmt;
247244

248245
if (*pos < start_index)
249-
return fmt;
246+
return __start___trace_bprintk_fmt + *pos;
250247

251248
return find_next_mod_format(start_index, v, fmt, pos);
252249
}

tools/perf/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ prefix_SQ = $(subst ','\'',$(prefix))
633633

634634
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
635635

636-
LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive $(EXTLIBS)
636+
LIBS = -Wl,--whole-archive $(PERFLIBS) -Wl,--no-whole-archive -Wl,--start-group $(EXTLIBS) -Wl,--end-group
637637

638638
ALL_CFLAGS += $(BASIC_CFLAGS)
639639
ALL_CFLAGS += $(ARCH_CFLAGS)

0 commit comments

Comments
 (0)