mirror of
				https://github.com/linuxkit/linuxkit.git
				synced 2025-10-30 07:25:44 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			60 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			60 lines
		
	
	
		
			1.9 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
| From 9fbfbd0ccb1273c4c9da14975860b0d7d7907c93 Mon Sep 17 00:00:00 2001
 | |
| From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
 | |
| Date: Wed, 15 Nov 2017 17:29:51 +0100
 | |
| Subject: [PATCH 201/418] time/hrtimer: avoid schedule_work() with interrupts
 | |
|  disabled
 | |
| 
 | |
| The NOHZ code tries to schedule a workqueue with interrupts disabled.
 | |
| Since this does not work -RT I am switching it to swork instead.
 | |
| 
 | |
| Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
 | |
| ---
 | |
|  kernel/time/timer.c | 15 +++++++++++----
 | |
|  1 file changed, 11 insertions(+), 4 deletions(-)
 | |
| 
 | |
| diff --git a/kernel/time/timer.c b/kernel/time/timer.c
 | |
| index 464aee26ef2b..ced791c0b47b 100644
 | |
| --- a/kernel/time/timer.c
 | |
| +++ b/kernel/time/timer.c
 | |
| @@ -217,8 +217,7 @@ static DEFINE_PER_CPU(struct timer_base, timer_bases[NR_BASES]);
 | |
|  static DEFINE_STATIC_KEY_FALSE(timers_nohz_active);
 | |
|  static DEFINE_MUTEX(timer_keys_mutex);
 | |
|  
 | |
| -static void timer_update_keys(struct work_struct *work);
 | |
| -static DECLARE_WORK(timer_update_work, timer_update_keys);
 | |
| +static struct swork_event timer_update_swork;
 | |
|  
 | |
|  #ifdef CONFIG_SMP
 | |
|  unsigned int sysctl_timer_migration = 1;
 | |
| @@ -238,7 +237,7 @@ static void timers_update_migration(void)
 | |
|  static inline void timers_update_migration(void) { }
 | |
|  #endif /* !CONFIG_SMP */
 | |
|  
 | |
| -static void timer_update_keys(struct work_struct *work)
 | |
| +static void timer_update_keys(struct swork_event *event)
 | |
|  {
 | |
|  	mutex_lock(&timer_keys_mutex);
 | |
|  	timers_update_migration();
 | |
| @@ -248,9 +247,17 @@ static void timer_update_keys(struct work_struct *work)
 | |
|  
 | |
|  void timers_update_nohz(void)
 | |
|  {
 | |
| -	schedule_work(&timer_update_work);
 | |
| +	swork_queue(&timer_update_swork);
 | |
|  }
 | |
|  
 | |
| +static __init int hrtimer_init_thread(void)
 | |
| +{
 | |
| +	WARN_ON(swork_get());
 | |
| +	INIT_SWORK(&timer_update_swork, timer_update_keys);
 | |
| +	return 0;
 | |
| +}
 | |
| +early_initcall(hrtimer_init_thread);
 | |
| +
 | |
|  int timer_migration_handler(struct ctl_table *table, int write,
 | |
|  			    void __user *buffer, size_t *lenp,
 | |
|  			    loff_t *ppos)
 | |
| -- 
 | |
| 2.17.1
 | |
| 
 |