Merge tag 'v3.15-rc1' into perf/urgent
Pick up the latest fixes. Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
@@ -274,10 +274,6 @@ static void intel_workarounds(struct cpuinfo_x86 *c)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_X86_NUMAQ
|
||||
numaq_tsc_disable();
|
||||
#endif
|
||||
|
||||
intel_smp_check(c);
|
||||
}
|
||||
#else
|
||||
|
@@ -1225,21 +1225,24 @@ static struct notifier_block cacheinfo_cpu_notifier = {
|
||||
|
||||
static int __init cache_sysfs_init(void)
|
||||
{
|
||||
int i;
|
||||
int i, err = 0;
|
||||
|
||||
if (num_cache_leaves == 0)
|
||||
return 0;
|
||||
|
||||
cpu_notifier_register_begin();
|
||||
for_each_online_cpu(i) {
|
||||
int err;
|
||||
struct device *dev = get_cpu_device(i);
|
||||
|
||||
err = cache_add_dev(dev);
|
||||
if (err)
|
||||
return err;
|
||||
goto out;
|
||||
}
|
||||
register_hotcpu_notifier(&cacheinfo_cpu_notifier);
|
||||
return 0;
|
||||
__register_hotcpu_notifier(&cacheinfo_cpu_notifier);
|
||||
|
||||
out:
|
||||
cpu_notifier_register_done();
|
||||
return err;
|
||||
}
|
||||
|
||||
device_initcall(cache_sysfs_init);
|
||||
|
@@ -47,45 +47,3 @@ const struct x86_cpu_id *x86_match_cpu(const struct x86_cpu_id *match)
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL(x86_match_cpu);
|
||||
|
||||
ssize_t arch_print_cpu_modalias(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *bufptr)
|
||||
{
|
||||
int size = PAGE_SIZE;
|
||||
int i, n;
|
||||
char *buf = bufptr;
|
||||
|
||||
n = snprintf(buf, size, "x86cpu:vendor:%04X:family:%04X:"
|
||||
"model:%04X:feature:",
|
||||
boot_cpu_data.x86_vendor,
|
||||
boot_cpu_data.x86,
|
||||
boot_cpu_data.x86_model);
|
||||
size -= n;
|
||||
buf += n;
|
||||
size -= 1;
|
||||
for (i = 0; i < NCAPINTS*32; i++) {
|
||||
if (boot_cpu_has(i)) {
|
||||
n = snprintf(buf, size, ",%04X", i);
|
||||
if (n >= size) {
|
||||
WARN(1, "x86 features overflow page\n");
|
||||
break;
|
||||
}
|
||||
size -= n;
|
||||
buf += n;
|
||||
}
|
||||
}
|
||||
*buf++ = '\n';
|
||||
return buf - bufptr;
|
||||
}
|
||||
|
||||
int arch_cpu_uevent(struct device *dev, struct kobj_uevent_env *env)
|
||||
{
|
||||
char *buf = kzalloc(PAGE_SIZE, GFP_KERNEL);
|
||||
if (buf) {
|
||||
arch_print_cpu_modalias(NULL, NULL, buf);
|
||||
add_uevent_var(env, "MODALIAS=%s", buf);
|
||||
kfree(buf);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@@ -89,6 +89,9 @@ static DECLARE_WAIT_QUEUE_HEAD(mce_chrdev_wait);
|
||||
static DEFINE_PER_CPU(struct mce, mces_seen);
|
||||
static int cpu_missing;
|
||||
|
||||
/* CMCI storm detection filter */
|
||||
static DEFINE_PER_CPU(unsigned long, mce_polled_error);
|
||||
|
||||
/*
|
||||
* MCA banks polled by the period polling timer for corrected events.
|
||||
* With Intel CMCI, this only has MCA banks which do not support CMCI (if any).
|
||||
@@ -595,6 +598,7 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b)
|
||||
{
|
||||
struct mce m;
|
||||
int i;
|
||||
unsigned long *v;
|
||||
|
||||
this_cpu_inc(mce_poll_count);
|
||||
|
||||
@@ -614,6 +618,8 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b)
|
||||
if (!(m.status & MCI_STATUS_VAL))
|
||||
continue;
|
||||
|
||||
v = &get_cpu_var(mce_polled_error);
|
||||
set_bit(0, v);
|
||||
/*
|
||||
* Uncorrected or signalled events are handled by the exception
|
||||
* handler when it is enabled, so don't process those here.
|
||||
@@ -1278,10 +1284,18 @@ static unsigned long mce_adjust_timer_default(unsigned long interval)
|
||||
static unsigned long (*mce_adjust_timer)(unsigned long interval) =
|
||||
mce_adjust_timer_default;
|
||||
|
||||
static int cmc_error_seen(void)
|
||||
{
|
||||
unsigned long *v = &__get_cpu_var(mce_polled_error);
|
||||
|
||||
return test_and_clear_bit(0, v);
|
||||
}
|
||||
|
||||
static void mce_timer_fn(unsigned long data)
|
||||
{
|
||||
struct timer_list *t = &__get_cpu_var(mce_timer);
|
||||
unsigned long iv;
|
||||
int notify;
|
||||
|
||||
WARN_ON(smp_processor_id() != data);
|
||||
|
||||
@@ -1296,7 +1310,9 @@ static void mce_timer_fn(unsigned long data)
|
||||
* polling interval, otherwise increase the polling interval.
|
||||
*/
|
||||
iv = __this_cpu_read(mce_next_interval);
|
||||
if (mce_notify_irq()) {
|
||||
notify = mce_notify_irq();
|
||||
notify |= cmc_error_seen();
|
||||
if (notify) {
|
||||
iv = max(iv / 2, (unsigned long) HZ/100);
|
||||
} else {
|
||||
iv = min(iv * 2, round_jiffies_relative(check_interval * HZ));
|
||||
@@ -2434,14 +2450,18 @@ static __init int mcheck_init_device(void)
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
cpu_notifier_register_begin();
|
||||
for_each_online_cpu(i) {
|
||||
err = mce_device_create(i);
|
||||
if (err)
|
||||
if (err) {
|
||||
cpu_notifier_register_done();
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
register_syscore_ops(&mce_syscore_ops);
|
||||
register_hotcpu_notifier(&mce_cpu_notifier);
|
||||
__register_hotcpu_notifier(&mce_cpu_notifier);
|
||||
cpu_notifier_register_done();
|
||||
|
||||
/* register character device /dev/mcelog */
|
||||
misc_register(&mce_chrdev_device);
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/percpu.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/cpumask.h>
|
||||
#include <asm/apic.h>
|
||||
#include <asm/processor.h>
|
||||
#include <asm/msr.h>
|
||||
@@ -137,6 +138,22 @@ unsigned long mce_intel_adjust_timer(unsigned long interval)
|
||||
}
|
||||
}
|
||||
|
||||
static void cmci_storm_disable_banks(void)
|
||||
{
|
||||
unsigned long flags, *owned;
|
||||
int bank;
|
||||
u64 val;
|
||||
|
||||
raw_spin_lock_irqsave(&cmci_discover_lock, flags);
|
||||
owned = __get_cpu_var(mce_banks_owned);
|
||||
for_each_set_bit(bank, owned, MAX_NR_BANKS) {
|
||||
rdmsrl(MSR_IA32_MCx_CTL2(bank), val);
|
||||
val &= ~MCI_CTL2_CMCI_EN;
|
||||
wrmsrl(MSR_IA32_MCx_CTL2(bank), val);
|
||||
}
|
||||
raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
|
||||
}
|
||||
|
||||
static bool cmci_storm_detect(void)
|
||||
{
|
||||
unsigned int cnt = __this_cpu_read(cmci_storm_cnt);
|
||||
@@ -158,7 +175,7 @@ static bool cmci_storm_detect(void)
|
||||
if (cnt <= CMCI_STORM_THRESHOLD)
|
||||
return false;
|
||||
|
||||
cmci_clear();
|
||||
cmci_storm_disable_banks();
|
||||
__this_cpu_write(cmci_storm_state, CMCI_STORM_ACTIVE);
|
||||
r = atomic_add_return(1, &cmci_storm_on_cpus);
|
||||
mce_timer_kick(CMCI_POLL_INTERVAL);
|
||||
|
@@ -271,9 +271,6 @@ static void thermal_throttle_remove_dev(struct device *dev)
|
||||
sysfs_remove_group(&dev->kobj, &thermal_attr_group);
|
||||
}
|
||||
|
||||
/* Mutex protecting device creation against CPU hotplug: */
|
||||
static DEFINE_MUTEX(therm_cpu_lock);
|
||||
|
||||
/* Get notified when a cpu comes on/off. Be hotplug friendly. */
|
||||
static int
|
||||
thermal_throttle_cpu_callback(struct notifier_block *nfb,
|
||||
@@ -289,18 +286,14 @@ thermal_throttle_cpu_callback(struct notifier_block *nfb,
|
||||
switch (action) {
|
||||
case CPU_UP_PREPARE:
|
||||
case CPU_UP_PREPARE_FROZEN:
|
||||
mutex_lock(&therm_cpu_lock);
|
||||
err = thermal_throttle_add_dev(dev, cpu);
|
||||
mutex_unlock(&therm_cpu_lock);
|
||||
WARN_ON(err);
|
||||
break;
|
||||
case CPU_UP_CANCELED:
|
||||
case CPU_UP_CANCELED_FROZEN:
|
||||
case CPU_DEAD:
|
||||
case CPU_DEAD_FROZEN:
|
||||
mutex_lock(&therm_cpu_lock);
|
||||
thermal_throttle_remove_dev(dev);
|
||||
mutex_unlock(&therm_cpu_lock);
|
||||
break;
|
||||
}
|
||||
return notifier_from_errno(err);
|
||||
@@ -319,19 +312,16 @@ static __init int thermal_throttle_init_device(void)
|
||||
if (!atomic_read(&therm_throt_en))
|
||||
return 0;
|
||||
|
||||
register_hotcpu_notifier(&thermal_throttle_cpu_notifier);
|
||||
cpu_notifier_register_begin();
|
||||
|
||||
#ifdef CONFIG_HOTPLUG_CPU
|
||||
mutex_lock(&therm_cpu_lock);
|
||||
#endif
|
||||
/* connect live CPUs to sysfs */
|
||||
for_each_online_cpu(cpu) {
|
||||
err = thermal_throttle_add_dev(get_cpu_device(cpu), cpu);
|
||||
WARN_ON(err);
|
||||
}
|
||||
#ifdef CONFIG_HOTPLUG_CPU
|
||||
mutex_unlock(&therm_cpu_lock);
|
||||
#endif
|
||||
|
||||
__register_hotcpu_notifier(&thermal_throttle_cpu_notifier);
|
||||
cpu_notifier_register_done();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -926,13 +926,13 @@ static __init int amd_ibs_init(void)
|
||||
goto out;
|
||||
|
||||
perf_ibs_pm_init();
|
||||
get_online_cpus();
|
||||
cpu_notifier_register_begin();
|
||||
ibs_caps = caps;
|
||||
/* make ibs_caps visible to other cpus: */
|
||||
smp_mb();
|
||||
perf_cpu_notifier(perf_ibs_cpu_notifier);
|
||||
smp_call_function(setup_APIC_ibs, NULL, 1);
|
||||
put_online_cpus();
|
||||
__perf_cpu_notifier(perf_ibs_cpu_notifier);
|
||||
cpu_notifier_register_done();
|
||||
|
||||
ret = perf_event_ibs_init();
|
||||
out:
|
||||
|
@@ -531,15 +531,16 @@ static int __init amd_uncore_init(void)
|
||||
if (ret)
|
||||
return -ENODEV;
|
||||
|
||||
get_online_cpus();
|
||||
cpu_notifier_register_begin();
|
||||
|
||||
/* init cpus already online before registering for hotplug notifier */
|
||||
for_each_online_cpu(cpu) {
|
||||
amd_uncore_cpu_up_prepare(cpu);
|
||||
smp_call_function_single(cpu, init_cpu_already_online, NULL, 1);
|
||||
}
|
||||
|
||||
register_cpu_notifier(&amd_uncore_cpu_notifier_block);
|
||||
put_online_cpus();
|
||||
__register_cpu_notifier(&amd_uncore_cpu_notifier_block);
|
||||
cpu_notifier_register_done();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -673,19 +673,20 @@ static int __init rapl_pmu_init(void)
|
||||
/* unsupported */
|
||||
return 0;
|
||||
}
|
||||
get_online_cpus();
|
||||
|
||||
cpu_notifier_register_begin();
|
||||
|
||||
for_each_online_cpu(cpu) {
|
||||
rapl_cpu_prepare(cpu);
|
||||
rapl_cpu_init(cpu);
|
||||
}
|
||||
|
||||
perf_cpu_notifier(rapl_cpu_notifier);
|
||||
__perf_cpu_notifier(rapl_cpu_notifier);
|
||||
|
||||
ret = perf_pmu_register(&rapl_pmu_class, "power", -1);
|
||||
if (WARN_ON(ret)) {
|
||||
pr_info("RAPL PMU detected, registration failed (%d), RAPL PMU disabled\n", ret);
|
||||
put_online_cpus();
|
||||
cpu_notifier_register_done();
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -699,7 +700,7 @@ static int __init rapl_pmu_init(void)
|
||||
hweight32(rapl_cntr_mask),
|
||||
ktime_to_ms(pmu->timer_interval));
|
||||
|
||||
put_online_cpus();
|
||||
cpu_notifier_register_done();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@@ -4244,7 +4244,7 @@ static void __init uncore_cpumask_init(void)
|
||||
if (!cpumask_empty(&uncore_cpu_mask))
|
||||
return;
|
||||
|
||||
get_online_cpus();
|
||||
cpu_notifier_register_begin();
|
||||
|
||||
for_each_online_cpu(cpu) {
|
||||
int i, phys_id = topology_physical_package_id(cpu);
|
||||
@@ -4263,9 +4263,9 @@ static void __init uncore_cpumask_init(void)
|
||||
}
|
||||
on_each_cpu(uncore_cpu_setup, NULL, 1);
|
||||
|
||||
register_cpu_notifier(&uncore_cpu_nb);
|
||||
__register_cpu_notifier(&uncore_cpu_nb);
|
||||
|
||||
put_online_cpus();
|
||||
cpu_notifier_register_done();
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user