Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer fixes from Thomas Gleixner:
- Fix inconstinant clock usage in virtual time accounting
- Fix a build error in KVM caused by the NOHZ work
- Remove a pointless timekeeping duty assignment which breaks NOHZ
- Use a proper notifier return value to avoid random behaviour

* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
tick: Remove useless timekeeping duty attribution to broadcast source
nohz: Fix notifier return val that enforce timekeeping
kvm: Move guest entry/exit APIs to context_tracking
vtime: Use consistent clocks among nohz accounting

+43 -48
+35
include/linux/context_tracking.h
··· 3 3 4 4 #include <linux/sched.h> 5 5 #include <linux/percpu.h> 6 + #include <linux/vtime.h> 6 7 #include <asm/ptrace.h> 7 8 8 9 struct context_tracking { ··· 20 19 } state; 21 20 }; 22 21 22 + static inline void __guest_enter(void) 23 + { 24 + /* 25 + * This is running in ioctl context so we can avoid 26 + * the call to vtime_account() with its unnecessary idle check. 27 + */ 28 + vtime_account_system(current); 29 + current->flags |= PF_VCPU; 30 + } 31 + 32 + static inline void __guest_exit(void) 33 + { 34 + /* 35 + * This is running in ioctl context so we can avoid 36 + * the call to vtime_account() with its unnecessary idle check. 37 + */ 38 + vtime_account_system(current); 39 + current->flags &= ~PF_VCPU; 40 + } 41 + 23 42 #ifdef CONFIG_CONTEXT_TRACKING 24 43 DECLARE_PER_CPU(struct context_tracking, context_tracking); 25 44 ··· 55 34 56 35 extern void user_enter(void); 57 36 extern void user_exit(void); 37 + 38 + extern void guest_enter(void); 39 + extern void guest_exit(void); 58 40 59 41 static inline enum ctx_state exception_enter(void) 60 42 { ··· 81 57 static inline bool context_tracking_in_user(void) { return false; } 82 58 static inline void user_enter(void) { } 83 59 static inline void user_exit(void) { } 60 + 61 + static inline void guest_enter(void) 62 + { 63 + __guest_enter(); 64 + } 65 + 66 + static inline void guest_exit(void) 67 + { 68 + __guest_exit(); 69 + } 70 + 84 71 static inline enum ctx_state exception_enter(void) { return 0; } 85 72 static inline void exception_exit(enum ctx_state prev_ctx) { } 86 73 static inline void context_tracking_task_switch(struct task_struct *prev,
+1 -36
include/linux/kvm_host.h
··· 23 23 #include <linux/ratelimit.h> 24 24 #include <linux/err.h> 25 25 #include <linux/irqflags.h> 26 + #include <linux/context_tracking.h> 26 27 #include <asm/signal.h> 27 28 28 29 #include <linux/kvm.h> ··· 760 759 return 0; 761 760 } 762 761 #endif 763 - 764 - static inline void __guest_enter(void) 765 - { 766 - /* 767 - * This is running in ioctl context so we can avoid 768 - * the call to vtime_account() with its unnecessary idle check. 769 - */ 770 - vtime_account_system(current); 771 - current->flags |= PF_VCPU; 772 - } 773 - 774 - static inline void __guest_exit(void) 775 - { 776 - /* 777 - * This is running in ioctl context so we can avoid 778 - * the call to vtime_account() with its unnecessary idle check. 779 - */ 780 - vtime_account_system(current); 781 - current->flags &= ~PF_VCPU; 782 - } 783 - 784 - #ifdef CONFIG_CONTEXT_TRACKING 785 - extern void guest_enter(void); 786 - extern void guest_exit(void); 787 - 788 - #else /* !CONFIG_CONTEXT_TRACKING */ 789 - static inline void guest_enter(void) 790 - { 791 - __guest_enter(); 792 - } 793 - 794 - static inline void guest_exit(void) 795 - { 796 - __guest_exit(); 797 - } 798 - #endif /* !CONFIG_CONTEXT_TRACKING */ 799 762 800 763 static inline void kvm_guest_enter(void) 801 764 {
+2 -2
include/linux/vtime.h
··· 34 34 } 35 35 extern void vtime_guest_enter(struct task_struct *tsk); 36 36 extern void vtime_guest_exit(struct task_struct *tsk); 37 - extern void vtime_init_idle(struct task_struct *tsk); 37 + extern void vtime_init_idle(struct task_struct *tsk, int cpu); 38 38 #else 39 39 static inline void vtime_account_irq_exit(struct task_struct *tsk) 40 40 { ··· 45 45 static inline void vtime_user_exit(struct task_struct *tsk) { } 46 46 static inline void vtime_guest_enter(struct task_struct *tsk) { } 47 47 static inline void vtime_guest_exit(struct task_struct *tsk) { } 48 - static inline void vtime_init_idle(struct task_struct *tsk) { } 48 + static inline void vtime_init_idle(struct task_struct *tsk, int cpu) { } 49 49 #endif 50 50 51 51 #ifdef CONFIG_IRQ_TIME_ACCOUNTING
-1
kernel/context_tracking.c
··· 15 15 */ 16 16 17 17 #include <linux/context_tracking.h> 18 - #include <linux/kvm_host.h> 19 18 #include <linux/rcupdate.h> 20 19 #include <linux/sched.h> 21 20 #include <linux/hardirq.h>
+1 -1
kernel/sched/core.c
··· 4745 4745 */ 4746 4746 idle->sched_class = &idle_sched_class; 4747 4747 ftrace_graph_init_idle_task(idle, cpu); 4748 - vtime_init_idle(idle); 4748 + vtime_init_idle(idle, cpu); 4749 4749 #if defined(CONFIG_SMP) 4750 4750 sprintf(idle->comm, "%s/%d", INIT_TASK_COMM, cpu); 4751 4751 #endif
+3 -3
kernel/sched/cputime.c
··· 747 747 748 748 write_seqlock(&current->vtime_seqlock); 749 749 current->vtime_snap_whence = VTIME_SYS; 750 - current->vtime_snap = sched_clock(); 750 + current->vtime_snap = sched_clock_cpu(smp_processor_id()); 751 751 write_sequnlock(&current->vtime_seqlock); 752 752 } 753 753 754 - void vtime_init_idle(struct task_struct *t) 754 + void vtime_init_idle(struct task_struct *t, int cpu) 755 755 { 756 756 unsigned long flags; 757 757 758 758 write_seqlock_irqsave(&t->vtime_seqlock, flags); 759 759 t->vtime_snap_whence = VTIME_SYS; 760 - t->vtime_snap = sched_clock(); 760 + t->vtime_snap = sched_clock_cpu(cpu); 761 761 write_sequnlock_irqrestore(&t->vtime_seqlock, flags); 762 762 } 763 763
-4
kernel/time/tick-broadcast.c
··· 698 698 699 699 bc->event_handler = tick_handle_oneshot_broadcast; 700 700 701 - /* Take the do_timer update */ 702 - if (!tick_nohz_full_cpu(cpu)) 703 - tick_do_timer_cpu = cpu; 704 - 705 701 /* 706 702 * We must be careful here. There might be other CPUs 707 703 * waiting for periodic broadcast. We need to set the
+1 -1
kernel/time/tick-sched.c
··· 306 306 * we can't safely shutdown that CPU. 307 307 */ 308 308 if (have_nohz_full_mask && tick_do_timer_cpu == cpu) 309 - return -EINVAL; 309 + return NOTIFY_BAD; 310 310 break; 311 311 } 312 312 return NOTIFY_OK;