Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d27c8438 authored by Ingo Molnar's avatar Ingo Molnar
Browse files

Merge branch 'timers/core' into sched/idle



Avoid heavy conflicts caused by WIP patches in drivers/cpuidle/cpuidle.c,
by merging these into a single base.

Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents 2b3942e4 bce19369
Loading
Loading
Loading
Loading
+8 −6
Original line number Original line Diff line number Diff line
@@ -140,12 +140,14 @@ int cpuidle_idle_call(void)
		return 0;
		return 0;
	}
	}


	trace_cpu_idle_rcuidle(next_state, dev->cpu);

	broadcast = !!(drv->states[next_state].flags & CPUIDLE_FLAG_TIMER_STOP);
	broadcast = !!(drv->states[next_state].flags & CPUIDLE_FLAG_TIMER_STOP);


	if (broadcast)
	if (broadcast &&
		clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu);
	    clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu))
		return -EBUSY;


	trace_cpu_idle_rcuidle(next_state, dev->cpu);


	if (cpuidle_state_is_coupled(dev, drv, next_state))
	if (cpuidle_state_is_coupled(dev, drv, next_state))
		entered_state = cpuidle_enter_state_coupled(dev, drv,
		entered_state = cpuidle_enter_state_coupled(dev, drv,
@@ -153,11 +155,11 @@ int cpuidle_idle_call(void)
	else
	else
		entered_state = cpuidle_enter_state(dev, drv, next_state);
		entered_state = cpuidle_enter_state(dev, drv, next_state);


	trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu);

	if (broadcast)
	if (broadcast)
		clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);
		clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu);


	trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu);

	/* give the governor an opportunity to reflect on the outcome */
	/* give the governor an opportunity to reflect on the outcome */
	if (cpuidle_curr_governor->reflect)
	if (cpuidle_curr_governor->reflect)
		cpuidle_curr_governor->reflect(dev, entered_state);
		cpuidle_curr_governor->reflect(dev, entered_state);
