smp: don't warn about csd->flags having CSD_FLAG_LOCK cleared for !wait
blk-mq reuses the request potentially immediately, since the most cache hot is always given out first. This means that rq->csd could be reused between csd->func() being called and csd_unlock() being called. This isn't a problem, since we never use wait == 1 for the smp call function. Add CSD_FLAG_WAIT to be able to tell the difference, retaining the warning for other cases. Cc: Ingo Molnar <mingo@kernel.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
		
					parent
					
						
							
								e3daab6ce4
							
						
					
				
			
			
				commit
				
					
						c84a83e2aa
					
				
			
		
					 1 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
					@ -18,6 +18,7 @@
 | 
				
			||||||
#ifdef CONFIG_USE_GENERIC_SMP_HELPERS
 | 
					#ifdef CONFIG_USE_GENERIC_SMP_HELPERS
 | 
				
			||||||
enum {
 | 
					enum {
 | 
				
			||||||
	CSD_FLAG_LOCK		= 0x01,
 | 
						CSD_FLAG_LOCK		= 0x01,
 | 
				
			||||||
 | 
						CSD_FLAG_WAIT		= 0x02,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct call_function_data {
 | 
					struct call_function_data {
 | 
				
			||||||
| 
						 | 
					@ -124,7 +125,7 @@ static void csd_lock(struct call_single_data *csd)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void csd_unlock(struct call_single_data *csd)
 | 
					static void csd_unlock(struct call_single_data *csd)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	WARN_ON(!(csd->flags & CSD_FLAG_LOCK));
 | 
						WARN_ON((csd->flags & CSD_FLAG_WAIT) && !(csd->flags & CSD_FLAG_LOCK));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/*
 | 
				
			||||||
	 * ensure we're all done before releasing data:
 | 
						 * ensure we're all done before releasing data:
 | 
				
			||||||
| 
						 | 
					@ -146,6 +147,9 @@ void generic_exec_single(int cpu, struct call_single_data *csd, int wait)
 | 
				
			||||||
	unsigned long flags;
 | 
						unsigned long flags;
 | 
				
			||||||
	int ipi;
 | 
						int ipi;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (wait)
 | 
				
			||||||
 | 
							csd->flags |= CSD_FLAG_WAIT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	raw_spin_lock_irqsave(&dst->lock, flags);
 | 
						raw_spin_lock_irqsave(&dst->lock, flags);
 | 
				
			||||||
	ipi = list_empty(&dst->list);
 | 
						ipi = list_empty(&dst->list);
 | 
				
			||||||
	list_add_tail(&csd->list, &dst->list);
 | 
						list_add_tail(&csd->list, &dst->list);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue