Release 4.7 kernel/time/tick-oneshot.c
/*
* linux/kernel/time/tick-oneshot.c
*
* This file contains functions which manage high resolution tick
* related events.
*
* Copyright(C) 2005-2006, Thomas Gleixner <tglx@linutronix.de>
* Copyright(C) 2005-2007, Red Hat, Inc., Ingo Molnar
* Copyright(C) 2006-2007, Timesys Corp., Thomas Gleixner
*
* This code is licenced under the GPL version 2. For details see
* kernel-base/COPYING.
*/
#include <linux/cpu.h>
#include <linux/err.h>
#include <linux/hrtimer.h>
#include <linux/interrupt.h>
#include <linux/percpu.h>
#include <linux/profile.h>
#include <linux/sched.h>
#include "tick-internal.h"
/**
* tick_program_event
*/
int tick_program_event(ktime_t expires, int force)
{
struct clock_event_device *dev = __this_cpu_read(tick_cpu_device.evtdev);
if (unlikely(expires.tv64 == KTIME_MAX)) {
/*
* We don't need the clock event device any more, stop it.
*/
clockevents_switch_state(dev, CLOCK_EVT_STATE_ONESHOT_STOPPED);
return 0;
}
if (unlikely(clockevent_state_oneshot_stopped(dev))) {
/*
* We need the clock event again, configure it in ONESHOT mode
* before using it.
*/
clockevents_switch_state(dev, CLOCK_EVT_STATE_ONESHOT);
}
return clockevents_program_event(dev, expires, force);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
viresh kumar | viresh kumar | 42 | 54.55% | 2 | 33.33% |
thomas gleixner | thomas gleixner | 32 | 41.56% | 2 | 33.33% |
christoph lameter | christoph lameter | 2 | 2.60% | 1 | 16.67% |
martin schwidefsky | martin schwidefsky | 1 | 1.30% | 1 | 16.67% |
| Total | 77 | 100.00% | 6 | 100.00% |
/**
* tick_resume_onshot - resume oneshot mode
*/
void tick_resume_oneshot(void)
{
struct clock_event_device *dev = __this_cpu_read(tick_cpu_device.evtdev);
clockevents_switch_state(dev, CLOCK_EVT_STATE_ONESHOT);
clockevents_program_event(dev, ktime_get(), true);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
thomas gleixner | thomas gleixner | 26 | 72.22% | 2 | 50.00% |
martin schwidefsky | martin schwidefsky | 9 | 25.00% | 1 | 25.00% |
viresh kumar | viresh kumar | 1 | 2.78% | 1 | 25.00% |
| Total | 36 | 100.00% | 4 | 100.00% |
/**
* tick_setup_oneshot - setup the event device for oneshot mode (hres or nohz)
*/
void tick_setup_oneshot(struct clock_event_device *newdev,
void (*handler)(struct clock_event_device *),
ktime_t next_event)
{
newdev->event_handler = handler;
clockevents_switch_state(newdev, CLOCK_EVT_STATE_ONESHOT);
clockevents_program_event(newdev, next_event, true);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
thomas gleixner | thomas gleixner | 43 | 93.48% | 2 | 50.00% |
martin schwidefsky | martin schwidefsky | 2 | 4.35% | 1 | 25.00% |
viresh kumar | viresh kumar | 1 | 2.17% | 1 | 25.00% |
| Total | 46 | 100.00% | 4 | 100.00% |
/**
* tick_switch_to_oneshot - switch to oneshot mode
*/
int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *))
{
struct tick_device *td = this_cpu_ptr(&tick_cpu_device);
struct clock_event_device *dev = td->evtdev;
if (!dev || !(dev->features & CLOCK_EVT_FEAT_ONESHOT) ||
!tick_device_is_functional(dev)) {
printk(KERN_INFO "Clockevents: "
"could not switch to one-shot mode:");
if (!dev) {
printk(" no tick device\n");
} else {
if (!tick_device_is_functional(dev))
printk(" %s is not functional.\n", dev->name);
else
printk(" %s does not support one-shot mode.\n",
dev->name);
}
return -EINVAL;
}
td->mode = TICKDEV_MODE_ONESHOT;
dev->event_handler = handler;
clockevents_switch_state(dev, CLOCK_EVT_STATE_ONESHOT);
tick_broadcast_switch_to_oneshot();
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
thomas gleixner | thomas gleixner | 82 | 60.29% | 2 | 40.00% |
ingo molnar | ingo molnar | 51 | 37.50% | 1 | 20.00% |
christoph lameter | christoph lameter | 2 | 1.47% | 1 | 20.00% |
viresh kumar | viresh kumar | 1 | 0.74% | 1 | 20.00% |
| Total | 136 | 100.00% | 5 | 100.00% |
/**
* tick_check_oneshot_mode - check whether the system is in oneshot mode
*
* returns 1 when either nohz or highres are enabled. otherwise 0.
*/
int tick_oneshot_mode_active(void)
{
unsigned long flags;
int ret;
local_irq_save(flags);
ret = __this_cpu_read(tick_cpu_device.mode) == TICKDEV_MODE_ONESHOT;
local_irq_restore(flags);
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
thomas gleixner | thomas gleixner | 36 | 94.74% | 1 | 50.00% |
christoph lameter | christoph lameter | 2 | 5.26% | 1 | 50.00% |
| Total | 38 | 100.00% | 2 | 100.00% |
#ifdef CONFIG_HIGH_RES_TIMERS
/**
* tick_init_highres - switch to high resolution mode
*
* Called with interrupts disabled.
*/
int tick_init_highres(void)
{
return tick_switch_to_oneshot(hrtimer_interrupt);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
thomas gleixner | thomas gleixner | 13 | 100.00% | 1 | 100.00% |
| Total | 13 | 100.00% | 1 | 100.00% |
#endif
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
thomas gleixner | thomas gleixner | 267 | 69.90% | 5 | 38.46% |
ingo molnar | ingo molnar | 51 | 13.35% | 1 | 7.69% |
viresh kumar | viresh kumar | 45 | 11.78% | 3 | 23.08% |
martin schwidefsky | martin schwidefsky | 12 | 3.14% | 1 | 7.69% |
christoph lameter | christoph lameter | 6 | 1.57% | 2 | 15.38% |
russell king | russell king | 1 | 0.26% | 1 | 7.69% |
| Total | 382 | 100.00% | 13 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.