From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933588AbbBQKEQ (ORCPT ); Tue, 17 Feb 2015 05:04:16 -0500 Received: from foss.arm.com ([217.140.101.70]:52669 "EHLO usa-sjc-mx-foss1.foss.arm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756610AbbBQKEO (ORCPT ); Tue, 17 Feb 2015 05:04:14 -0500 Date: Tue, 17 Feb 2015 10:04:30 +0000 From: Lorenzo Pieralisi To: Peter Zijlstra Cc: "linux-kernel@vger.kernel.org" , "mingo@kernel.org" , "rjw@rjwysocki.net" , "tglx@linutronix.de" , Preeti U Murthy , Michael Ellerman , Benjamin Herrenschmidt Subject: Re: [PATCH 33/35] tick: Make hrtimer broadcasting opt-in Message-ID: <20150217100430.GA15881@red-moon> References: <20150216121435.203983131@infradead.org> <20150216122413.937924719@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150216122413.937924719@infradead.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 16, 2015 at 12:15:08PM +0000, Peter Zijlstra wrote: > From: Thomas Gleixner > > We keep adding unconditional stuff to the core code which just bloats > the text and data size for no value. hrtimer based broadcasting is > currently only used on arm64 and powerpc. Make it conditional. > > While at it move these tick related interfaces out of the clockchips > header file. > > Signed-off-by: Thomas Gleixner > Cc: Preeti U Murthy > Cc: Michael Ellerman > Cc: Benjamin Herrenschmidt > Cc: Lorenzo Pieralisi Reviewed-by: Lorenzo Pieralisi > --- > arch/arm/kernel/smp.c | 2 +- > arch/arm64/Kconfig | 1 + > arch/arm64/kernel/smp.c | 1 + > arch/arm64/kernel/time.c | 2 +- > arch/mips/kernel/smp.c | 1 + > arch/powerpc/Kconfig | 1 + > arch/powerpc/kernel/smp.c | 1 + > arch/powerpc/kernel/time.c | 2 +- > include/linux/clockchips.h | 26 +------------------------- > include/linux/tick.h | 25 +++++++++++++++++++++++-- > kernel/time/Kconfig | 4 ++++ > kernel/time/Makefile | 6 ++---- > kernel/time/tick-broadcast.c | 4 +++- > 13 files changed, 41 insertions(+), 35 deletions(-) > > Index: linux/arch/arm/kernel/smp.c > =================================================================== > --- linux.orig/arch/arm/kernel/smp.c > +++ linux/arch/arm/kernel/smp.c > @@ -22,7 +22,7 @@ > #include > #include > #include > -#include > +#include > #include > #include > #include > Index: linux/arch/arm64/Kconfig > =================================================================== > --- linux.orig/arch/arm64/Kconfig > +++ linux/arch/arm64/Kconfig > @@ -25,6 +25,7 @@ config ARM64 > select GENERIC_ALLOCATOR > select GENERIC_CLOCKEVENTS > select GENERIC_CLOCKEVENTS_BROADCAST if SMP > + select GENERIC_CLOCKEVENTS_HRTIMER_BROADCAST if SMP > select GENERIC_CPU_AUTOPROBE > select GENERIC_EARLY_IOREMAP > select GENERIC_IRQ_PROBE > Index: linux/arch/arm64/kernel/smp.c > =================================================================== > --- linux.orig/arch/arm64/kernel/smp.c > +++ linux/arch/arm64/kernel/smp.c > @@ -36,6 +36,7 @@ > #include > #include > #include > +#include > > #include > #include > Index: linux/arch/arm64/kernel/time.c > =================================================================== > --- linux.orig/arch/arm64/kernel/time.c > +++ linux/arch/arm64/kernel/time.c > @@ -18,11 +18,11 @@ > * along with this program. If not, see . > */ > > -#include > #include > #include > #include > #include > +#include > #include > #include > #include > Index: linux/arch/mips/kernel/smp.c > =================================================================== > --- linux.orig/arch/mips/kernel/smp.c > +++ linux/arch/mips/kernel/smp.c > @@ -33,6 +33,7 @@ > #include > #include > #include > +#include > > #include > #include > Index: linux/arch/powerpc/Kconfig > =================================================================== > --- linux.orig/arch/powerpc/Kconfig > +++ linux/arch/powerpc/Kconfig > @@ -135,6 +135,7 @@ config PPC > select GENERIC_TIME_VSYSCALL_OLD > select GENERIC_CLOCKEVENTS > select GENERIC_CLOCKEVENTS_BROADCAST if SMP > + select GENERIC_CLOCKEVENTS_HRTIMER_BROADCAST if SMP > select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST > select GENERIC_STRNCPY_FROM_USER > select GENERIC_STRNLEN_USER > Index: linux/arch/powerpc/kernel/smp.c > =================================================================== > --- linux.orig/arch/powerpc/kernel/smp.c > +++ linux/arch/powerpc/kernel/smp.c > @@ -31,6 +31,7 @@ > #include > #include > #include > +#include > > #include > #include > Index: linux/arch/powerpc/kernel/time.c > =================================================================== > --- linux.orig/arch/powerpc/kernel/time.c > +++ linux/arch/powerpc/kernel/time.c > @@ -42,7 +42,7 @@ > #include > #include > #include > -#include > +#include > #include > #include > #include > Index: linux/include/linux/clockchips.h > =================================================================== > --- linux.orig/include/linux/clockchips.h > +++ linux/include/linux/clockchips.h > @@ -155,29 +155,5 @@ extern void clockevents_set_mode(struct > enum clock_event_mode mode); > extern int clockevents_program_event(struct clock_event_device *dev, > ktime_t expires, bool force); > - > -#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST > -#ifdef CONFIG_ARCH_HAS_TICK_BROADCAST > -extern void tick_broadcast(const struct cpumask *mask); > -#else > -#define tick_broadcast NULL > -#endif > -extern int tick_receive_broadcast(void); > -#endif > - > -#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT) > -extern void tick_setup_hrtimer_broadcast(void); > -extern int tick_check_broadcast_expired(void); > -#else > -static inline int tick_check_broadcast_expired(void) { return 0; } > -static inline void tick_setup_hrtimer_broadcast(void) {}; > -#endif > - > -#else /* CONFIG_GENERIC_CLOCKEVENTS */ > - > -static inline int tick_check_broadcast_expired(void) { return 0; } > -static inline void tick_setup_hrtimer_broadcast(void) {}; > - > -#endif > - > +#endif /* CONFIG_GENERIC_CLOCKEVENTS */ > #endif > Index: linux/include/linux/tick.h > =================================================================== > --- linux.orig/include/linux/tick.h > +++ linux/include/linux/tick.h > @@ -65,10 +65,8 @@ static inline void tick_broadcast_contro > > #if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT) > extern int tick_broadcast_oneshot_control(enum tick_broadcast_state state); > -extern void tick_takeover(int deadcpu); > #else > static inline int tick_broadcast_oneshot_control(enum tick_broadcast_state state) { return 0; } > -static inline void tick_takeover(int deadcpu) { } > #endif > > static inline void tick_broadcast_enable(void) > @@ -181,4 +179,27 @@ static inline void tick_nohz_task_switch > __tick_nohz_task_switch(tsk); > } > > +#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST > +#ifdef CONFIG_ARCH_HAS_TICK_BROADCAST > +extern void tick_broadcast(const struct cpumask *mask); > +#else > +#define tick_broadcast NULL > +#endif > +extern int tick_receive_broadcast(void); > +#endif > + > +#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT) > +extern int tick_check_broadcast_expired(void); > +#else > +static inline int tick_check_broadcast_expired(void) { return 0; } > +#endif > + > +#ifdef CONFIG_GENERIC_CLOCKEVENTS_HRTIMER_BROADCAST > +extern void tick_setup_hrtimer_broadcast(void); > +extern void tick_takeover(int deadcpu); > +#else > +static inline void tick_setup_hrtimer_broadcast(void) { }; > +static inline void tick_takeover(int deadcpu) { } > +#endif > + > #endif > Index: linux/kernel/time/Kconfig > =================================================================== > --- linux.orig/kernel/time/Kconfig > +++ linux/kernel/time/Kconfig > @@ -42,6 +42,10 @@ config GENERIC_CLOCKEVENTS_BROADCAST > bool > depends on GENERIC_CLOCKEVENTS > > +config GENERIC_CLOCKEVENTS_HRTIMER_BROADCAST > + bool > + depends on GENERIC_CLOCKEVENTS && TICK_ONESHOT > + > # Automatically adjust the min. reprogramming time for > # clock event device > config GENERIC_CLOCKEVENTS_MIN_ADJUST > Index: linux/kernel/time/Makefile > =================================================================== > --- linux.orig/kernel/time/Makefile > +++ linux/kernel/time/Makefile > @@ -3,10 +3,8 @@ obj-y += timekeeping.o ntp.o clocksource > obj-y += timeconv.o posix-clock.o alarmtimer.o > > obj-$(CONFIG_GENERIC_CLOCKEVENTS) += clockevents.o tick-common.o > -ifeq ($(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST),y) > - obj-y += tick-broadcast.o > - obj-$(CONFIG_TICK_ONESHOT) += tick-broadcast-hrtimer.o > -endif > +obj-$(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) += tick-broadcast.o > +obj-$(CONFIG_GENERIC_CLOCKEVENTS_HRTIMER_BROADCAST) += tick-broadcast-hrtimer.o > obj-$(CONFIG_GENERIC_SCHED_CLOCK) += sched_clock.o > obj-$(CONFIG_TICK_ONESHOT) += tick-oneshot.o tick-sched.o > obj-$(CONFIG_TIMER_STATS) += timer_stats.o > Index: linux/kernel/time/tick-broadcast.c > =================================================================== > --- linux.orig/kernel/time/tick-broadcast.c > +++ linux/kernel/time/tick-broadcast.c > @@ -908,6 +908,7 @@ void tick_broadcast_switch_to_oneshot(vo > } > > #ifdef CONFIG_HOTPLUG_CPU > +#ifdef CONFIG_GENERIC_CLOCKEVENTS_HRTIMER_BROADCAST > /* > * Called from the cpu hotplug code after a cpu is dead. This ensures > * that a hrtimer based broad cast device is taken over. > @@ -916,7 +917,7 @@ void tick_broadcast_switch_to_oneshot(vo > * which pushes the hrtimer over to a different cpu from > * tick_shutdown_broadcast_oneshot() > */ > -void tick_broadcast_takeover_bc(int deadcpu) > +void tick_takeover(int deadcpu) > { > struct clock_event_device *bc; > unsigned long flags; > @@ -929,6 +930,7 @@ void tick_broadcast_takeover_bc(int dead > } > raw_spin_unlock_irqrestore(&tick_broadcast_lock, flags); > } > +#endif > > /* > * Remove a dead CPU from broadcasting, called with broadcast lock > > >