forked from mirrors/linux
		
	 d4645d30b5
			
		
	
	
		d4645d30b5
		
	
	
	
	
		
			
			The test robot reported a wrong assignment of a per-CPU variable which
it detected by using sparse and sent a report. The assignment itself is
correct. The annotation for sparse was wrong and hence the report.
The first pointer is a "normal" pointer and points to the per-CPU memory
area. That means that the __percpu annotation has to be moved.
Move the __percpu annotation to pointer which points to the per-CPU
area. This change affects only the sparse tool (and is ignored by the
compiler).
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: f97f8f06a4 ("smpboot: Provide infrastructure for percpu hotplug threads")
Link: http://lkml.kernel.org/r/20190424085253.12178-1-bigeasy@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
		
	
			
		
			
				
	
	
		
			49 lines
		
	
	
	
		
			1.7 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
	
		
			1.7 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /* SPDX-License-Identifier: GPL-2.0 */
 | |
| #ifndef _LINUX_SMPBOOT_H
 | |
| #define _LINUX_SMPBOOT_H
 | |
| 
 | |
| #include <linux/types.h>
 | |
| 
 | |
| struct task_struct;
 | |
| /* Cookie handed to the thread_fn*/
 | |
| struct smpboot_thread_data;
 | |
| 
 | |
| /**
 | |
|  * struct smp_hotplug_thread - CPU hotplug related thread descriptor
 | |
|  * @store:		Pointer to per cpu storage for the task pointers
 | |
|  * @list:		List head for core management
 | |
|  * @thread_should_run:	Check whether the thread should run or not. Called with
 | |
|  *			preemption disabled.
 | |
|  * @thread_fn:		The associated thread function
 | |
|  * @create:		Optional setup function, called when the thread gets
 | |
|  *			created (Not called from the thread context)
 | |
|  * @setup:		Optional setup function, called when the thread gets
 | |
|  *			operational the first time
 | |
|  * @cleanup:		Optional cleanup function, called when the thread
 | |
|  *			should stop (module exit)
 | |
|  * @park:		Optional park function, called when the thread is
 | |
|  *			parked (cpu offline)
 | |
|  * @unpark:		Optional unpark function, called when the thread is
 | |
|  *			unparked (cpu online)
 | |
|  * @selfparking:	Thread is not parked by the park function.
 | |
|  * @thread_comm:	The base name of the thread
 | |
|  */
 | |
| struct smp_hotplug_thread {
 | |
| 	struct task_struct		* __percpu *store;
 | |
| 	struct list_head		list;
 | |
| 	int				(*thread_should_run)(unsigned int cpu);
 | |
| 	void				(*thread_fn)(unsigned int cpu);
 | |
| 	void				(*create)(unsigned int cpu);
 | |
| 	void				(*setup)(unsigned int cpu);
 | |
| 	void				(*cleanup)(unsigned int cpu, bool online);
 | |
| 	void				(*park)(unsigned int cpu);
 | |
| 	void				(*unpark)(unsigned int cpu);
 | |
| 	bool				selfparking;
 | |
| 	const char			*thread_comm;
 | |
| };
 | |
| 
 | |
| int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread);
 | |
| 
 | |
| void smpboot_unregister_percpu_thread(struct smp_hotplug_thread *plug_thread);
 | |
| 
 | |
| #endif
 |