+13 −3
Original line number Original line Diff line number Diff line
@@ -62,6 +62,11 @@ enum clock_event_mode {
#define CLOCK_EVT_FEAT_DYNIRQ		0x000020
#define CLOCK_EVT_FEAT_DYNIRQ		0x000020
#define CLOCK_EVT_FEAT_PERCPU		0x000040
#define CLOCK_EVT_FEAT_PERCPU		0x000040


/*
 * Clockevent device is based on a hrtimer for broadcast
 */
#define CLOCK_EVT_FEAT_HRTIMER		0x000080

/**
/**
 * struct clock_event_device - clock event device descriptor
 * struct clock_event_device - clock event device descriptor
 * @event_handler:	Assigned by the framework to be called by the low
 * @event_handler:	Assigned by the framework to be called by the low
@@ -83,6 +88,7 @@ enum clock_event_mode {
 * @name:		ptr to clock event name
 * @name:		ptr to clock event name
 * @rating:		variable to rate clock event devices
 * @rating:		variable to rate clock event devices
 * @irq:		IRQ number (only for non CPU local devices)
 * @irq:		IRQ number (only for non CPU local devices)
 * @bound_on:		Bound on CPU
 * @cpumask:		cpumask to indicate for which CPUs this device works
 * @cpumask:		cpumask to indicate for which CPUs this device works
 * @list:		list head for the management code
 * @list:		list head for the management code
 * @owner:		module reference
 * @owner:		module reference
@@ -113,6 +119,7 @@ struct clock_event_device {
	const char		*name;
	const char		*name;
	int			rating;
	int			rating;
	int			irq;
	int			irq;
	int			bound_on;
	const struct cpumask	*cpumask;
	const struct cpumask	*cpumask;
	struct list_head	list;
	struct list_head	list;
	struct module		*owner;
	struct module		*owner;
@@ -180,15 +187,17 @@ extern int tick_receive_broadcast(void);
#endif
#endif


#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT)
#if defined(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) && defined(CONFIG_TICK_ONESHOT)
extern void tick_setup_hrtimer_broadcast(void);
extern int tick_check_broadcast_expired(void);
extern int tick_check_broadcast_expired(void);
#else
#else
static inline int tick_check_broadcast_expired(void) { return 0; }
static inline int tick_check_broadcast_expired(void) { return 0; }
static inline void tick_setup_hrtimer_broadcast(void) {};
#endif
#endif


#ifdef CONFIG_GENERIC_CLOCKEVENTS
#ifdef CONFIG_GENERIC_CLOCKEVENTS
extern void clockevents_notify(unsigned long reason, void *arg);
extern int clockevents_notify(unsigned long reason, void *arg);
#else
#else
static inline void clockevents_notify(unsigned long reason, void *arg) {}
static inline int clockevents_notify(unsigned long reason, void *arg) { return 0; }
#endif
#endif


#else /* CONFIG_GENERIC_CLOCKEVENTS_BUILD */
#else /* CONFIG_GENERIC_CLOCKEVENTS_BUILD */
@@ -196,8 +205,9 @@ static inline void clockevents_notify(unsigned long reason, void *arg) {}
static inline void clockevents_suspend(void) {}
static inline void clockevents_suspend(void) {}
static inline void clockevents_resume(void) {}
static inline void clockevents_resume(void) {}


static inline void clockevents_notify(unsigned long reason, void *arg) {}
static inline int clockevents_notify(unsigned long reason, void *arg) { return 0; }
static inline int tick_check_broadcast_expired(void) { return 0; }
static inline int tick_check_broadcast_expired(void) { return 0; }
static inline void tick_setup_hrtimer_broadcast(void) {};


#endif
#endif


+1 −1
Original line number Original line Diff line number Diff line
@@ -124,7 +124,7 @@ config NO_HZ_FULL
endchoice
endchoice


config NO_HZ_FULL_ALL
config NO_HZ_FULL_ALL
       bool "Full dynticks system on all CPUs by default"
       bool "Full dynticks system on all CPUs by default (except CPU 0)"
       depends on NO_HZ_FULL
       depends on NO_HZ_FULL
       help
       help
         If the user doesn't pass the nohz_full boot option to
         If the user doesn't pass the nohz_full boot option to
+4 −1
Original line number Original line Diff line number Diff line
@@ -3,7 +3,10 @@ obj-y += timeconv.o posix-clock.o alarmtimer.o


obj-$(CONFIG_GENERIC_CLOCKEVENTS_BUILD)		+= clockevents.o
obj-$(CONFIG_GENERIC_CLOCKEVENTS_BUILD)		+= clockevents.o
obj-$(CONFIG_GENERIC_CLOCKEVENTS)		+= tick-common.o
obj-$(CONFIG_GENERIC_CLOCKEVENTS)		+= tick-common.o
obj-$(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST)	+= tick-broadcast.o
ifeq ($(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST),y)
 obj-y						+= tick-broadcast.o
 obj-$(CONFIG_TICK_ONESHOT)			+= tick-broadcast-hrtimer.o
endif
obj-$(CONFIG_GENERIC_SCHED_CLOCK)		+= sched_clock.o
obj-$(CONFIG_GENERIC_SCHED_CLOCK)		+= sched_clock.o
obj-$(CONFIG_TICK_ONESHOT)			+= tick-oneshot.o
obj-$(CONFIG_TICK_ONESHOT)			+= tick-oneshot.o
obj-$(CONFIG_TICK_ONESHOT)			+= tick-sched.o
obj-$(CONFIG_TICK_ONESHOT)			+= tick-sched.o
+30 −10
Original line number Original line Diff line number Diff line
@@ -439,6 +439,19 @@ void clockevents_config_and_register(struct clock_event_device *dev,
}
}
EXPORT_SYMBOL_GPL(clockevents_config_and_register);
EXPORT_SYMBOL_GPL(clockevents_config_and_register);


