cregit-Linux how code gets into the kernel

Release 4.15 kernel/time/tick-oneshot.c

Directory: kernel/time
/*
 * 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 == KTIME_MAX)) { /* * We don't need the clock event device any more, stop it. */ clockevents_switch_state(dev, CLOCK_EVT_STATE_ONESHOT_STOPPED); dev->next_event = KTIME_MAX; 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

PersonTokensPropCommitsCommitProp
Viresh Kumar4049.38%228.57%
Thomas Gleixner3239.51%228.57%
Prasad Sodagudi67.41%114.29%
Christoph Lameter22.47%114.29%
Martin Schwidefsky11.23%114.29%
Total81100.00%7100.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

PersonTokensPropCommitsCommitProp
Thomas Gleixner2672.22%250.00%
Martin Schwidefsky925.00%125.00%
Viresh Kumar12.78%125.00%
Total36100.00%4100.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

PersonTokensPropCommitsCommitProp
Thomas Gleixner4393.48%250.00%
Martin Schwidefsky24.35%125.00%
Viresh Kumar12.17%125.00%
Total46100.00%4100.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

PersonTokensPropCommitsCommitProp
Thomas Gleixner8260.29%240.00%
Ingo Molnar5137.50%120.00%
Christoph Lameter21.47%120.00%
Viresh Kumar10.74%120.00%
Total136100.00%5100.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

PersonTokensPropCommitsCommitProp
Thomas Gleixner3694.74%150.00%
Christoph Lameter25.26%150.00%
Total38100.00%2100.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

PersonTokensPropCommitsCommitProp
Thomas Gleixner13100.00%1100.00%
Total13100.00%1100.00%

#endif

Overall Contributors

PersonTokensPropCommitsCommitProp
Thomas Gleixner26769.17%535.71%
Ingo Molnar5113.21%17.14%
Viresh Kumar4311.14%321.43%
Martin Schwidefsky123.11%17.14%
Christoph Lameter61.55%214.29%
Prasad Sodagudi61.55%17.14%
Russell King10.26%17.14%
Total386100.00%14100.00%
Directory: kernel/time
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.