* refs/heads/tmp-127372f: Linux 4.9.74 mm/vmstat: Make NR_TLB_REMOTE_FLUSH_RECEIVED available even on UP tty: fix tty_ldisc_receive_buf() documentation n_tty: fix EXTPROC vs ICANON interaction with TIOCINQ (aka FIONREAD) x86/smpboot: Remove stale TLB flush invocations nohz: Prevent a timer interrupt storm in tick_nohz_stop_sched_tick() timers: Reinitialize per cpu bases on hotplug timers: Invoke timer_start_debug() where it makes sense timers: Use deferrable base independent of base::nohz_active usb: xhci: Add XHCI_TRUST_TX_LENGTH for Renesas uPD720201 USB: Fix off by one in type-specific length check of BOS SSP capability usb: add RESET_RESUME for ELSA MicroLink 56K usb: Add device quirk for Logitech HD Pro Webcam C925e USB: serial: option: adding support for YUGA CLM920-NC5 USB: serial: option: add support for Telit ME910 PID 0x1101 USB: serial: qcserial: add Sierra Wireless EM7565 USB: serial: ftdi_sio: add id for Airbus DS P8GR usbip: vhci: stop printing kernel pointer addresses in messages usbip: stub: stop printing kernel pointer addresses in messages usbip: prevent leaking socket pointer address in messages usbip: fix usbip bind writing random string after command in match_busid s390/qeth: update takeover IPs after configuration change s390/qeth: lock IP table while applying takeover changes s390/qeth: don't apply takeover changes to RXIP s390/qeth: apply takeover changes when mode is toggled net/mlx5: Fix error flow in CREATE_QP command net/mlx5e: Prevent possible races in VXLAN control flow net/mlx5e: Add refcount to VXLAN structure net/mlx5e: Fix possible deadlock of VXLAN lock net/mlx5e: Fix features check of IPv6 traffic net/mlx5: Fix rate limit packet pacing naming and struct tcp: invalidate rate samples during SACK reneging sock: free skb in skb_complete_tx_timestamp on error net: phy: micrel: ksz9031: reconfigure autoneg after phy autoneg workaround net: Fix double free and memory corruption in get_net_ns_by_id() net: fec: Allow reception of frames bigger than 1522 bytes net: bridge: fix early call to br_stp_change_bridge_id and plug newlink leaks ipv4: Fix use-after-free when flushing FIB tables adding missing rcu_read_unlock in ipxip6_rcv sctp: Replace use of sockets_allocated with specified macro. net: mvmdio: disable/unprepare clocks in EPROBE_DEFER case net: ipv4: fix for a race condition in raw_sendmsg tg3: Fix rx hang on MTU change with 5717/5719 tcp md5sig: Use skb's saddr when replying to an incoming segment tcp_bbr: record "full bw reached" decision in new full_bw_reached bit RDS: Check cmsg_len before dereferencing CMSG_DATA ptr_ring: add barriers net: reevalulate autoflowlabel setting after sysctl setting net: qmi_wwan: add Sierra EM7565 1199:9091 netlink: Add netns check on taps net: igmp: Use correct source address on IGMPv3 reports net: fec: unmap the xmit buffer that are not transferred by DMA ipv6: mcast: better catch silly mtu values ipv4: igmp: guard against silly MTU values kbuild: add '-fno-stack-check' to kernel build options x86/mm/64: Fix reboot interaction with CR4.PCIDE x86/mm: Enable CR4.PCIDE on supported systems x86/mm: Add the 'nopcid' boot option to turn off PCID x86/mm: Disable PCID on 32-bit kernels x86/mm: Remove the UP asm/tlbflush.h code, always use the (formerly) SMP code x86/mm: Reimplement flush_tlb_page() using flush_tlb_mm_range() x86/mm: Make flush_tlb_mm_range() more predictable x86/mm: Remove flush_tlb() and flush_tlb_current_task() x86/vm86/32: Switch to flush_tlb_mm_range() in mark_screen_rdonly() ALSA: hda - fix headset mic detection issue on a Dell machine ALSA: hda: Drop useless WARN_ON() ASoC: tlv320aic31xx: Fix GPIO1 register definition ASoC: twl4030: fix child-node lookup ASoC: fsl_ssi: AC'97 ops need regmap, clock and cleaning up on failure ASoC: da7218: fix fix child-node lookup ASoC: wm_adsp: Fix validation of firmware and coeff lengths iw_cxgb4: Only validate the MSN for successful completions ring-buffer: Mask out the info bits when returning buffer page length tracing: Fix crash when it fails to alloc ring buffer tracing: Fix possible double free on failure of allocating trace buffer tracing: Remove extra zeroing out of the ring buffer page sync objtool's copy of x86-opcode-map.txt Conflicts: include/linux/cpuhotplug.h kernel/time/timer.c Change-Id: I0198e2b75715d13acd86237321966774cd6d9f1d Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org>
248 lines
8.1 KiB
C
248 lines
8.1 KiB
C
#ifndef _LINUX_TIMER_H
|
|
#define _LINUX_TIMER_H
|
|
|
|
#include <linux/list.h>
|
|
#include <linux/ktime.h>
|
|
#include <linux/stddef.h>
|
|
#include <linux/debugobjects.h>
|
|
#include <linux/stringify.h>
|
|
|
|
struct tvec_base;
|
|
|
|
struct timer_list {
|
|
/*
|
|
* All fields that change during normal runtime grouped to the
|
|
* same cacheline
|
|
*/
|
|
struct hlist_node entry;
|
|
unsigned long expires;
|
|
void (*function)(unsigned long);
|
|
unsigned long data;
|
|
u32 flags;
|
|
|
|
#ifdef CONFIG_LOCKDEP
|
|
struct lockdep_map lockdep_map;
|
|
#endif
|
|
};
|
|
|
|
#ifdef CONFIG_LOCKDEP
|
|
/*
|
|
* NB: because we have to copy the lockdep_map, setting the lockdep_map key
|
|
* (second argument) here is required, otherwise it could be initialised to
|
|
* the copy of the lockdep_map later! We use the pointer to and the string
|
|
* "<file>:<line>" as the key resp. the name of the lockdep_map.
|
|
*/
|
|
#define __TIMER_LOCKDEP_MAP_INITIALIZER(_kn) \
|
|
.lockdep_map = STATIC_LOCKDEP_MAP_INIT(_kn, &_kn),
|
|
#else
|
|
#define __TIMER_LOCKDEP_MAP_INITIALIZER(_kn)
|
|
#endif
|
|
|
|
/*
|
|
* A deferrable timer will work normally when the system is busy, but
|
|
* will not cause a CPU to come out of idle just to service it; instead,
|
|
* the timer will be serviced when the CPU eventually wakes up with a
|
|
* subsequent non-deferrable timer.
|
|
*
|
|
* An irqsafe timer is executed with IRQ disabled and it's safe to wait for
|
|
* the completion of the running instance from IRQ handlers, for example,
|
|
* by calling del_timer_sync().
|
|
*
|
|
* Note: The irq disabled callback execution is a special case for
|
|
* workqueue locking issues. It's not meant for executing random crap
|
|
* with interrupts disabled. Abuse is monitored!
|
|
*/
|
|
#define TIMER_CPUMASK 0x0003FFFF
|
|
#define TIMER_MIGRATING 0x00040000
|
|
#define TIMER_BASEMASK (TIMER_CPUMASK | TIMER_MIGRATING)
|
|
#define TIMER_DEFERRABLE 0x00080000
|
|
#define TIMER_PINNED 0x00100000
|
|
#define TIMER_IRQSAFE 0x00200000
|
|
#define TIMER_ARRAYSHIFT 22
|
|
#define TIMER_ARRAYMASK 0xFFC00000
|
|
|
|
#define __TIMER_INITIALIZER(_function, _expires, _data, _flags) { \
|
|
.entry = { .next = TIMER_ENTRY_STATIC }, \
|
|
.function = (_function), \
|
|
.expires = (_expires), \
|
|
.data = (_data), \
|
|
.flags = (_flags), \
|
|
__TIMER_LOCKDEP_MAP_INITIALIZER( \
|
|
__FILE__ ":" __stringify(__LINE__)) \
|
|
}
|
|
|
|
#define TIMER_INITIALIZER(_function, _expires, _data) \
|
|
__TIMER_INITIALIZER((_function), (_expires), (_data), 0)
|
|
|
|
#define TIMER_PINNED_INITIALIZER(_function, _expires, _data) \
|
|
__TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_PINNED)
|
|
|
|
#define TIMER_DEFERRED_INITIALIZER(_function, _expires, _data) \
|
|
__TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_DEFERRABLE)
|
|
|
|
#define TIMER_PINNED_DEFERRED_INITIALIZER(_function, _expires, _data) \
|
|
__TIMER_INITIALIZER((_function), (_expires), (_data), TIMER_DEFERRABLE | TIMER_PINNED)
|
|
|
|
#define DEFINE_TIMER(_name, _function, _expires, _data) \
|
|
struct timer_list _name = \
|
|
TIMER_INITIALIZER(_function, _expires, _data)
|
|
|
|
void init_timer_key(struct timer_list *timer, unsigned int flags,
|
|
const char *name, struct lock_class_key *key);
|
|
|
|
#ifdef CONFIG_DEBUG_OBJECTS_TIMERS
|
|
extern void init_timer_on_stack_key(struct timer_list *timer,
|
|
unsigned int flags, const char *name,
|
|
struct lock_class_key *key);
|
|
extern void destroy_timer_on_stack(struct timer_list *timer);
|
|
#else
|
|
static inline void destroy_timer_on_stack(struct timer_list *timer) { }
|
|
static inline void init_timer_on_stack_key(struct timer_list *timer,
|
|
unsigned int flags, const char *name,
|
|
struct lock_class_key *key)
|
|
{
|
|
init_timer_key(timer, flags, name, key);
|
|
}
|
|
#endif
|
|
|
|
#ifdef CONFIG_LOCKDEP
|
|
#define __init_timer(_timer, _flags) \
|
|
do { \
|
|
static struct lock_class_key __key; \
|
|
init_timer_key((_timer), (_flags), #_timer, &__key); \
|
|
} while (0)
|
|
|
|
#define __init_timer_on_stack(_timer, _flags) \
|
|
do { \
|
|
static struct lock_class_key __key; \
|
|
init_timer_on_stack_key((_timer), (_flags), #_timer, &__key); \
|
|
} while (0)
|
|
#else
|
|
#define __init_timer(_timer, _flags) \
|
|
init_timer_key((_timer), (_flags), NULL, NULL)
|
|
#define __init_timer_on_stack(_timer, _flags) \
|
|
init_timer_on_stack_key((_timer), (_flags), NULL, NULL)
|
|
#endif
|
|
|
|
#define init_timer(timer) \
|
|
__init_timer((timer), 0)
|
|
#define init_timer_pinned(timer) \
|
|
__init_timer((timer), TIMER_PINNED)
|
|
#define init_timer_deferrable(timer) \
|
|
__init_timer((timer), TIMER_DEFERRABLE)
|
|
#define init_timer_pinned_deferrable(timer) \
|
|
__init_timer((timer), TIMER_DEFERRABLE | TIMER_PINNED)
|
|
#define init_timer_on_stack(timer) \
|
|
__init_timer_on_stack((timer), 0)
|
|
|
|
#define __setup_timer(_timer, _fn, _data, _flags) \
|
|
do { \
|
|
__init_timer((_timer), (_flags)); \
|
|
(_timer)->function = (_fn); \
|
|
(_timer)->data = (_data); \
|
|
} while (0)
|
|
|
|
#define __setup_timer_on_stack(_timer, _fn, _data, _flags) \
|
|
do { \
|
|
__init_timer_on_stack((_timer), (_flags)); \
|
|
(_timer)->function = (_fn); \
|
|
(_timer)->data = (_data); \
|
|
} while (0)
|
|
|
|
#define setup_timer(timer, fn, data) \
|
|
__setup_timer((timer), (fn), (data), 0)
|
|
#define setup_pinned_timer(timer, fn, data) \
|
|
__setup_timer((timer), (fn), (data), TIMER_PINNED)
|
|
#define setup_deferrable_timer(timer, fn, data) \
|
|
__setup_timer((timer), (fn), (data), TIMER_DEFERRABLE)
|
|
#define setup_pinned_deferrable_timer(timer, fn, data) \
|
|
__setup_timer((timer), (fn), (data), TIMER_DEFERRABLE | TIMER_PINNED)
|
|
#define setup_timer_on_stack(timer, fn, data) \
|
|
__setup_timer_on_stack((timer), (fn), (data), 0)
|
|
#define setup_pinned_timer_on_stack(timer, fn, data) \
|
|
__setup_timer_on_stack((timer), (fn), (data), TIMER_PINNED)
|
|
#define setup_deferrable_timer_on_stack(timer, fn, data) \
|
|
__setup_timer_on_stack((timer), (fn), (data), TIMER_DEFERRABLE)
|
|
#define setup_pinned_deferrable_timer_on_stack(timer, fn, data) \
|
|
__setup_timer_on_stack((timer), (fn), (data), TIMER_DEFERRABLE | TIMER_PINNED)
|
|
|
|
/**
|
|
* timer_pending - is a timer pending?
|
|
* @timer: the timer in question
|
|
*
|
|
* timer_pending will tell whether a given timer is currently pending,
|
|
* or not. Callers must ensure serialization wrt. other operations done
|
|
* to this timer, eg. interrupt contexts, or other CPUs on SMP.
|
|
*
|
|
* return value: 1 if the timer is pending, 0 if not.
|
|
*/
|
|
static inline int timer_pending(const struct timer_list * timer)
|
|
{
|
|
return timer->entry.pprev != NULL;
|
|
}
|
|
|
|
extern void add_timer_on(struct timer_list *timer, int cpu);
|
|
extern int del_timer(struct timer_list * timer);
|
|
extern int mod_timer(struct timer_list *timer, unsigned long expires);
|
|
extern int mod_timer_pending(struct timer_list *timer, unsigned long expires);
|
|
#ifdef CONFIG_SMP
|
|
extern bool check_pending_deferrable_timers(int cpu);
|
|
#endif
|
|
|
|
/*
|
|
* The jiffies value which is added to now, when there is no timer
|
|
* in the timer wheel:
|
|
*/
|
|
#define NEXT_TIMER_MAX_DELTA ((1UL << 30) - 1)
|
|
|
|
/* To be used from cpusets, only */
|
|
extern void timer_quiesce_cpu(void *cpup);
|
|
|
|
extern void add_timer(struct timer_list *timer);
|
|
|
|
extern int try_to_del_timer_sync(struct timer_list *timer);
|
|
|
|
extern struct timer_base timer_base_deferrable;
|
|
|
|
#ifdef CONFIG_SMP
|
|
extern int del_timer_sync(struct timer_list *timer);
|
|
#else
|
|
# define del_timer_sync(t) del_timer(t)
|
|
#endif
|
|
|
|
#define del_singleshot_timer_sync(t) del_timer_sync(t)
|
|
|
|
extern void init_timers(void);
|
|
extern void run_local_timers(void);
|
|
struct hrtimer;
|
|
extern enum hrtimer_restart it_real_fn(struct hrtimer *);
|
|
|
|
#if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON)
|
|
#include <linux/sysctl.h>
|
|
|
|
extern unsigned int sysctl_timer_migration;
|
|
int timer_migration_handler(struct ctl_table *table, int write,
|
|
void __user *buffer, size_t *lenp,
|
|
loff_t *ppos);
|
|
#endif
|
|
|
|
unsigned long __round_jiffies(unsigned long j, int cpu);
|
|
unsigned long __round_jiffies_relative(unsigned long j, int cpu);
|
|
unsigned long round_jiffies(unsigned long j);
|
|
unsigned long round_jiffies_relative(unsigned long j);
|
|
|
|
unsigned long __round_jiffies_up(unsigned long j, int cpu);
|
|
unsigned long __round_jiffies_up_relative(unsigned long j, int cpu);
|
|
unsigned long round_jiffies_up(unsigned long j);
|
|
unsigned long round_jiffies_up_relative(unsigned long j);
|
|
|
|
#ifdef CONFIG_HOTPLUG_CPU
|
|
int timers_prepare_cpu(unsigned int cpu);
|
|
int timers_dead_cpu(unsigned int cpu);
|
|
#else
|
|
#define timers_prepare_cpu NULL
|
|
#define timers_dead_cpu NULL
|
|
#endif
|
|
|
|
#endif
|