int __clockevents_update_freq(struct clock_event_device *dev, u32 freq)
{
	clockevents_config(dev, freq);

	if (dev->mode == CLOCK_EVT_MODE_ONESHOT)
		return clockevents_program_event(dev, dev->next_event, false);

	if (dev->mode == CLOCK_EVT_MODE_PERIODIC)
		dev->set_mode(CLOCK_EVT_MODE_PERIODIC, dev);

	return 0;
}

/**
/**
 * clockevents_update_freq - Update frequency and reprogram a clock event device.
 * clockevents_update_freq - Update frequency and reprogram a clock event device.
 * @dev:	device to modify
 * @dev:	device to modify
@@ -446,17 +459,22 @@ EXPORT_SYMBOL_GPL(clockevents_config_and_register);
 *
 *
 * Reconfigure and reprogram a clock event device in oneshot
 * Reconfigure and reprogram a clock event device in oneshot
 * mode. Must be called on the cpu for which the device delivers per
 * mode. Must be called on the cpu for which the device delivers per
 * cpu timer events with interrupts disabled!  Returns 0 on success,
 * cpu timer events. If called for the broadcast device the core takes
 * -ETIME when the event is in the past.
 * care of serialization.
 *
 * Returns 0 on success, -ETIME when the event is in the past.
 */
 */
int clockevents_update_freq(struct clock_event_device *dev, u32 freq)
int clockevents_update_freq(struct clock_event_device *dev, u32 freq)
{
{
	clockevents_config(dev, freq);
	unsigned long flags;

	int ret;
	if (dev->mode != CLOCK_EVT_MODE_ONESHOT)
		return 0;


	return clockevents_program_event(dev, dev->next_event, false);
	local_irq_save(flags);
	ret = tick_broadcast_update_freq(dev, freq);
	if (ret == -ENODEV)
		ret = __clockevents_update_freq(dev, freq);
	local_irq_restore(flags);
	return ret;
}
}


/*
/*
@@ -524,12 +542,13 @@ void clockevents_resume(void)
#ifdef CONFIG_GENERIC_CLOCKEVENTS
#ifdef CONFIG_GENERIC_CLOCKEVENTS
/**
/**
 * clockevents_notify - notification about relevant events
 * clockevents_notify - notification about relevant events
 * Returns 0 on success, any other value on error
 */
 */
void clockevents_notify(unsigned long reason, void *arg)
int clockevents_notify(unsigned long reason, void *arg)
{
{
	struct clock_event_device *dev, *tmp;
	struct clock_event_device *dev, *tmp;
	unsigned long flags;
	unsigned long flags;
	int cpu;
	int cpu, ret = 0;


	raw_spin_lock_irqsave(&clockevents_lock, flags);
	raw_spin_lock_irqsave(&clockevents_lock, flags);


@@ -542,7 +561,7 @@ void clockevents_notify(unsigned long reason, void *arg)


	case CLOCK_EVT_NOTIFY_BROADCAST_ENTER:
	case CLOCK_EVT_NOTIFY_BROADCAST_ENTER:
	case CLOCK_EVT_NOTIFY_BROADCAST_EXIT:
	case CLOCK_EVT_NOTIFY_BROADCAST_EXIT:
		tick_broadcast_oneshot_control(reason);
		ret = tick_broadcast_oneshot_control(reason);
		break;
		break;


	case CLOCK_EVT_NOTIFY_CPU_DYING:
	case CLOCK_EVT_NOTIFY_CPU_DYING:
@@ -585,6 +604,7 @@ void clockevents_notify(unsigned long reason, void *arg)
		break;
		break;
	}
	}
	raw_spin_unlock_irqrestore(&clockevents_lock, flags);
	raw_spin_unlock_irqrestore(&clockevents_lock, flags);
	return ret;
}
}
EXPORT_SYMBOL_GPL(clockevents_notify);
EXPORT_SYMBOL_GPL(clockevents_notify);


Loading