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

Commit d6ad4187 authored by John Stultz's avatar John Stultz
Browse files

time: Kill xtime_lock, replacing it with jiffies_lock



Now that timekeeping is protected by its own locks, rename
the xtime_lock to jifffies_lock to better describe what it
protects.

CC: Thomas Gleixner <tglx@linutronix.de>
CC: Eric Dumazet <eric.dumazet@gmail.com>
CC: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
parent 47c8c91b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ static cycle_t i8253_read(struct clocksource *cs)

	raw_spin_lock_irqsave(&i8253_lock, flags);
	/*
	 * Although our caller may have the read side of xtime_lock,
	 * Although our caller may have the read side of jiffies_lock,
	 * this is now a seqlock, and we are cheating in this routine
	 * by having side effects on state that we cannot undo if
	 * there is a collision on the seqlock and our caller has to
+2 −1
Original line number Diff line number Diff line
@@ -70,11 +70,12 @@ extern int register_refined_jiffies(long clock_tick_rate);

/*
 * The 64-bit value is not atomic - you MUST NOT read it
 * without sampling the sequence number in xtime_lock.
 * without sampling the sequence number in jiffies_lock.
 * get_jiffies_64() will do this for you as appropriate.
 */
extern u64 __jiffy_data jiffies_64;
extern unsigned long volatile __jiffy_data jiffies;
extern seqlock_t jiffies_lock;

#if (BITS_PER_LONG < 64)
u64 get_jiffies_64(void);
+4 −2
Original line number Diff line number Diff line
@@ -67,6 +67,8 @@ static struct clocksource clocksource_jiffies = {
	.shift		= JIFFIES_SHIFT,
};

__cacheline_aligned_in_smp DEFINE_SEQLOCK(jiffies_lock);

#if (BITS_PER_LONG < 64)
u64 get_jiffies_64(void)
{
@@ -74,9 +76,9 @@ u64 get_jiffies_64(void)
	u64 ret;

	do {
		seq = read_seqbegin(&xtime_lock);
		seq = read_seqbegin(&jiffies_lock);
		ret = jiffies_64;
	} while (read_seqretry(&xtime_lock, seq));
	} while (read_seqretry(&jiffies_lock, seq));
	return ret;
}
EXPORT_SYMBOL(get_jiffies_64);
+4 −4
Original line number Diff line number Diff line
@@ -63,13 +63,13 @@ int tick_is_oneshot_available(void)
static void tick_periodic(int cpu)
{
	if (tick_do_timer_cpu == cpu) {
		write_seqlock(&xtime_lock);
		write_seqlock(&jiffies_lock);

		/* Keep track of the next tick event */
		tick_next_period = ktime_add(tick_next_period, tick_period);

		do_timer(1);
		write_sequnlock(&xtime_lock);
		write_sequnlock(&jiffies_lock);
	}

	update_process_times(user_mode(get_irq_regs()));
@@ -130,9 +130,9 @@ void tick_setup_periodic(struct clock_event_device *dev, int broadcast)
		ktime_t next;

		do {
			seq = read_seqbegin(&xtime_lock);
			seq = read_seqbegin(&jiffies_lock);
			next = tick_next_period;
		} while (read_seqretry(&xtime_lock, seq));
		} while (read_seqretry(&jiffies_lock, seq));

		clockevents_set_mode(dev, CLOCK_EVT_MODE_ONESHOT);

+0 −1
Original line number Diff line number Diff line
@@ -141,4 +141,3 @@ static inline int tick_device_is_functional(struct clock_event_device *dev)
#endif

extern void do_timer(unsigned long ticks);
extern seqlock_t xtime_lock;
Loading