* Re: [PATCH 4/4] perf: Create a sysfs entry for Power event format
From: Jiri Olsa @ 2012-11-14 10:27 UTC (permalink / raw)
To: Sukadev Bhattiprolu
Cc: Peter Zijlstra, robert.richter, Anton Blanchard, linux-kernel,
linuxppc-dev, Ingo Molnar, Paul Mackerras,
Arnaldo Carvalho de Melo
In-Reply-To: <20121107191951.GD16211@us.ibm.com>
On Wed, Nov 07, 2012 at 11:19:52AM -0800, Sukadev Bhattiprolu wrote:
>
> From bafc551c31ce23c1cba0b75d23de6c46aba90f26 Mon Sep 17 00:00:00 2001
> From: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
> Date: Tue, 6 Nov 2012 16:30:28 -0800
> Subject: [PATCH 4/4] perf: Create a sysfs entry for Power event format
>
> Create a sysfs entry, '/sys/bus/event_source/devices/cpu/format/event'
> which describes the format of a POWER cpu.
>
> $ cat /sys/bus/event_source/devices/cpu/format/event
> config:0-20
>
> The format of the event is the same for all POWER cpus, so bulk of this
> change is in the code common to POWER cpus.
>
> Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
> ---
> arch/powerpc/include/asm/perf_event_server.h | 8 ++++++++
> arch/powerpc/perf/core-book3s.c | 19 +++++++++++++++++++
> arch/powerpc/perf/power7-pmu.c | 1 +
> 3 files changed, 28 insertions(+), 0 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/perf_event_server.h b/arch/powerpc/include/asm/perf_event_server.h
> index ad84f73..20a49bf 100644
> --- a/arch/powerpc/include/asm/perf_event_server.h
> +++ b/arch/powerpc/include/asm/perf_event_server.h
> @@ -130,3 +130,11 @@ extern ssize_t power_events_sysfs_show(struct device *dev,
> .attr = __ATTR(_name, 0444, power_events_sysfs_show, NULL),\
> .id = PM_##_id, \
> };
> +
> +/*
> + * Format of a perf event is the same on all POWER cpus. Declare a
> + * common sysfs attribute group that individual POWER cpus can share.
> + */
> +extern struct attribute_group power_pmu_format_group;
> +
> +
> diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
> index 19b23bd..388e2a1 100644
> --- a/arch/powerpc/perf/core-book3s.c
> +++ b/arch/powerpc/perf/core-book3s.c
> @@ -1315,6 +1315,25 @@ ssize_t power_events_sysfs_show(struct device *dev,
> return sprintf(page, "event=0x%02llx\n", pmu_attr->id);
> }
>
> +static ssize_t power_config_sysfs_show(struct device *dev,
> + struct device_attribute *attr, char *page)
> +{
> + return sprintf(page, "config:0-20\n");
> +}
> +
> +static struct device_attribute config_dev_attr = \
> + __ATTR(event, 0444, power_config_sysfs_show, NULL);
there's PMU_FORMAT_ATTR in include/linux/perf_event.h macro doing this
jirka
^ permalink raw reply
* Re: [PATCH] cpuidle: Measure idle state durations with monotonic clock
From: Daniel Lezcano @ 2012-11-14 10:57 UTC (permalink / raw)
To: Deepthi Dharwar
Cc: Kevin Hilman, Trinabh Gupta, linux-pm, linux-kernel,
Rafael J. Wysocki, linux-acpi, Srivatsa S. Bhat, Julius Werner,
Andrew Morton, linuxppc-dev, Sameer Nanda, Len Brown
In-Reply-To: <50A35F21.9040003@linux.vnet.ibm.com>
On 11/14/2012 10:06 AM, Deepthi Dharwar wrote:
> On 11/14/2012 03:22 AM, Julius Werner wrote:
>> Many cpuidle drivers measure their time spent in an idle state by
>> reading the wallclock time before and after idling and calculating the
>> difference. This leads to erroneous results when the wallclock time gets
>> updated by another processor in the meantime, adding that clock
>> adjustment to the idle state's time counter.
>>
>> If the clock adjustment was negative, the result is even worse due to an
>> erroneous cast from int to unsigned long long of the last_residency
>> variable. The negative 32 bit integer will zero-extend and result in a
>> forward time jump of roughly four billion milliseconds or 1.3 hours on
>> the idle state residency counter.
>>
>> This patch changes all affected cpuidle drivers to use the monotonic
>> clock for their measurements instead. It also removes the erroneous
>> cast, making sure that negative residency values are applied correctly
>> even though they should not appear anymore.
>
> Currently tegra/cpuidle uses ktime_get(). Good to have it for all
> the other arch idle residency time logging too.
Actually it is used by all arm cpuidle drivers through the wrapper
"cpuidle_wrap_enter" and the en_core_tk_irqen flag.
> Tested patch on pseries.
>
> Reviewed-by: Deepthi Dharwar <deepthi@linux.vnet.ibm.com>
>
> Cheers,
> Deepthi
>
>>
>> Signed-off-by: Julius Werner <jwerner@chromium.org>
>> ---
>> arch/powerpc/platforms/pseries/processor_idle.c | 4 ++--
>> drivers/acpi/processor_idle.c | 12 ++++++------
>> drivers/cpuidle/cpuidle.c | 3 +--
>> drivers/idle/intel_idle.c | 13 ++++---------
>> 4 files changed, 13 insertions(+), 19 deletions(-)
>>
>> diff --git a/arch/powerpc/platforms/pseries/processor_idle.c b/arch/powerpc/platforms/pseries/processor_idle.c
>> index 45d00e5..4d806b4 100644
>> --- a/arch/powerpc/platforms/pseries/processor_idle.c
>> +++ b/arch/powerpc/platforms/pseries/processor_idle.c
>> @@ -36,7 +36,7 @@ static struct cpuidle_state *cpuidle_state_table;
>> static inline void idle_loop_prolog(unsigned long *in_purr, ktime_t *kt_before)
>> {
>>
>> - *kt_before = ktime_get_real();
>> + *kt_before = ktime_get();
>> *in_purr = mfspr(SPRN_PURR);
>> /*
>> * Indicate to the HV that we are idle. Now would be
>> @@ -50,7 +50,7 @@ static inline s64 idle_loop_epilog(unsigned long in_purr, ktime_t kt_before)
>> get_lppaca()->wait_state_cycles += mfspr(SPRN_PURR) - in_purr;
>> get_lppaca()->idle = 0;
>>
>> - return ktime_to_us(ktime_sub(ktime_get_real(), kt_before));
>> + return ktime_to_us(ktime_sub(ktime_get(), kt_before));
>> }
>>
>> static int snooze_loop(struct cpuidle_device *dev,
>> diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
>> index e8086c7..8c98d73 100644
>> --- a/drivers/acpi/processor_idle.c
>> +++ b/drivers/acpi/processor_idle.c
>> @@ -751,9 +751,9 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
>>
>>
>> lapic_timer_state_broadcast(pr, cx, 1);
>> - kt1 = ktime_get_real();
>> + kt1 = ktime_get();
>> acpi_idle_do_entry(cx);
>> - kt2 = ktime_get_real();
>> + kt2 = ktime_get();
>> idle_time = ktime_to_us(ktime_sub(kt2, kt1));
>>
>> /* Update device last_residency*/
>> @@ -843,11 +843,11 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
>> if (cx->type == ACPI_STATE_C3)
>> ACPI_FLUSH_CPU_CACHE();
>>
>> - kt1 = ktime_get_real();
>> + kt1 = ktime_get();
>> /* Tell the scheduler that we are going deep-idle: */
>> sched_clock_idle_sleep_event();
>> acpi_idle_do_entry(cx);
>> - kt2 = ktime_get_real();
>> + kt2 = ktime_get();
>> idle_time_ns = ktime_to_ns(ktime_sub(kt2, kt1));
>> idle_time = idle_time_ns;
>> do_div(idle_time, NSEC_PER_USEC);
>> @@ -934,7 +934,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
>> */
>> lapic_timer_state_broadcast(pr, cx, 1);
>>
>> - kt1 = ktime_get_real();
>> + kt1 = ktime_get();
>> /*
>> * disable bus master
>> * bm_check implies we need ARB_DIS
>> @@ -965,7 +965,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
>> c3_cpu_count--;
>> raw_spin_unlock(&c3_lock);
>> }
>> - kt2 = ktime_get_real();
>> + kt2 = ktime_get();
>> idle_time_ns = ktime_to_ns(ktime_sub(kt2, kt1));
>> idle_time = idle_time_ns;
>> do_div(idle_time, NSEC_PER_USEC);
>> diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
>> index 7f15b85..1536edd 100644
>> --- a/drivers/cpuidle/cpuidle.c
>> +++ b/drivers/cpuidle/cpuidle.c
>> @@ -109,8 +109,7 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv,
>> /* This can be moved to within driver enter routine
>> * but that results in multiple copies of same code.
>> */
>> - dev->states_usage[entered_state].time +=
>> - (unsigned long long)dev->last_residency;
>> + dev->states_usage[entered_state].time += dev->last_residency;
>> dev->states_usage[entered_state].usage++;
>> } else {
>> dev->last_residency = 0;
>> diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
>> index b0f6b4c..6329a97 100644
>> --- a/drivers/idle/intel_idle.c
>> +++ b/drivers/idle/intel_idle.c
>> @@ -56,7 +56,7 @@
>> #include <linux/kernel.h>
>> #include <linux/cpuidle.h>
>> #include <linux/clockchips.h>
>> -#include <linux/hrtimer.h> /* ktime_get_real() */
>> +#include <linux/hrtimer.h> /* ktime_get() */
>> #include <trace/events/power.h>
>> #include <linux/sched.h>
>> #include <linux/notifier.h>
>> @@ -281,8 +281,7 @@ static int intel_idle(struct cpuidle_device *dev,
>> struct cpuidle_state_usage *state_usage = &dev->states_usage[index];
>> unsigned long eax = (unsigned long)cpuidle_get_statedata(state_usage);
>> unsigned int cstate;
>> - ktime_t kt_before, kt_after;
>> - s64 usec_delta;
>> + ktime_t kt_before;
>> int cpu = smp_processor_id();
>>
>> cstate = (((eax) >> MWAIT_SUBSTATE_SIZE) & MWAIT_CSTATE_MASK) + 1;
>> @@ -297,7 +296,7 @@ static int intel_idle(struct cpuidle_device *dev,
>> if (!(lapic_timer_reliable_states & (1 << (cstate))))
>> clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu);
>>
>> - kt_before = ktime_get_real();
>> + kt_before = ktime_get();
>>
>> stop_critical_timings();
>> if (!need_resched()) {
>> @@ -310,17 +309,13 @@ static int intel_idle(struct cpuidle_device *dev,
>>
>> start_critical_timings();
>>
>> - kt_after = ktime_get_real();
>> - usec_delta = ktime_to_us(ktime_sub(kt_after, kt_before));
>> + dev->last_residency = ktime_to_us(ktime_sub(ktime_get(), kt_before));
>>
>> local_irq_enable();
>>
>> if (!(lapic_timer_reliable_states & (1 << (cstate))))
>> clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu);
>>
>> - /* Update cpuidle counters */
>> - dev->last_residency = (int)usec_delta;
>> -
>> return index;
>> }
>>
>
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply
* Re: [PATCH] cpuidle: Measure idle state durations with monotonic clock
From: Daniel Lezcano @ 2012-11-14 11:05 UTC (permalink / raw)
To: Julius Werner
Cc: Kevin Hilman, Deepthi Dharwar, Trinabh Gupta, Lists Linaro-dev,
linux-pm, linux-kernel, Rafael J. Wysocki, linux-acpi,
Srivatsa S. Bhat, Andrew Morton, linuxppc-dev, Sameer Nanda,
Len Brown
In-Reply-To: <1352843563-16392-1-git-send-email-jwerner@chromium.org>
On 11/13/2012 10:52 PM, Julius Werner wrote:
> Many cpuidle drivers measure their time spent in an idle state by
> reading the wallclock time before and after idling and calculating the
> difference. This leads to erroneous results when the wallclock time gets
> updated by another processor in the meantime, adding that clock
> adjustment to the idle state's time counter.
>
> If the clock adjustment was negative, the result is even worse due to an
> erroneous cast from int to unsigned long long of the last_residency
> variable. The negative 32 bit integer will zero-extend and result in a
> forward time jump of roughly four billion milliseconds or 1.3 hours on
> the idle state residency counter.
>
> This patch changes all affected cpuidle drivers to use the monotonic
> clock for their measurements instead. It also removes the erroneous
> cast, making sure that negative residency values are applied correctly
> even though they should not appear anymore.
>
> Signed-off-by: Julius Werner <jwerner@chromium.org>
> ---
> arch/powerpc/platforms/pseries/processor_idle.c | 4 ++--
> drivers/acpi/processor_idle.c | 12 ++++++------
> drivers/cpuidle/cpuidle.c | 3 +--
> drivers/idle/intel_idle.c | 13 ++++---------
> 4 files changed, 13 insertions(+), 19 deletions(-)
>
> diff --git a/arch/powerpc/platforms/pseries/processor_idle.c b/arch/powerpc/platforms/pseries/processor_idle.c
> index 45d00e5..4d806b4 100644
> --- a/arch/powerpc/platforms/pseries/processor_idle.c
> +++ b/arch/powerpc/platforms/pseries/processor_idle.c
> @@ -36,7 +36,7 @@ static struct cpuidle_state *cpuidle_state_table;
> static inline void idle_loop_prolog(unsigned long *in_purr, ktime_t *kt_before)
> {
>
> - *kt_before = ktime_get_real();
> + *kt_before = ktime_get();
> *in_purr = mfspr(SPRN_PURR);
> /*
> * Indicate to the HV that we are idle. Now would be
> @@ -50,7 +50,7 @@ static inline s64 idle_loop_epilog(unsigned long in_purr, ktime_t kt_before)
> get_lppaca()->wait_state_cycles += mfspr(SPRN_PURR) - in_purr;
> get_lppaca()->idle = 0;
>
> - return ktime_to_us(ktime_sub(ktime_get_real(), kt_before));
> + return ktime_to_us(ktime_sub(ktime_get(), kt_before));
> }
>
> static int snooze_loop(struct cpuidle_device *dev,
> diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
> index e8086c7..8c98d73 100644
> --- a/drivers/acpi/processor_idle.c
> +++ b/drivers/acpi/processor_idle.c
> @@ -751,9 +751,9 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
>
>
> lapic_timer_state_broadcast(pr, cx, 1);
> - kt1 = ktime_get_real();
> + kt1 = ktime_get();
> acpi_idle_do_entry(cx);
> - kt2 = ktime_get_real();
> + kt2 = ktime_get();
> idle_time = ktime_to_us(ktime_sub(kt2, kt1));
>
> /* Update device last_residency*/
> @@ -843,11 +843,11 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
> if (cx->type == ACPI_STATE_C3)
> ACPI_FLUSH_CPU_CACHE();
>
> - kt1 = ktime_get_real();
> + kt1 = ktime_get();
> /* Tell the scheduler that we are going deep-idle: */
> sched_clock_idle_sleep_event();
> acpi_idle_do_entry(cx);
> - kt2 = ktime_get_real();
> + kt2 = ktime_get();
> idle_time_ns = ktime_to_ns(ktime_sub(kt2, kt1));
> idle_time = idle_time_ns;
> do_div(idle_time, NSEC_PER_USEC);
> @@ -934,7 +934,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
> */
> lapic_timer_state_broadcast(pr, cx, 1);
>
> - kt1 = ktime_get_real();
> + kt1 = ktime_get();
> /*
> * disable bus master
> * bm_check implies we need ARB_DIS
> @@ -965,7 +965,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
> c3_cpu_count--;
> raw_spin_unlock(&c3_lock);
> }
> - kt2 = ktime_get_real();
> + kt2 = ktime_get();
> idle_time_ns = ktime_to_ns(ktime_sub(kt2, kt1));
> idle_time = idle_time_ns;
> do_div(idle_time, NSEC_PER_USEC);
Maybe you can remove all these computations and set the flag
en_core_tk_irqen for the driver ? That will be handled by the cpuidle
framework, no ?
Same comment for the intel_idle driver.
Thanks
-- Daniel
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
^ permalink raw reply
* Re: [PATCH] Centralise CONFIG_ARCH_NO_VIRT_TO_BUS
From: Arnd Bergmann @ 2012-11-14 12:23 UTC (permalink / raw)
To: Stephen Rothwell
Cc: linux-arch, linux-sh, linux-kernel, David S. Miller, sparclinux,
Paul Mundt, Paul Mackerras, Bjorn Helgaas, Andrew Morton,
linuxppc-dev, H Hartley Sweeten
In-Reply-To: <20121113082615.2f482eb8835daf46e1f27947@canb.auug.org.au>
On Monday 12 November 2012, Stephen Rothwell wrote:
> Show Details
> Make if easier for more architectures to select it and thus disable
> drivers that use virt_to_bus().
>
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Very nice, I was recently looking into enabling this for ARM
as well, at least for the platforms that are known to not
need virt_to_bus.
Acked-by: Arnd Bergmann <arnd@arndb.de>
^ permalink raw reply
* Re: [PATCH] TTY: hvc_console, fix port reference count going to zero prematurely
From: Benjamin Herrenschmidt @ 2012-11-14 12:47 UTC (permalink / raw)
To: Jiri Slaby; +Cc: linuxppc-dev, gregkh, Paul Mackerras, anton, alan
In-Reply-To: <50A36844.7080207@suse.cz>
On Wed, 2012-11-14 at 10:45 +0100, Jiri Slaby wrote:
> > This fixes it by removing the extra kref_put() and tty_kref_put() calls.
>
> Oh yeah. Thanks.
>
> Acked-by: Jiri Slaby <jslaby@suse.cz>
So who's merging it ?
Cheers,
Ben.
> > Signed-off-by: Paul Mackerras <paulus@samba.org>
> > Cc: stable@vger.kernel.org
> > ---
> > drivers/tty/hvc/hvc_console.c | 7 -------
> > 1 file changed, 7 deletions(-)
> >
> > diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c
> > index a5dec1c..13ee53b 100644
> > --- a/drivers/tty/hvc/hvc_console.c
> > +++ b/drivers/tty/hvc/hvc_console.c
> > @@ -424,7 +424,6 @@ static void hvc_hangup(struct tty_struct *tty)
> > {
> > struct hvc_struct *hp = tty->driver_data;
> > unsigned long flags;
> > - int temp_open_count;
> >
> > if (!hp)
> > return;
> > @@ -444,7 +443,6 @@ static void hvc_hangup(struct tty_struct *tty)
> > return;
> > }
> >
> > - temp_open_count = hp->port.count;
> > hp->port.count = 0;
> > spin_unlock_irqrestore(&hp->port.lock, flags);
> > tty_port_tty_set(&hp->port, NULL);
> > @@ -453,11 +451,6 @@ static void hvc_hangup(struct tty_struct *tty)
> >
> > if (hp->ops->notifier_hangup)
> > hp->ops->notifier_hangup(hp, hp->data);
> > -
> > - while(temp_open_count) {
> > - --temp_open_count;
> > - tty_port_put(&hp->port);
> > - }
> > }
> >
> > /*
> >
>
>
^ permalink raw reply
* Re: [patch 4/4] mm, oom: remove statically defined arch functions of same name
From: Michal Hocko @ 2012-11-14 13:47 UTC (permalink / raw)
To: David Rientjes
Cc: Paul Mundt, linux-sh, Greg Kroah-Hartman, x86, linux-kernel,
linux-mm, Ingo Molnar, Paul Mackerras, KOSAKI Motohiro,
H. Peter Anvin, Andrew Morton, linuxppc-dev, Thomas Gleixner,
KAMEZAWA Hiroyuki
In-Reply-To: <alpine.DEB.2.00.1211140113480.32125@chino.kir.corp.google.com>
On Wed 14-11-12 01:15:28, David Rientjes wrote:
> out_of_memory() is a globally defined function to call the oom killer.
> x86, sh, and powerpc all use a function of the same name within file
> scope in their respective fault.c unnecessarily. Inline the functions
> into the pagefault handlers to clean the code up.
Yes I like it. It is really confusing to have a local function with the
same name.
>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Paul Mundt <lethal@linux-sh.org>
> Signed-off-by: David Rientjes <rientjes@google.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
> ---
> arch/powerpc/mm/fault.c | 27 ++++++++++++---------------
> arch/sh/mm/fault.c | 19 +++++++------------
> arch/x86/mm/fault.c | 23 ++++++++---------------
> 3 files changed, 27 insertions(+), 42 deletions(-)
>
> diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
> --- a/arch/powerpc/mm/fault.c
> +++ b/arch/powerpc/mm/fault.c
> @@ -113,19 +113,6 @@ static int store_updates_sp(struct pt_regs *regs)
> #define MM_FAULT_CONTINUE -1
> #define MM_FAULT_ERR(sig) (sig)
>
> -static int out_of_memory(struct pt_regs *regs)
> -{
> - /*
> - * We ran out of memory, or some other thing happened to us that made
> - * us unable to handle the page fault gracefully.
> - */
> - up_read(¤t->mm->mmap_sem);
> - if (!user_mode(regs))
> - return MM_FAULT_ERR(SIGKILL);
> - pagefault_out_of_memory();
> - return MM_FAULT_RETURN;
> -}
> -
> static int do_sigbus(struct pt_regs *regs, unsigned long address)
> {
> siginfo_t info;
> @@ -169,8 +156,18 @@ static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault)
> return MM_FAULT_CONTINUE;
>
> /* Out of memory */
> - if (fault & VM_FAULT_OOM)
> - return out_of_memory(regs);
> + if (fault & VM_FAULT_OOM) {
> + up_read(¤t->mm->mmap_sem);
> +
> + /*
> + * We ran out of memory, or some other thing happened to us that
> + * made us unable to handle the page fault gracefully.
> + */
> + if (!user_mode(regs))
> + return MM_FAULT_ERR(SIGKILL);
> + pagefault_out_of_memory();
> + return MM_FAULT_RETURN;
> + }
>
> /* Bus error. x86 handles HWPOISON here, we'll add this if/when
> * we support the feature in HW
> diff --git a/arch/sh/mm/fault.c b/arch/sh/mm/fault.c
> --- a/arch/sh/mm/fault.c
> +++ b/arch/sh/mm/fault.c
> @@ -301,17 +301,6 @@ bad_area_access_error(struct pt_regs *regs, unsigned long error_code,
> __bad_area(regs, error_code, address, SEGV_ACCERR);
> }
>
> -static void out_of_memory(void)
> -{
> - /*
> - * We ran out of memory, call the OOM killer, and return the userspace
> - * (which will retry the fault, or kill us if we got oom-killed):
> - */
> - up_read(¤t->mm->mmap_sem);
> -
> - pagefault_out_of_memory();
> -}
> -
> static void
> do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address)
> {
> @@ -353,8 +342,14 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code,
> no_context(regs, error_code, address);
> return 1;
> }
> + up_read(¤t->mm->mmap_sem);
>
> - out_of_memory();
> + /*
> + * We ran out of memory, call the OOM killer, and return the
> + * userspace (which will retry the fault, or kill us if we got
> + * oom-killed):
> + */
> + pagefault_out_of_memory();
> } else {
> if (fault & VM_FAULT_SIGBUS)
> do_sigbus(regs, error_code, address);
> diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
> --- a/arch/x86/mm/fault.c
> +++ b/arch/x86/mm/fault.c
> @@ -803,20 +803,6 @@ bad_area_access_error(struct pt_regs *regs, unsigned long error_code,
> __bad_area(regs, error_code, address, SEGV_ACCERR);
> }
>
> -/* TODO: fixup for "mm-invoke-oom-killer-from-page-fault.patch" */
> -static void
> -out_of_memory(struct pt_regs *regs, unsigned long error_code,
> - unsigned long address)
> -{
> - /*
> - * We ran out of memory, call the OOM killer, and return the userspace
> - * (which will retry the fault, or kill us if we got oom-killed):
> - */
> - up_read(¤t->mm->mmap_sem);
> -
> - pagefault_out_of_memory();
> -}
> -
> static void
> do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address,
> unsigned int fault)
> @@ -879,7 +865,14 @@ mm_fault_error(struct pt_regs *regs, unsigned long error_code,
> return 1;
> }
>
> - out_of_memory(regs, error_code, address);
> + up_read(¤t->mm->mmap_sem);
> +
> + /*
> + * We ran out of memory, call the OOM killer, and return the
> + * userspace (which will retry the fault, or kill us if we got
> + * oom-killed):
> + */
> + pagefault_out_of_memory();
> } else {
> if (fault & (VM_FAULT_SIGBUS|VM_FAULT_HWPOISON|
> VM_FAULT_HWPOISON_LARGE))
--
Michal Hocko
SUSE Labs
^ permalink raw reply
* Re: [PATCH 1/5] Add /proc device tree updating to of node add/remove
From: Grant Likely @ 2012-11-14 14:38 UTC (permalink / raw)
To: Nathan Fontenot, devicetree-discuss, cbe-oss-dev, LKML,
linuxppc-dev
In-Reply-To: <506BA905.4090000@linux.vnet.ibm.com>
On Tue, 02 Oct 2012 21:55:01 -0500, Nathan Fontenot <nfont@linux.vnet.ibm.com> wrote:
> When adding or removing a device tree node we should also update
> the device tree in /proc/device-tree. This action is already done in the
> generic OF code for adding/removing properties of a node. This patch adds
> this functionality for nodes.
>
> Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
For the whole series:
Acked-by: Grant Likely <grant.likely@secretlab.ca>
^ permalink raw reply
* Re: [PATCH] Centralise CONFIG_ARCH_NO_VIRT_TO_BUS
From: Bjorn Helgaas @ 2012-11-14 14:53 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: linux-arch, Stephen Rothwell, linux-sh, linux-kernel,
David S. Miller, Paul Mundt, Paul Mackerras, sparclinux,
Andrew Morton, linuxppc-dev, H Hartley Sweeten
In-Reply-To: <CAMuHMdXu2VJhB+1uFApeBrYS3t2cfpPMaTz12F=A_FNJB1Q60w@mail.gmail.com>
On Tue, Nov 13, 2012 at 3:32 AM, Geert Uytterhoeven
<geert@linux-m68k.org> wrote:
> On Mon, Nov 12, 2012 at 10:26 PM, Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>> diff --git a/arch/Kconfig b/arch/Kconfig
>> index 366ec06..9bc00e7 100644
>> --- a/arch/Kconfig
>> +++ b/arch/Kconfig
>> @@ -271,6 +271,13 @@ config ARCH_WANT_OLD_COMPAT_IPC
>> select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
>> bool
>>
>> +config ARCH_NO_VIRT_TO_BUS
>> + bool
>> + help
>> + An architecture should select this if it cannot (or will not)
>> + implement virt_to_bus(). All new architectures should probably
>> + select this.
>
> Don't we typically put the burden of selecting Kconfig flags for deprecated
> features on the existing architectures that provide the deprecated features?
>
> I.e. shouldn't it be ARCH_HAS_VIRT_TO_BUS, selected by the architectures
> that need it, instead?
I like this idea.
^ permalink raw reply
* Re: [PATCH] TTY: hvc_console, fix port reference count going to zero prematurely
From: Greg KH @ 2012-11-14 15:09 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: linuxppc-dev, Paul Mackerras, Jiri Slaby, anton, alan
In-Reply-To: <1352897279.23412.22.camel@pasglop>
On Wed, Nov 14, 2012 at 11:47:59PM +1100, Benjamin Herrenschmidt wrote:
> On Wed, 2012-11-14 at 10:45 +0100, Jiri Slaby wrote:
>
> > > This fixes it by removing the extra kref_put() and tty_kref_put() calls.
> >
> > Oh yeah. Thanks.
> >
> > Acked-by: Jiri Slaby <jslaby@suse.cz>
>
> So who's merging it ?
Give me a chance to at least wake up please :)
I will.
greg k-h
^ permalink raw reply
* [PATCH 1/1] powerpc: dts: virtex440: add ethernet phy to virtex440-ml507
From: Gernot Vormayr @ 2012-11-14 16:59 UTC (permalink / raw)
To: Grant Likely, Benjamin Herrenschmidt, Paul Mackerras
Cc: linuxppc-dev, linux-kernel, Gernot Vormayr
This adds the marvel phy which is present on the ml507 board.
Without this ethtool causes kernel-oopses.
Tested on ml507 board.
Signed-off-by: Gernot Vormayr <gvormayr@gmail.com>
---
arch/powerpc/boot/dts/virtex440-ml507.dts | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/powerpc/boot/dts/virtex440-ml507.dts b/arch/powerpc/boot/dts/virtex440-ml507.dts
index 52d8c1a..fc7073b 100644
--- a/arch/powerpc/boot/dts/virtex440-ml507.dts
+++ b/arch/powerpc/boot/dts/virtex440-ml507.dts
@@ -272,6 +272,12 @@
xlnx,temac-type = <0>;
xlnx,txcsum = <1>;
xlnx,txfifo = <0x1000>;
+ phy-handle = <&phy7>;
+ clock-frequency = <100000000>;
+ phy7: phy@7 {
+ compatible = "marvell,88e1111";
+ reg = <7>;
+ } ;
} ;
} ;
IIC_EEPROM: i2c@81600000 {
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH] cpuidle: Measure idle state durations with monotonic clock
From: Julius Werner @ 2012-11-14 17:15 UTC (permalink / raw)
To: Daniel Lezcano
Cc: Kevin Hilman, Deepthi Dharwar, Trinabh Gupta, Lists Linaro-dev,
linux-pm, linux-kernel, Rafael J. Wysocki, linux-acpi,
Srivatsa S. Bhat, Andrew Morton, linuxppc-dev, Sameer Nanda,
Len Brown
In-Reply-To: <50A37ADD.8040000@linaro.org>
> Maybe you can remove all these computations and set the flag
> en_core_tk_irqen for the driver ? That will be handled by the cpuidle
> framework, no ?
>
> Same comment for the intel_idle driver.
Yeah, I thought about that, too. I was a little too afraid of touching
the sched_clock_idle_wakeup_event() parameter that is tied to the
measurement, but it seems to have been vestigial for some time now and
other drivers also just set it 0. I will whip up another version of
the patch (won't change the PPC further though, if this version works
I would just leave it at that... thanks for testing, Deepthi).
^ permalink raw reply
* Re: [PATCH 3/4] perf/POWER7: Make event translations available in sysfs
From: Sukadev Bhattiprolu @ 2012-11-14 18:20 UTC (permalink / raw)
To: Jiri Olsa
Cc: Peter Zijlstra, robert.richter, Anton Blanchard, linux-kernel,
linuxppc-dev, Ingo Molnar, Paul Mackerras,
Arnaldo Carvalho de Melo
In-Reply-To: <20121114102534.GA2220@krava.brq.redhat.com>
Jiri Olsa [jolsa@redhat.com] wrote:
| On Wed, Nov 07, 2012 at 11:19:28AM -0800, Sukadev Bhattiprolu wrote:
|
| SNIP
|
| > +struct perf_pmu_events_attr {
| > + struct device_attribute attr;
| > + u64 id;
| > +};
| > +
| > +extern ssize_t power_events_sysfs_show(struct device *dev,
| > + struct device_attribute *attr, char *page);
| > +
| > +#define EVENT_VAR(_id) event_attr_##_id
| > +#define EVENT_PTR(_id) &event_attr_##_id.attr.attr
| > +
| > +#define EVENT_ATTR(_name, _id) \
| > + static struct perf_pmu_events_attr EVENT_VAR(_id) = { \
| > + .attr = __ATTR(_name, 0444, power_events_sysfs_show, NULL),\
| > + .id = PM_##_id, \
| > + };
|
| this is duplicating the x86 code, perhaps it could be moved
| to include/linux/perf_event.h and shared globaly
Ok.
Can we remove the assumption that the event id is a generic event that
has PERF_COUNT_HW_ prefix and also let the architectures pass in a "show"
function ? This would allow architectures to display any arch specific
events that don't yet have a generic counterpart.
IOW, can we do something like this (untested) and make PERF_EVENT_ATTR global:
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 4428fd1..25298f7 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -1354,12 +1354,15 @@ static ssize_t events_sysfs_show(struct device *dev, struct device_attribute *at
#define EVENT_VAR(_id) event_attr_##_id
#define EVENT_PTR(_id) &event_attr_##_id.attr.attr
-#define EVENT_ATTR(_name, _id) \
+#define PERF_EVENT_ATTR(_name, _id, _show) \
static struct perf_pmu_events_attr EVENT_VAR(_id) = { \
- .attr = __ATTR(_name, 0444, events_sysfs_show, NULL), \
- .id = PERF_COUNT_HW_##_id, \
+ .attr = __ATTR(_name, 0444, _show, NULL), \
+ .id = _id, \
};
+#define EVENT_ATTR(_name, _id) \
+ PERF_EVENT_ATTR(_name, PERF_COUNT_HW_##_id, events_sysfs_show)
+
EVENT_ATTR(cpu-cycles, CPU_CYCLES );
EVENT_ATTR(instructions, INSTRUCTIONS );
EVENT_ATTR(cache-references, CACHE_REFERENCES );
|
|
| > diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
| > index aa2465e..19b23bd 100644
| > --- a/arch/powerpc/perf/core-book3s.c
| > +++ b/arch/powerpc/perf/core-book3s.c
| > @@ -1305,6 +1305,16 @@ static int power_pmu_event_idx(struct perf_event *event)
| > return event->hw.idx;
| > }
| >
| > +ssize_t power_events_sysfs_show(struct device *dev,
| > + struct device_attribute *attr, char *page)
| > +{
| > + struct perf_pmu_events_attr *pmu_attr;
| > +
| > + pmu_attr = container_of(attr, struct perf_pmu_events_attr, attr);
| > +
| > + return sprintf(page, "event=0x%02llx\n", pmu_attr->id);
|
| whitespace issues
Will fix. Thanks for the review.
Sukadev
^ permalink raw reply related
* Re: [PATCH] TTY: hvc_console, fix port reference count going to zero prematurely
From: Benjamin Herrenschmidt @ 2012-11-14 20:48 UTC (permalink / raw)
To: Greg KH; +Cc: linuxppc-dev, Paul Mackerras, Jiri Slaby, anton, alan
In-Reply-To: <20121114150901.GA2371@kroah.com>
On Wed, 2012-11-14 at 07:09 -0800, Greg KH wrote:
> > So who's merging it ?
>
> Give me a chance to at least wake up please :)
Sure ;-) Just asking since I'm about to cook up a powerpc batch :-)
> I will.
Thanks ! It should go into stable 3.6 as well.
Cheers,
Ben.
^ permalink raw reply
* Re: [PATCH] TTY: hvc_console, fix port reference count going to zero prematurely
From: Greg KH @ 2012-11-14 20:54 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: linuxppc-dev, Paul Mackerras, Jiri Slaby, anton, alan
In-Reply-To: <1352926097.23412.24.camel@pasglop>
On Thu, Nov 15, 2012 at 07:48:17AM +1100, Benjamin Herrenschmidt wrote:
> On Wed, 2012-11-14 at 07:09 -0800, Greg KH wrote:
> > > So who's merging it ?
> >
> > Give me a chance to at least wake up please :)
>
> Sure ;-) Just asking since I'm about to cook up a powerpc batch :-)
It's now in my tree, and will get to Linus in time for 3.7.
> > I will.
>
> Thanks ! It should go into stable 3.6 as well.
Why? The offending patch didn't show up until 3.7-rc1.
thanks,
greg k-h
^ permalink raw reply
* Re: [PATCH] TTY: hvc_console, fix port reference count going to zero prematurely
From: Benjamin Herrenschmidt @ 2012-11-14 20:57 UTC (permalink / raw)
To: Greg KH; +Cc: linuxppc-dev, Paul Mackerras, Jiri Slaby, anton, alan
In-Reply-To: <20121114205407.GA7937@kroah.com>
On Wed, 2012-11-14 at 12:54 -0800, Greg KH wrote:
> > Thanks ! It should go into stable 3.6 as well.
>
> Why? The offending patch didn't show up until 3.7-rc1.
Ah, my bad, I though Paulus had observed the problem with 3.6 as well
but it looks like you are right. So 3.7 then.
Thanks.
Cheers,
Ben.
^ permalink raw reply
* Re: [PATCH] TTY: hvc_console, fix port reference count going to zero prematurely
From: Paul Mackerras @ 2012-11-14 23:02 UTC (permalink / raw)
To: Greg KH; +Cc: linuxppc-dev, Jiri Slaby, anton, alan
In-Reply-To: <20121114205407.GA7937@kroah.com>
On Wed, Nov 14, 2012 at 12:54:07PM -0800, Greg KH wrote:
> On Thu, Nov 15, 2012 at 07:48:17AM +1100, Benjamin Herrenschmidt wrote:
> > On Wed, 2012-11-14 at 07:09 -0800, Greg KH wrote:
> > > > So who's merging it ?
> > >
> > > Give me a chance to at least wake up please :)
> >
> > Sure ;-) Just asking since I'm about to cook up a powerpc batch :-)
>
> It's now in my tree, and will get to Linus in time for 3.7.
Turns out I stuffed up the commit message a bit, I talk about kref_put
and tty_kref_put when I should be talking about tty_port_put. If
there is still a chance to update the commit message, that would be
good. The patch itself is correct.
> > > I will.
> >
> > Thanks ! It should go into stable 3.6 as well.
>
> Why? The offending patch didn't show up until 3.7-rc1.
Yes. I had thought it was in 3.6 but it isn't.
Paul.
^ permalink raw reply
* Re: [PATCH 1/6] powerpc: Move branch instruction from ACCOUNT_CPU_USER_ENTRY to caller
From: Benjamin Herrenschmidt @ 2012-11-15 0:40 UTC (permalink / raw)
To: Haren Myneni; +Cc: linuxppc-dev, mikey, anton, paulus
In-Reply-To: <1351666269.32304.12.camel@hbabu-laptop>
On Tue, 2012-10-30 at 23:51 -0700, Haren Myneni wrote:
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -159,8 +159,9 @@ exc_##n##_common: \
std r9,GPR9(r1); /* save r9 in stackframe */ \
std r10,_NIP(r1); /* save SRR0 to stackframe */ \
std r11,_MSR(r1); /* save SRR1 to stackframe */ \
+ beq 1f /* if from kernel mode */
Missing semicolon
ACCOUNT_CPU_USER_ENTRY(r10,r11);/* accounting (uses cr0+eq) */ \
- ld r3,excf+EX_R10(r13); /* get back r10 */ \
+1: ld r3,excf+EX_R10(r13); /* get back r10 */ \
ld r4,excf+EX_R11(r13); /* get back r11 */ \
mfspr r5,SPRN_SPRG_GEN_SCRATCH;/* get back r13 */ \
std r12,GPR12(r1); /* save r12 in stackframe */ \
Please , please, please ... at the very least TEST BUILD the stuff you
change... I'm fixing that one up here this time.
Ben.
^ permalink raw reply
* Re: [PATCH 1/6] powerpc: Move branch instruction from ACCOUNT_CPU_USER_ENTRY to caller
From: Benjamin Herrenschmidt @ 2012-11-15 1:03 UTC (permalink / raw)
To: Haren Myneni; +Cc: linuxppc-dev, mikey, anton, paulus
In-Reply-To: <1352940045.23412.38.camel@pasglop>
On Thu, 2012-11-15 at 11:40 +1100, Benjamin Herrenschmidt wrote:
On Tue, 2012-10-30 at 23:51 -0700, Haren Myneni wrote:
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -159,8 +159,9 @@ exc_##n##_common: \
std r9,GPR9(r1); /* save r9 in stackframe */ \
std r10,_NIP(r1); /* save SRR0 to stackframe */ \
std r11,_MSR(r1); /* save SRR1 to stackframe */ \
+ beq 1f /* if from kernel mode */
Missing semicolon
Ok, that's not enough. Please test & fix & resend.
Cheers,
Ben.
^ permalink raw reply
* [PATCH] cpuidle: Measure idle state durations with monotonic clock
From: Julius Werner @ 2012-11-15 1:56 UTC (permalink / raw)
To: linux-kernel
Cc: Kevin Hilman, Deepthi Dharwar, Trinabh Gupta, Lists Linaro-dev,
linux-pm, Daniel Lezcano, Rafael J. Wysocki, linux-acpi,
Srivatsa S. Bhat, Julius Werner, Andrew Morton, linuxppc-dev,
Sameer Nanda, Len Brown
In-Reply-To: <CAODwPW873M32d9zFT9fpJT9+PuMbz8htzUxdF1TNE+J1zR3jYA@mail.gmail.com>
Many cpuidle drivers measure their time spent in an idle state by
reading the wallclock time before and after idling and calculating the
difference. This leads to erroneous results when the wallclock time gets
updated by another processor in the meantime, adding that clock
adjustment to the idle state's time counter.
If the clock adjustment was negative, the result is even worse due to an
erroneous cast from int to unsigned long long of the last_residency
variable. The negative 32 bit integer will zero-extend and result in a
forward time jump of roughly four billion milliseconds or 1.3 hours on
the idle state residency counter.
This patch changes all affected cpuidle drivers to either use the
monotonic clock for their measurements or make use of the generic time
measurement wrapper in cpuidle.c, which was already working correctly.
Some superfluous CLIs/STIs in the ACPI code are removed (interrupts
should always already be disabled before entering the idle function, and
not get reenabled until the generic wrapper has performed its second
measurement). It also removes the erroneous cast, making sure that
negative residency values are applied correctly even though they should
not appear anymore.
Signed-off-by: Julius Werner <jwerner@chromium.org>
---
arch/powerpc/platforms/pseries/processor_idle.c | 4 +-
drivers/acpi/processor_idle.c | 57 +---------------------
drivers/cpuidle/cpuidle.c | 3 +-
drivers/idle/intel_idle.c | 14 +-----
4 files changed, 7 insertions(+), 71 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/processor_idle.c b/arch/powerpc/platforms/pseries/processor_idle.c
index 45d00e5..4d806b4 100644
--- a/arch/powerpc/platforms/pseries/processor_idle.c
+++ b/arch/powerpc/platforms/pseries/processor_idle.c
@@ -36,7 +36,7 @@ static struct cpuidle_state *cpuidle_state_table;
static inline void idle_loop_prolog(unsigned long *in_purr, ktime_t *kt_before)
{
- *kt_before = ktime_get_real();
+ *kt_before = ktime_get();
*in_purr = mfspr(SPRN_PURR);
/*
* Indicate to the HV that we are idle. Now would be
@@ -50,7 +50,7 @@ static inline s64 idle_loop_epilog(unsigned long in_purr, ktime_t kt_before)
get_lppaca()->wait_state_cycles += mfspr(SPRN_PURR) - in_purr;
get_lppaca()->idle = 0;
- return ktime_to_us(ktime_sub(ktime_get_real(), kt_before));
+ return ktime_to_us(ktime_sub(ktime_get(), kt_before));
}
static int snooze_loop(struct cpuidle_device *dev,
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index e8086c7..f1a5da4 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -735,31 +735,18 @@ static inline void acpi_idle_do_entry(struct acpi_processor_cx *cx)
static int acpi_idle_enter_c1(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int index)
{
- ktime_t kt1, kt2;
- s64 idle_time;
struct acpi_processor *pr;
struct cpuidle_state_usage *state_usage = &dev->states_usage[index];
struct acpi_processor_cx *cx = cpuidle_get_statedata(state_usage);
pr = __this_cpu_read(processors);
- dev->last_residency = 0;
if (unlikely(!pr))
return -EINVAL;
- local_irq_disable();
-
-
lapic_timer_state_broadcast(pr, cx, 1);
- kt1 = ktime_get_real();
acpi_idle_do_entry(cx);
- kt2 = ktime_get_real();
- idle_time = ktime_to_us(ktime_sub(kt2, kt1));
-
- /* Update device last_residency*/
- dev->last_residency = (int)idle_time;
- local_irq_enable();
lapic_timer_state_broadcast(pr, cx, 0);
return index;
@@ -806,19 +793,12 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
struct acpi_processor *pr;
struct cpuidle_state_usage *state_usage = &dev->states_usage[index];
struct acpi_processor_cx *cx = cpuidle_get_statedata(state_usage);
- ktime_t kt1, kt2;
- s64 idle_time_ns;
- s64 idle_time;
pr = __this_cpu_read(processors);
- dev->last_residency = 0;
if (unlikely(!pr))
return -EINVAL;
- local_irq_disable();
-
-
if (cx->entry_method != ACPI_CSTATE_FFH) {
current_thread_info()->status &= ~TS_POLLING;
/*
@@ -829,7 +809,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
if (unlikely(need_resched())) {
current_thread_info()->status |= TS_POLLING;
- local_irq_enable();
return -EINVAL;
}
}
@@ -843,22 +822,12 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
if (cx->type == ACPI_STATE_C3)
ACPI_FLUSH_CPU_CACHE();
- kt1 = ktime_get_real();
/* Tell the scheduler that we are going deep-idle: */
sched_clock_idle_sleep_event();
acpi_idle_do_entry(cx);
- kt2 = ktime_get_real();
- idle_time_ns = ktime_to_ns(ktime_sub(kt2, kt1));
- idle_time = idle_time_ns;
- do_div(idle_time, NSEC_PER_USEC);
- /* Update device last_residency*/
- dev->last_residency = (int)idle_time;
+ sched_clock_idle_wakeup_event(0);
- /* Tell the scheduler how much we idled: */
- sched_clock_idle_wakeup_event(idle_time_ns);
-
- local_irq_enable();
if (cx->entry_method != ACPI_CSTATE_FFH)
current_thread_info()->status |= TS_POLLING;
@@ -883,13 +852,8 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
struct acpi_processor *pr;
struct cpuidle_state_usage *state_usage = &dev->states_usage[index];
struct acpi_processor_cx *cx = cpuidle_get_statedata(state_usage);
- ktime_t kt1, kt2;
- s64 idle_time_ns;
- s64 idle_time;
-
pr = __this_cpu_read(processors);
- dev->last_residency = 0;
if (unlikely(!pr))
return -EINVAL;
@@ -899,16 +863,11 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
return drv->states[drv->safe_state_index].enter(dev,
drv, drv->safe_state_index);
} else {
- local_irq_disable();
acpi_safe_halt();
- local_irq_enable();
return -EBUSY;
}
}
- local_irq_disable();
-
-
if (cx->entry_method != ACPI_CSTATE_FFH) {
current_thread_info()->status &= ~TS_POLLING;
/*
@@ -919,7 +878,6 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
if (unlikely(need_resched())) {
current_thread_info()->status |= TS_POLLING;
- local_irq_enable();
return -EINVAL;
}
}
@@ -934,7 +892,6 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
*/
lapic_timer_state_broadcast(pr, cx, 1);
- kt1 = ktime_get_real();
/*
* disable bus master
* bm_check implies we need ARB_DIS
@@ -965,18 +922,9 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
c3_cpu_count--;
raw_spin_unlock(&c3_lock);
}
- kt2 = ktime_get_real();
- idle_time_ns = ktime_to_ns(ktime_sub(kt2, kt1));
- idle_time = idle_time_ns;
- do_div(idle_time, NSEC_PER_USEC);
-
- /* Update device last_residency*/
- dev->last_residency = (int)idle_time;
- /* Tell the scheduler how much we idled: */
- sched_clock_idle_wakeup_event(idle_time_ns);
+ sched_clock_idle_wakeup_event(0);
- local_irq_enable();
if (cx->entry_method != ACPI_CSTATE_FFH)
current_thread_info()->status |= TS_POLLING;
@@ -987,6 +935,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
struct cpuidle_driver acpi_idle_driver = {
.name = "acpi_idle",
.owner = THIS_MODULE,
+ .en_core_tk_irqen = 1,
};
/**
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 7f15b85..1536edd 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -109,8 +109,7 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv,
/* This can be moved to within driver enter routine
* but that results in multiple copies of same code.
*/
- dev->states_usage[entered_state].time +=
- (unsigned long long)dev->last_residency;
+ dev->states_usage[entered_state].time += dev->last_residency;
dev->states_usage[entered_state].usage++;
} else {
dev->last_residency = 0;
diff --git a/drivers/idle/intel_idle.c b/drivers/idle/intel_idle.c
index b0f6b4c..c49c04d 100644
--- a/drivers/idle/intel_idle.c
+++ b/drivers/idle/intel_idle.c
@@ -56,7 +56,6 @@
#include <linux/kernel.h>
#include <linux/cpuidle.h>
#include <linux/clockchips.h>
-#include <linux/hrtimer.h> /* ktime_get_real() */
#include <trace/events/power.h>
#include <linux/sched.h>
#include <linux/notifier.h>
@@ -72,6 +71,7 @@
static struct cpuidle_driver intel_idle_driver = {
.name = "intel_idle",
.owner = THIS_MODULE,
+ .en_core_tk_irqen = 1,
};
/* intel_idle.max_cstate=0 disables driver */
static int max_cstate = MWAIT_MAX_NUM_CSTATES - 1;
@@ -281,8 +281,6 @@ static int intel_idle(struct cpuidle_device *dev,
struct cpuidle_state_usage *state_usage = &dev->states_usage[index];
unsigned long eax = (unsigned long)cpuidle_get_statedata(state_usage);
unsigned int cstate;
- ktime_t kt_before, kt_after;
- s64 usec_delta;
int cpu = smp_processor_id();
cstate = (((eax) >> MWAIT_SUBSTATE_SIZE) & MWAIT_CSTATE_MASK) + 1;
@@ -297,8 +295,6 @@ static int intel_idle(struct cpuidle_device *dev,
if (!(lapic_timer_reliable_states & (1 << (cstate))))
clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu);
- kt_before = ktime_get_real();
-
stop_critical_timings();
if (!need_resched()) {
@@ -310,17 +306,9 @@ static int intel_idle(struct cpuidle_device *dev,
start_critical_timings();
- kt_after = ktime_get_real();
- usec_delta = ktime_to_us(ktime_sub(kt_after, kt_before));
-
- local_irq_enable();
-
if (!(lapic_timer_reliable_states & (1 << (cstate))))
clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu);
- /* Update cpuidle counters */
- dev->last_residency = (int)usec_delta;
-
return index;
}
--
1.7.8.6
^ permalink raw reply related
* [PATCH] powerpc/pseries: Fix IBM_ARCH_VEC_NRCORES_OFFSET for POWER8 updates
From: Michael Neuling @ 2012-11-15 3:53 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
In-Reply-To: <30008.1352442191@neuling.org>
In supporting POWER8 we added 16 bytes to the start of the
ibm_architecture_vec, but forgot to add this to
IBM_ARCH_VEC_NRCORES_OFFSET.
This caused us to hit this warning in early boot:
WARNING ! ibm_architecture_vec structure inconsistent: 805372128
This add this extra 16 bytes of offset.
Signed-off-by: Michael Neuling <mikey@neuling.org>
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 9ffb542..779f340 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -773,7 +773,7 @@ static unsigned char ibm_architecture_vec[] = {
* must match by the macro below. Update the definition if
* the structure layout changes.
*/
-#define IBM_ARCH_VEC_NRCORES_OFFSET 101
+#define IBM_ARCH_VEC_NRCORES_OFFSET 117
W(NR_CPUS), /* number of cores supported */
0,
0,
^ permalink raw reply related
* [PATCH 1/7] powerpc: Define differences between doorbells on book3e and book3s
From: Ian Munsie @ 2012-11-15 4:49 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Michael Neuling, linuxppc-dev, Ian Munsie
In-Reply-To: <1352954990-2858-1-git-send-email-imunsie@au1.ibm.com>
From: Ian Munsie <imunsie@au1.ibm.com>
There are a few key differences between doorbells on server compared
with embedded that we care about on Linux, namely:
- We have a new msgsndp instruction for directed privileged doorbells.
msgsnd is used for directed hypervisor doorbells.
- The tag we use in the instruction is the Thread Identification
Register of the recipient thread (since server doorbells can only
occur between threads within a single core), and is only 7 bits wide.
- A new message type is introduced for server doorbells (none of the
existing book3e message types are currently supported on book3s).
Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
Tested-by: Michael Neuling <mikey@neuling.org>
---
arch/powerpc/include/asm/dbell.h | 15 +++++++++++++++
arch/powerpc/include/asm/ppc-opcode.h | 3 +++
arch/powerpc/include/asm/reg.h | 1 +
arch/powerpc/kernel/dbell.c | 4 ++--
4 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/include/asm/dbell.h b/arch/powerpc/include/asm/dbell.h
index 607e4ee..3b33856 100644
--- a/arch/powerpc/include/asm/dbell.h
+++ b/arch/powerpc/include/asm/dbell.h
@@ -28,8 +28,23 @@ enum ppc_dbell {
PPC_G_DBELL = 2, /* guest doorbell */
PPC_G_DBELL_CRIT = 3, /* guest critical doorbell */
PPC_G_DBELL_MC = 4, /* guest mcheck doorbell */
+ PPC_DBELL_SERVER = 5, /* doorbell on server */
};
+#ifdef CONFIG_PPC_BOOK3S
+
+#define PPC_DBELL_MSGTYPE PPC_DBELL_SERVER
+#define SPRN_DOORBELL_CPUTAG SPRN_TIR
+#define PPC_DBELL_TAG_MASK 0x7f
+
+#else /* CONFIG_PPC_BOOK3S */
+
+#define PPC_DBELL_MSGTYPE PPC_DBELL
+#define SPRN_DOORBELL_CPUTAG SPRN_PIR
+#define PPC_DBELL_TAG_MASK 0x3fff
+
+#endif /* CONFIG_PPC_BOOK3S */
+
extern void doorbell_cause_ipi(int cpu, unsigned long data);
extern void doorbell_exception(struct pt_regs *regs);
extern void doorbell_setup_this_cpu(void);
diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
index e434d8b..45fd394 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -100,6 +100,7 @@
#define PPC_INST_MFSPR_PVR 0x7c1f42a6
#define PPC_INST_MFSPR_PVR_MASK 0xfc1fffff
#define PPC_INST_MSGSND 0x7c00019c
+#define PPC_INST_MSGSNDP 0x7c00011c
#define PPC_INST_NOP 0x60000000
#define PPC_INST_POPCNTB 0x7c0000f4
#define PPC_INST_POPCNTB_MASK 0xfc0007fe
@@ -224,6 +225,8 @@
___PPC_RB(b) | __PPC_EH(eh))
#define PPC_MSGSND(b) stringify_in_c(.long PPC_INST_MSGSND | \
___PPC_RB(b))
+#define PPC_MSGSNDP(b) stringify_in_c(.long PPC_INST_MSGSNDP | \
+ ___PPC_RB(b))
#define PPC_POPCNTB(a, s) stringify_in_c(.long PPC_INST_POPCNTB | \
__PPC_RA(a) | __PPC_RS(s))
#define PPC_POPCNTD(a, s) stringify_in_c(.long PPC_INST_POPCNTD | \
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index 1b853f7..736c6af 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -483,6 +483,7 @@
#ifndef SPRN_PIR
#define SPRN_PIR 0x3FF /* Processor Identification Register */
#endif
+#define SPRN_TIR 0x1BE /* Thread Identification Register */
#define SPRN_PTEHI 0x3D5 /* 981 7450 PTE HI word (S/W TLB load) */
#define SPRN_PTELO 0x3D6 /* 982 7450 PTE LO word (S/W TLB load) */
#define SPRN_PURR 0x135 /* Processor Utilization of Resources Reg */
diff --git a/arch/powerpc/kernel/dbell.c b/arch/powerpc/kernel/dbell.c
index a892680..9ebbc24 100644
--- a/arch/powerpc/kernel/dbell.c
+++ b/arch/powerpc/kernel/dbell.c
@@ -21,7 +21,7 @@
#ifdef CONFIG_SMP
void doorbell_setup_this_cpu(void)
{
- unsigned long tag = mfspr(SPRN_PIR) & 0x3fff;
+ unsigned long tag = mfspr(SPRN_DOORBELL_CPUTAG) & PPC_DBELL_TAG_MASK;
smp_muxed_ipi_set_data(smp_processor_id(), tag);
}
@@ -30,7 +30,7 @@ void doorbell_cause_ipi(int cpu, unsigned long data)
{
/* Order previous accesses vs. msgsnd, which is treated as a store */
mb();
- ppc_msgsnd(PPC_DBELL, 0, data);
+ ppc_msgsnd(PPC_DBELL_MSGTYPE, 0, data);
}
void doorbell_exception(struct pt_regs *regs)
--
1.7.10.4
^ permalink raw reply related
* [PATCH 3/7] powerpc: Add book3s privileged doorbell exception vectors
From: Ian Munsie @ 2012-11-15 4:49 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Michael Neuling, linuxppc-dev, Ian Munsie
In-Reply-To: <1352954990-2858-1-git-send-email-imunsie@au1.ibm.com>
From: Ian Munsie <imunsie@au1.ibm.com>
Directed Privileged Doorbell Interrupts come in at 0xa00 (or
0xc000000000004a00 if relocation on exception is enabled), so add
exception vectors at these locations.
If doorbell support is not compiled in we handle it as an
unknown_exception.
Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
Tested-by: Michael Neuling <mikey@neuling.org>
---
arch/powerpc/include/asm/exception-64s.h | 1 +
arch/powerpc/kernel/exceptions-64s.S | 9 +++++++--
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index 9d5367e..b1edd80 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -305,6 +305,7 @@ label##_relon_hv: \
#define SOFTEN_VALUE_0x502 PACA_IRQ_EE
#define SOFTEN_VALUE_0x900 PACA_IRQ_DEC
#define SOFTEN_VALUE_0x982 PACA_IRQ_DEC
+#define SOFTEN_VALUE_0xa00 PACA_IRQ_DBELL
#define SOFTEN_VALUE_0xe80 PACA_IRQ_DBELL
#define SOFTEN_VALUE_0xe82 PACA_IRQ_DBELL
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index d08a3cd..176bf99 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -252,7 +252,7 @@ hardware_interrupt_hv:
MASKABLE_EXCEPTION_PSERIES(0x900, 0x900, decrementer)
STD_EXCEPTION_HV(0x980, 0x982, hdecrementer)
- STD_EXCEPTION_PSERIES(0xa00, 0xa00, trap_0a)
+ MASKABLE_EXCEPTION_PSERIES(0xa00, 0xa00, doorbell_super)
KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xa00)
STD_EXCEPTION_PSERIES(0xb00, 0xb00, trap_0b)
@@ -655,7 +655,11 @@ machine_check_common:
STD_EXCEPTION_COMMON_ASYNC(0x500, hardware_interrupt, do_IRQ)
STD_EXCEPTION_COMMON_ASYNC(0x900, decrementer, .timer_interrupt)
STD_EXCEPTION_COMMON(0x980, hdecrementer, .hdec_interrupt)
- STD_EXCEPTION_COMMON(0xa00, trap_0a, .unknown_exception)
+#ifdef CONFIG_PPC_DOORBELL
+ STD_EXCEPTION_COMMON_ASYNC(0xa00, doorbell_super, .doorbell_exception)
+#else
+ STD_EXCEPTION_COMMON_ASYNC(0xa00, doorbell_super, .unknown_exception)
+#endif
STD_EXCEPTION_COMMON(0xb00, trap_0b, .unknown_exception)
STD_EXCEPTION_COMMON(0xd00, single_step, .single_step_exception)
STD_EXCEPTION_COMMON(0xe00, trap_0e, .unknown_exception)
@@ -755,6 +759,7 @@ hardware_interrupt_relon_hv:
STD_RELON_EXCEPTION_PSERIES(0x4800, 0x800, fp_unavailable)
MASKABLE_RELON_EXCEPTION_PSERIES(0x4900, 0x900, decrementer)
STD_RELON_EXCEPTION_HV(0x4980, 0x982, hdecrementer)
+ MASKABLE_RELON_EXCEPTION_PSERIES(0x4a00, 0xa00, doorbell_super)
STD_RELON_EXCEPTION_PSERIES(0x4b00, 0xb00, trap_0b)
. = 0x4c00
--
1.7.10.4
^ permalink raw reply related
* powerpc: Add support for POWER8 directed doorbell interrupts
From: Ian Munsie @ 2012-11-15 4:49 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Michael Neuling, linuxppc-dev
This patch series adds support for using directed doorbell interrupts for IPIs
between threads within a core, which is supported by POWER8.
This should avoid the overhead of using XICS to deliver an IPI within a core,
though delivering IPIs between threads of different cores must still use XICS
as before.
Please note that this series depends on this series posted by Michael Neuling,
as it adds additional relocation on exception vectors:
https://lists.ozlabs.org/pipermail/linuxppc-dev/2012-November/101910.html
^ permalink raw reply
* [PATCH 4/7] powerpc: Select either privileged or hypervisor doorbell when sending
From: Ian Munsie @ 2012-11-15 4:49 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Michael Neuling, linuxppc-dev, Ian Munsie
In-Reply-To: <1352954990-2858-1-git-send-email-imunsie@au1.ibm.com>
From: Ian Munsie <imunsie@au1.ibm.com>
On book3s we have two msgsnd instructions with differing privilege
levels. This patch selects the appropriate instruction to use whenever
we send a doorbell interrupt.
Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
Tested-by: Michael Neuling <mikey@neuling.org>
---
arch/powerpc/include/asm/dbell.h | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/include/asm/dbell.h b/arch/powerpc/include/asm/dbell.h
index 3b33856..5fa6b20 100644
--- a/arch/powerpc/include/asm/dbell.h
+++ b/arch/powerpc/include/asm/dbell.h
@@ -37,12 +37,25 @@ enum ppc_dbell {
#define SPRN_DOORBELL_CPUTAG SPRN_TIR
#define PPC_DBELL_TAG_MASK 0x7f
+static inline void _ppc_msgsnd(u32 msg)
+{
+ if (cpu_has_feature(CPU_FTR_HVMODE))
+ __asm__ __volatile__ (PPC_MSGSND(%0) : : "r" (msg));
+ else
+ __asm__ __volatile__ (PPC_MSGSNDP(%0) : : "r" (msg));
+}
+
#else /* CONFIG_PPC_BOOK3S */
#define PPC_DBELL_MSGTYPE PPC_DBELL
#define SPRN_DOORBELL_CPUTAG SPRN_PIR
#define PPC_DBELL_TAG_MASK 0x3fff
+static inline void _ppc_msgsnd(u32 msg)
+{
+ __asm__ __volatile__ (PPC_MSGSND(%0) : : "r" (msg));
+}
+
#endif /* CONFIG_PPC_BOOK3S */
extern void doorbell_cause_ipi(int cpu, unsigned long data);
@@ -54,7 +67,7 @@ static inline void ppc_msgsnd(enum ppc_dbell type, u32 flags, u32 tag)
u32 msg = PPC_DBELL_TYPE(type) | (flags & PPC_DBELL_MSG_BRDCAST) |
(tag & 0x07ffffff);
- __asm__ __volatile__ (PPC_MSGSND(%0) : : "r" (msg));
+ _ppc_msgsnd(msg);
}
#endif /* _ASM_POWERPC_DBELL_H */
--
1.7.10.4
^ permalink raw reply related
* [PATCH 7/7] powerpc: Hook up doorbells on server
From: Ian Munsie @ 2012-11-15 4:49 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: Michael Neuling, linuxppc-dev, Ian Munsie
In-Reply-To: <1352954990-2858-1-git-send-email-imunsie@au1.ibm.com>
From: Ian Munsie <imunsie@au1.ibm.com>
This patch actually hooks up doorbell interrupts on POWER8:
- Select the PPC_DOORBELL Kconfig option from PPC_PSERIES
- Add the doorbell CPU feature bit to POWER8
- We define a new pSeries_cause_ipi_mux() function that issues a
doorbell interrupt if the recipient is another thread within the same
core as the sender. If the recipient is in a different core it falls
back to using XICS to deliver the IPI as before.
- During pSeries_smp_probe() at boot, we check if doorbell interrupts
are supported. If they are we set the cause_ipi function pointer to
the above mentioned function, otherwise we leave it as whichever XICS
cause_ipi function was determined by xics_smp_probe().
Signed-off-by: Ian Munsie <imunsie@au1.ibm.com>
Tested-by: Michael Neuling <mikey@neuling.org>
---
arch/powerpc/include/asm/cputable.h | 3 ++-
arch/powerpc/platforms/pseries/Kconfig | 1 +
arch/powerpc/platforms/pseries/smp.c | 33 ++++++++++++++++++++++++++++++--
3 files changed, 34 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
index 76f81bd..fc4d2c5 100644
--- a/arch/powerpc/include/asm/cputable.h
+++ b/arch/powerpc/include/asm/cputable.h
@@ -408,7 +408,8 @@ extern const char *powerpc_base_platform;
CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \
CPU_FTR_DSCR | CPU_FTR_SAO | \
CPU_FTR_STCX_CHECKS_ADDRESS | CPU_FTR_POPCNTB | CPU_FTR_POPCNTD | \
- CPU_FTR_ICSWX | CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY)
+ CPU_FTR_ICSWX | CPU_FTR_CFAR | CPU_FTR_HVMODE | CPU_FTR_VMX_COPY | \
+ CPU_FTR_DBELL)
#define CPU_FTRS_CELL (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
index 837cf49..9a0941b 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -17,6 +17,7 @@ config PPC_PSERIES
select PPC_NATIVE
select PPC_PCI_CHOICE if EXPERT
select ZLIB_DEFLATE
+ select PPC_DOORBELL
default y
config PPC_SPLPAR
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index 9fc0a49..32c82c2 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -42,6 +42,7 @@
#include <asm/vdso_datapage.h>
#include <asm/cputhreads.h>
#include <asm/xics.h>
+#include <asm/dbell.h>
#include "plpar_wrappers.h"
#include "pseries.h"
@@ -54,6 +55,11 @@
*/
static cpumask_var_t of_spin_mask;
+/*
+ * If we multiplex IPI mechanisms, store the appropriate XICS IPI mechanism here
+ */
+static void (*xics_cause_ipi)(int cpu, unsigned long data);
+
/* Query where a cpu is now. Return codes #defined in plpar_wrappers.h */
int smp_query_cpu_stopped(unsigned int pcpu)
{
@@ -137,6 +143,8 @@ static void __devinit smp_xics_setup_cpu(int cpu)
{
if (cpu != boot_cpuid)
xics_setup_cpu();
+ if (cpu_has_feature(CPU_FTR_DBELL))
+ doorbell_setup_this_cpu();
if (firmware_has_feature(FW_FEATURE_SPLPAR))
vpa_init(cpu);
@@ -195,6 +203,27 @@ static int smp_pSeries_cpu_bootable(unsigned int nr)
return 1;
}
+/* Only used on systems that support multiple IPI mechanisms */
+static void pSeries_cause_ipi_mux(int cpu, unsigned long data)
+{
+ if (cpumask_test_cpu(cpu, cpu_sibling_mask(smp_processor_id())))
+ doorbell_cause_ipi(cpu, data);
+ else
+ xics_cause_ipi(cpu, data);
+}
+
+static __init int pSeries_smp_probe(void)
+{
+ int ret = xics_smp_probe();
+
+ if (cpu_has_feature(CPU_FTR_DBELL)) {
+ xics_cause_ipi = smp_ops->cause_ipi;
+ smp_ops->cause_ipi = pSeries_cause_ipi_mux;
+ }
+
+ return ret;
+}
+
static struct smp_ops_t pSeries_mpic_smp_ops = {
.message_pass = smp_mpic_message_pass,
.probe = smp_mpic_probe,
@@ -204,8 +233,8 @@ static struct smp_ops_t pSeries_mpic_smp_ops = {
static struct smp_ops_t pSeries_xics_smp_ops = {
.message_pass = NULL, /* Use smp_muxed_ipi_message_pass */
- .cause_ipi = NULL, /* Filled at runtime by xics_smp_probe() */
- .probe = xics_smp_probe,
+ .cause_ipi = NULL, /* Filled at runtime by pSeries_smp_probe() */
+ .probe = pSeries_smp_probe,
.kick_cpu = smp_pSeries_kick_cpu,
.setup_cpu = smp_xics_setup_cpu,
.cpu_bootable = smp_pSeries_cpu_bootable,
--
1.7.10.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox