forked from rpms/kernel
		
	Sync with F16
Linux 3.1-rc10 Copy nouveau updates patch from F16 Fix deadlock in POSIX cputimer code (rhbz #746485)
This commit is contained in:
		
							parent
							
								
									18312c11db
								
							
						
					
					
						commit
						e05440cad9
					
				
							
								
								
									
										73
									
								
								cputimer-cure-lock-inversion.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										73
									
								
								cputimer-cure-lock-inversion.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,73 @@ | ||||
| Subject: cputimer: Cure lock inversion | ||||
| From: Peter Zijlstra <a.p.zijlstra@chello.nl> | ||||
| Date: Mon Oct 17 11:50:30 CEST 2011 | ||||
| 
 | ||||
| There's a lock inversion between the cputimer->lock and rq->lock; notably | ||||
| the two callchains involved are: | ||||
| 
 | ||||
|  update_rlimit_cpu() | ||||
|    sighand->siglock | ||||
|    set_process_cpu_timer() | ||||
|      cpu_timer_sample_group() | ||||
|        thread_group_cputimer() | ||||
|          cputimer->lock | ||||
|          thread_group_cputime() | ||||
|            task_sched_runtime() | ||||
|              ->pi_lock | ||||
|              rq->lock | ||||
| 
 | ||||
|  scheduler_tick() | ||||
|    rq->lock | ||||
|    task_tick_fair() | ||||
|      update_curr() | ||||
|        account_group_exec() | ||||
|          cputimer->lock | ||||
| 
 | ||||
| Where the first one is enabling a CLOCK_PROCESS_CPUTIME_ID timer, and | ||||
| the second one is keeping up-to-date. | ||||
| 
 | ||||
| This problem was introduced by e8abccb7193 ("posix-cpu-timers: Cure | ||||
| SMP accounting oddities"). | ||||
| 
 | ||||
| Cure the problem by removing the cputimer->lock and rq->lock nesting, | ||||
| this leaves concurrent enablers doing duplicate work, but the time | ||||
| wasted should be on the same order otherwise wasted spinning on the | ||||
| lock and the greater-than assignment filter should ensure we preserve | ||||
| monotonicity. | ||||
| 
 | ||||
| Reported-by: Dave Jones <davej@redhat.com> | ||||
| Reported-by: Simon Kirby <sim@hostway.ca> | ||||
| Cc: stable@kernel.org | ||||
| Cc: Thomas Gleixner <tglx@linutronix.de> | ||||
| Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> | ||||
| ---
 | ||||
|  kernel/posix-cpu-timers.c |    7 ++++--- | ||||
|  1 file changed, 4 insertions(+), 3 deletions(-) | ||||
| Index: linux-2.6/kernel/posix-cpu-timers.c
 | ||||
| ===================================================================
 | ||||
| --- linux-2.6.orig/kernel/posix-cpu-timers.c
 | ||||
| +++ linux-2.6/kernel/posix-cpu-timers.c
 | ||||
| @@ -274,9 +274,7 @@ void thread_group_cputimer(struct task_s
 | ||||
|  	struct task_cputime sum; | ||||
|  	unsigned long flags; | ||||
|   | ||||
| -	spin_lock_irqsave(&cputimer->lock, flags);
 | ||||
|  	if (!cputimer->running) { | ||||
| -		cputimer->running = 1;
 | ||||
|  		/* | ||||
|  		 * The POSIX timer interface allows for absolute time expiry | ||||
|  		 * values through the TIMER_ABSTIME flag, therefore we have | ||||
| @@ -284,8 +282,11 @@ void thread_group_cputimer(struct task_s
 | ||||
|  		 * it. | ||||
|  		 */ | ||||
|  		thread_group_cputime(tsk, &sum); | ||||
| +		spin_lock_irqsave(&cputimer->lock, flags);
 | ||||
| +		cputimer->running = 1;
 | ||||
|  		update_gt_cputime(&cputimer->cputime, &sum); | ||||
| -	}
 | ||||
| +	} else
 | ||||
| +		spin_lock_irqsave(&cputimer->lock, flags);
 | ||||
|  	*times = cputimer->cputime; | ||||
|  	spin_unlock_irqrestore(&cputimer->lock, flags); | ||||
|  } | ||||
| 
 | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										16
									
								
								kernel.spec
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								kernel.spec
									
									
									
									
									
								
							| @ -51,7 +51,7 @@ Summary: The Linux kernel | ||||
| # For non-released -rc kernels, this will be prepended with "0.", so | ||||
| # for example a 3 here will become 0.3 | ||||
| # | ||||
| %global baserelease 3 | ||||
| %global baserelease 1 | ||||
| %global fedora_build %{baserelease} | ||||
| 
 | ||||
| # base_sublevel is the kernel version we're starting with and patching | ||||
| @ -82,7 +82,7 @@ Summary: The Linux kernel | ||||
| # The next upstream release sublevel (base_sublevel+1) | ||||
| %define upstream_sublevel %(echo $((%{base_sublevel} + 1))) | ||||
| # The rc snapshot level | ||||
| %define rcrev 9 | ||||
| %define rcrev 10 | ||||
| # The git snapshot level | ||||
| %define gitrev 0 | ||||
| # Set rpm version accordingly | ||||
| @ -746,6 +746,9 @@ Patch21002: mmc-Always-check-for-lower-base-frequency-quirk-for-.patch | ||||
| Patch21020: 0001-mm-vmscan-Limit-direct-reclaim-for-higher-order-allo.patch | ||||
| Patch21021: 0002-mm-Abort-reclaim-compaction-if-compaction-can-procee.patch | ||||
| 
 | ||||
| # rhbz #746485 | ||||
| Patch21030: cputimer-cure-lock-inversion.patch | ||||
| 
 | ||||
| %endif | ||||
| 
 | ||||
| BuildRoot: %{_tmppath}/kernel-%{KVERREL}-root | ||||
| @ -1369,6 +1372,9 @@ ApplyPatch utrace.patch | ||||
| ApplyPatch 0001-mm-vmscan-Limit-direct-reclaim-for-higher-order-allo.patch | ||||
| ApplyPatch 0002-mm-Abort-reclaim-compaction-if-compaction-can-procee.patch | ||||
| 
 | ||||
| # rhbz #746485 | ||||
| ApplyPatch cputimer-cure-lock-inversion.patch | ||||
| 
 | ||||
| # END OF PATCH APPLICATIONS | ||||
| 
 | ||||
| %endif | ||||
| @ -2077,6 +2083,12 @@ fi | ||||
| #                 ||----w | | ||||
| #                 ||     || | ||||
| %changelog | ||||
| * Wed Oct 19 2011 Chuck Ebbert <cebbert@redhat.com> | ||||
| - Sync with F16 | ||||
| - Linux 3.1-rc10 | ||||
| - Copy nouveau updates patch from F16 | ||||
| - Fix deadlock in POSIX cputimer code (rhbz #746485) | ||||
| 
 | ||||
| * Tue Oct 18 2011 Josh Boyer <jwboyer@redhat.com> | ||||
| - Add patch to fix invalid EFI remap calls from Matt Fleming | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user