1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */ 2*4882a593Smuzhiyun #ifndef _LINUX_SMPBOOT_H 3*4882a593Smuzhiyun #define _LINUX_SMPBOOT_H 4*4882a593Smuzhiyun 5*4882a593Smuzhiyun #include <linux/types.h> 6*4882a593Smuzhiyun 7*4882a593Smuzhiyun struct task_struct; 8*4882a593Smuzhiyun /* Cookie handed to the thread_fn*/ 9*4882a593Smuzhiyun struct smpboot_thread_data; 10*4882a593Smuzhiyun 11*4882a593Smuzhiyun /** 12*4882a593Smuzhiyun * struct smp_hotplug_thread - CPU hotplug related thread descriptor 13*4882a593Smuzhiyun * @store: Pointer to per cpu storage for the task pointers 14*4882a593Smuzhiyun * @list: List head for core management 15*4882a593Smuzhiyun * @thread_should_run: Check whether the thread should run or not. Called with 16*4882a593Smuzhiyun * preemption disabled. 17*4882a593Smuzhiyun * @thread_fn: The associated thread function 18*4882a593Smuzhiyun * @create: Optional setup function, called when the thread gets 19*4882a593Smuzhiyun * created (Not called from the thread context) 20*4882a593Smuzhiyun * @setup: Optional setup function, called when the thread gets 21*4882a593Smuzhiyun * operational the first time 22*4882a593Smuzhiyun * @cleanup: Optional cleanup function, called when the thread 23*4882a593Smuzhiyun * should stop (module exit) 24*4882a593Smuzhiyun * @park: Optional park function, called when the thread is 25*4882a593Smuzhiyun * parked (cpu offline) 26*4882a593Smuzhiyun * @unpark: Optional unpark function, called when the thread is 27*4882a593Smuzhiyun * unparked (cpu online) 28*4882a593Smuzhiyun * @selfparking: Thread is not parked by the park function. 29*4882a593Smuzhiyun * @thread_comm: The base name of the thread 30*4882a593Smuzhiyun */ 31*4882a593Smuzhiyun struct smp_hotplug_thread { 32*4882a593Smuzhiyun struct task_struct * __percpu *store; 33*4882a593Smuzhiyun struct list_head list; 34*4882a593Smuzhiyun int (*thread_should_run)(unsigned int cpu); 35*4882a593Smuzhiyun void (*thread_fn)(unsigned int cpu); 36*4882a593Smuzhiyun void (*create)(unsigned int cpu); 37*4882a593Smuzhiyun void (*setup)(unsigned int cpu); 38*4882a593Smuzhiyun void (*cleanup)(unsigned int cpu, bool online); 39*4882a593Smuzhiyun void (*park)(unsigned int cpu); 40*4882a593Smuzhiyun void (*unpark)(unsigned int cpu); 41*4882a593Smuzhiyun bool selfparking; 42*4882a593Smuzhiyun const char *thread_comm; 43*4882a593Smuzhiyun }; 44*4882a593Smuzhiyun 45*4882a593Smuzhiyun int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread); 46*4882a593Smuzhiyun 47*4882a593Smuzhiyun void smpboot_unregister_percpu_thread(struct smp_hotplug_thread *plug_thread); 48*4882a593Smuzhiyun 49*4882a593Smuzhiyun #endif 50