Commit e7e2e511 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc

Pull powerpc fixes from Ben Herrenschmidt:
 "Here is not quite a handful of powerpc fixes for rc3.

  The windfarm fix is a regression fix (though not a new one), the PMU
  interrupt rename is not a fix per-se but has been submitted a long
  time ago and I kept forgetting to put it in (it puts us back in sync
  with x86), the other perf bit is just about putting an API/ABI bit
  definition in the right place for userspace to consume, and finally,
  we have a fix for the VPHN (Virtual Partition Home Node) feature
  (notification that the hypervisor is moving nodes around) which could
  cause lockups so we may as well fix it now"

* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc:
  powerpc/windfarm: Fix noisy slots-fan on Xserve (rm31)
  powerpc: VPHN topology change updates all siblings
  powerpc/perf: Export PERF_EVENT_CONFIG_EBB_SHIFT to userspace
  powerpc: Rename PMU interrupts from CNT to PMI
parents 6d039f8f fe956a1d
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <asm/hw_irq.h> #include <asm/hw_irq.h>
#include <linux/device.h> #include <linux/device.h>
#include <uapi/asm/perf_event.h>
#define MAX_HWEVENTS 8 #define MAX_HWEVENTS 8
#define MAX_EVENT_ALTERNATIVES 8 #define MAX_EVENT_ALTERNATIVES 8
...@@ -69,11 +70,6 @@ struct power_pmu { ...@@ -69,11 +70,6 @@ struct power_pmu {
#define PPMU_LIMITED_PMC_REQD 2 /* have to put this on a limited PMC */ #define PPMU_LIMITED_PMC_REQD 2 /* have to put this on a limited PMC */
#define PPMU_ONLY_COUNT_RUN 4 /* only counting in run state */ #define PPMU_ONLY_COUNT_RUN 4 /* only counting in run state */
/*
* We use the event config bit 63 as a flag to request EBB.
*/
#define EVENT_CONFIG_EBB_SHIFT 63
extern int register_power_pmu(struct power_pmu *); extern int register_power_pmu(struct power_pmu *);
struct pt_regs; struct pt_regs;
......
...@@ -145,6 +145,10 @@ extern void __cpu_die(unsigned int cpu); ...@@ -145,6 +145,10 @@ extern void __cpu_die(unsigned int cpu);
#define smp_setup_cpu_maps() #define smp_setup_cpu_maps()
static inline void inhibit_secondary_onlining(void) {} static inline void inhibit_secondary_onlining(void) {}
static inline void uninhibit_secondary_onlining(void) {} static inline void uninhibit_secondary_onlining(void) {}
static inline const struct cpumask *cpu_sibling_mask(int cpu)
{
return cpumask_of(cpu);
}
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
......
...@@ -20,6 +20,7 @@ header-y += mman.h ...@@ -20,6 +20,7 @@ header-y += mman.h
header-y += msgbuf.h header-y += msgbuf.h
header-y += nvram.h header-y += nvram.h
header-y += param.h header-y += param.h
header-y += perf_event.h
header-y += poll.h header-y += poll.h
header-y += posix_types.h header-y += posix_types.h
header-y += ps3fb.h header-y += ps3fb.h
......
/*
* Copyright 2013 Michael Ellerman, IBM Corp.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2 of the
* License.
*/
#ifndef _UAPI_ASM_POWERPC_PERF_EVENT_H
#define _UAPI_ASM_POWERPC_PERF_EVENT_H
/*
* We use bit 63 of perf_event_attr.config as a flag to request EBB.
*/
#define PERF_EVENT_CONFIG_EBB_SHIFT 63
#endif /* _UAPI_ASM_POWERPC_PERF_EVENT_H */
...@@ -362,7 +362,7 @@ int arch_show_interrupts(struct seq_file *p, int prec) ...@@ -362,7 +362,7 @@ int arch_show_interrupts(struct seq_file *p, int prec)
seq_printf(p, "%10u ", per_cpu(irq_stat, j).spurious_irqs); seq_printf(p, "%10u ", per_cpu(irq_stat, j).spurious_irqs);
seq_printf(p, " Spurious interrupts\n"); seq_printf(p, " Spurious interrupts\n");
seq_printf(p, "%*s: ", prec, "CNT"); seq_printf(p, "%*s: ", prec, "PMI");
for_each_online_cpu(j) for_each_online_cpu(j)
seq_printf(p, "%10u ", per_cpu(irq_stat, j).pmu_irqs); seq_printf(p, "%10u ", per_cpu(irq_stat, j).pmu_irqs);
seq_printf(p, " Performance monitoring interrupts\n"); seq_printf(p, " Performance monitoring interrupts\n");
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <asm/cputhreads.h>
#include <asm/sparsemem.h> #include <asm/sparsemem.h>
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/smp.h> #include <asm/smp.h>
...@@ -1318,7 +1319,8 @@ static int update_cpu_associativity_changes_mask(void) ...@@ -1318,7 +1319,8 @@ static int update_cpu_associativity_changes_mask(void)
} }
} }
if (changed) { if (changed) {
cpumask_set_cpu(cpu, changes); cpumask_or(changes, changes, cpu_sibling_mask(cpu));
cpu = cpu_last_thread_sibling(cpu);
} }
} }
...@@ -1426,7 +1428,7 @@ static int update_cpu_topology(void *data) ...@@ -1426,7 +1428,7 @@ static int update_cpu_topology(void *data)
if (!data) if (!data)
return -EINVAL; return -EINVAL;
cpu = get_cpu(); cpu = smp_processor_id();
for (update = data; update; update = update->next) { for (update = data; update; update = update->next) {
if (cpu != update->cpu) if (cpu != update->cpu)
...@@ -1446,12 +1448,12 @@ static int update_cpu_topology(void *data) ...@@ -1446,12 +1448,12 @@ static int update_cpu_topology(void *data)
*/ */
int arch_update_cpu_topology(void) int arch_update_cpu_topology(void)
{ {
unsigned int cpu, changed = 0; unsigned int cpu, sibling, changed = 0;
struct topology_update_data *updates, *ud; struct topology_update_data *updates, *ud;
unsigned int associativity[VPHN_ASSOC_BUFSIZE] = {0}; unsigned int associativity[VPHN_ASSOC_BUFSIZE] = {0};
cpumask_t updated_cpus; cpumask_t updated_cpus;
struct device *dev; struct device *dev;
int weight, i = 0; int weight, new_nid, i = 0;
weight = cpumask_weight(&cpu_associativity_changes_mask); weight = cpumask_weight(&cpu_associativity_changes_mask);
if (!weight) if (!weight)
...@@ -1464,19 +1466,46 @@ int arch_update_cpu_topology(void) ...@@ -1464,19 +1466,46 @@ int arch_update_cpu_topology(void)
cpumask_clear(&updated_cpus); cpumask_clear(&updated_cpus);
for_each_cpu(cpu, &cpu_associativity_changes_mask) { for_each_cpu(cpu, &cpu_associativity_changes_mask) {
ud = &updates[i++]; /*
ud->cpu = cpu; * If siblings aren't flagged for changes, updates list
vphn_get_associativity(cpu, associativity); * will be too short. Skip on this update and set for next
ud->new_nid = associativity_to_nid(associativity); * update.
*/
if (ud->new_nid < 0 || !node_online(ud->new_nid)) if (!cpumask_subset(cpu_sibling_mask(cpu),
ud->new_nid = first_online_node; &cpu_associativity_changes_mask)) {
pr_info("Sibling bits not set for associativity "
"change, cpu%d\n", cpu);
cpumask_or(&cpu_associativity_changes_mask,
&cpu_associativity_changes_mask,
cpu_sibling_mask(cpu));
cpu = cpu_last_thread_sibling(cpu);
continue;
}
ud->old_nid = numa_cpu_lookup_table[cpu]; /* Use associativity from first thread for all siblings */
cpumask_set_cpu(cpu, &updated_cpus); vphn_get_associativity(cpu, associativity);
new_nid = associativity_to_nid(associativity);
if (new_nid < 0 || !node_online(new_nid))
new_nid = first_online_node;
if (new_nid == numa_cpu_lookup_table[cpu]) {
cpumask_andnot(&cpu_associativity_changes_mask,
&cpu_associativity_changes_mask,
cpu_sibling_mask(cpu));
cpu = cpu_last_thread_sibling(cpu);
continue;
}
if (i < weight) for_each_cpu(sibling, cpu_sibling_mask(cpu)) {
ud->next = &updates[i]; ud = &updates[i++];
ud->cpu = sibling;
ud->new_nid = new_nid;
ud->old_nid = numa_cpu_lookup_table[sibling];
cpumask_set_cpu(sibling, &updated_cpus);
if (i < weight)
ud->next = &updates[i];
}
cpu = cpu_last_thread_sibling(cpu);
} }
stop_machine(update_cpu_topology, &updates[0], &updated_cpus); stop_machine(update_cpu_topology, &updates[0], &updated_cpus);
......
...@@ -484,7 +484,7 @@ static bool is_ebb_event(struct perf_event *event) ...@@ -484,7 +484,7 @@ static bool is_ebb_event(struct perf_event *event)
* use bit 63 of the event code for something else if they wish. * use bit 63 of the event code for something else if they wish.
*/ */
return (ppmu->flags & PPMU_EBB) && return (ppmu->flags & PPMU_EBB) &&
((event->attr.config >> EVENT_CONFIG_EBB_SHIFT) & 1); ((event->attr.config >> PERF_EVENT_CONFIG_EBB_SHIFT) & 1);
} }
static int ebb_event_check(struct perf_event *event) static int ebb_event_check(struct perf_event *event)
......
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
(EVENT_UNIT_MASK << EVENT_UNIT_SHIFT) | \ (EVENT_UNIT_MASK << EVENT_UNIT_SHIFT) | \
(EVENT_COMBINE_MASK << EVENT_COMBINE_SHIFT) | \ (EVENT_COMBINE_MASK << EVENT_COMBINE_SHIFT) | \
(EVENT_MARKED_MASK << EVENT_MARKED_SHIFT) | \ (EVENT_MARKED_MASK << EVENT_MARKED_SHIFT) | \
(EVENT_EBB_MASK << EVENT_CONFIG_EBB_SHIFT) | \ (EVENT_EBB_MASK << PERF_EVENT_CONFIG_EBB_SHIFT) | \
EVENT_PSEL_MASK) EVENT_PSEL_MASK)
/* MMCRA IFM bits - POWER8 */ /* MMCRA IFM bits - POWER8 */
...@@ -233,10 +233,10 @@ static int power8_get_constraint(u64 event, unsigned long *maskp, unsigned long ...@@ -233,10 +233,10 @@ static int power8_get_constraint(u64 event, unsigned long *maskp, unsigned long
pmc = (event >> EVENT_PMC_SHIFT) & EVENT_PMC_MASK; pmc = (event >> EVENT_PMC_SHIFT) & EVENT_PMC_MASK;
unit = (event >> EVENT_UNIT_SHIFT) & EVENT_UNIT_MASK; unit = (event >> EVENT_UNIT_SHIFT) & EVENT_UNIT_MASK;
cache = (event >> EVENT_CACHE_SEL_SHIFT) & EVENT_CACHE_SEL_MASK; cache = (event >> EVENT_CACHE_SEL_SHIFT) & EVENT_CACHE_SEL_MASK;
ebb = (event >> EVENT_CONFIG_EBB_SHIFT) & EVENT_EBB_MASK; ebb = (event >> PERF_EVENT_CONFIG_EBB_SHIFT) & EVENT_EBB_MASK;
/* Clear the EBB bit in the event, so event checks work below */ /* Clear the EBB bit in the event, so event checks work below */
event &= ~(EVENT_EBB_MASK << EVENT_CONFIG_EBB_SHIFT); event &= ~(EVENT_EBB_MASK << PERF_EVENT_CONFIG_EBB_SHIFT);
if (pmc) { if (pmc) {
if (pmc > 6) if (pmc > 6)
......
...@@ -439,15 +439,15 @@ static void backside_setup_pid(void) ...@@ -439,15 +439,15 @@ static void backside_setup_pid(void)
/* Slots fan */ /* Slots fan */
static const struct wf_pid_param slots_param = { static const struct wf_pid_param slots_param = {
.interval = 5, .interval = 1,
.history_len = 2, .history_len = 20,
.gd = 30 << 20, .gd = 0,
.gp = 5 << 20, .gp = 0,
.gr = 0, .gr = 0x00100000,
.itarget = 40 << 16, .itarget = 3200000,
.additive = 1, .additive = 0,
.min = 300, .min = 20,
.max = 4000, .max = 100,
}; };
static void slots_fan_tick(void) static void slots_fan_tick(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment