~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/kernel/watchdog_buddy.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /kernel/watchdog_buddy.c (Version linux-6.12-rc7) and /kernel/watchdog_buddy.c (Version linux-5.8.18)


  1 // SPDX-License-Identifier: GPL-2.0                 1 
  2                                                   
  3 #include <linux/cpu.h>                            
  4 #include <linux/cpumask.h>                        
  5 #include <linux/kernel.h>                         
  6 #include <linux/nmi.h>                            
  7 #include <linux/percpu-defs.h>                    
  8                                                   
  9 static cpumask_t __read_mostly watchdog_cpus;     
 10                                                   
 11 static unsigned int watchdog_next_cpu(unsigned    
 12 {                                                 
 13         unsigned int next_cpu;                    
 14                                                   
 15         next_cpu = cpumask_next(cpu, &watchdog    
 16         if (next_cpu >= nr_cpu_ids)               
 17                 next_cpu = cpumask_first(&watc    
 18                                                   
 19         if (next_cpu == cpu)                      
 20                 return nr_cpu_ids;                
 21                                                   
 22         return next_cpu;                          
 23 }                                                 
 24                                                   
 25 int __init watchdog_hardlockup_probe(void)        
 26 {                                                 
 27         return 0;                                 
 28 }                                                 
 29                                                   
 30 void watchdog_hardlockup_enable(unsigned int c    
 31 {                                                 
 32         unsigned int next_cpu;                    
 33                                                   
 34         /*                                        
 35          * The new CPU will be marked online b    
 36          * gets a chance to run on it. If anot    
 37          * hardlockup on the new CPU before it    
 38          * interrupt, it will get a false posi    
 39          * the new CPU to delay the check for     
 40          * to guarantee one hrtimer has run on    
 41          */                                       
 42         watchdog_hardlockup_touch_cpu(cpu);       
 43                                                   
 44         /*                                        
 45          * We are going to check the next CPU.    
 46          * need not be zero if the CPU has alr    
 47          * Touch the watchdog on the next CPU     
 48          * if we try to check it in less then     
 49          */                                       
 50         next_cpu = watchdog_next_cpu(cpu);        
 51         if (next_cpu < nr_cpu_ids)                
 52                 watchdog_hardlockup_touch_cpu(    
 53                                                   
 54         /*                                        
 55          * Makes sure that watchdog is touched    
 56          * other CPUs could see it in watchdog    
 57          * part is in watchdog_buddy_check_har    
 58          */                                       
 59         smp_wmb();                                
 60                                                   
 61         cpumask_set_cpu(cpu, &watchdog_cpus);     
 62 }                                                 
 63                                                   
 64 void watchdog_hardlockup_disable(unsigned int     
 65 {                                                 
 66         unsigned int next_cpu = watchdog_next_    
 67                                                   
 68         /*                                        
 69          * Offlining this CPU will cause the C    
 70          * checking the one after this one. If    
 71          * the next CPU and updating hrtimer_i    
 72          * previous CPU checks it within one s    
 73          * false positive. Touch the watchdog     
 74          */                                       
 75         if (next_cpu < nr_cpu_ids)                
 76                 watchdog_hardlockup_touch_cpu(    
 77                                                   
 78         /*                                        
 79          * Makes sure that watchdog is touched    
 80          * this CPU disappear in watchdog_cpus    
 81          * watchdog_buddy_check_hardlockup().     
 82          */                                       
 83         smp_wmb();                                
 84                                                   
 85         cpumask_clear_cpu(cpu, &watchdog_cpus)    
 86 }                                                 
 87                                                   
 88 void watchdog_buddy_check_hardlockup(int hrtim    
 89 {                                                 
 90         unsigned int next_cpu;                    
 91                                                   
 92         /*                                        
 93          * Test for hardlockups every 3 sample    
 94          *  watchdog_thresh * 2 / 5, so 3 samp    
 95          *  watchdog_thresh (over by 20%).        
 96          */                                       
 97         if (hrtimer_interrupts % 3 != 0)          
 98                 return;                           
 99                                                   
100         /* check for a hardlockup on the next     
101         next_cpu = watchdog_next_cpu(smp_proce    
102         if (next_cpu >= nr_cpu_ids)               
103                 return;                           
104                                                   
105         /*                                        
106          * Make sure that the watchdog was tou    
107          * watchdog_next_cpu() returned anothe    
108          * a change in watchdog_hardlockup_ena    
109          */                                       
110         smp_rmb();                                
111                                                   
112         watchdog_hardlockup_check(next_cpu, NU    
113 }                                                 
114                                                   

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php