Unverified Commit ee341edc authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!11327 CPU inspect bugfix

Merge Pull Request from: @ci-robot 
 
PR sync from: Yu Liao <liaoyu15@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/VJI6Q32ES2XWM625MHCQV5LADRZWZYC7/ 
Yu Liao (2):
  cpuinspect: make inspector unregister reliable
  cpuinspect: fix [stop/start]_inspect_threads return type


-- 
2.33.0
 
https://gitee.com/openeuler/kernel/issues/IAO4PE
https://gitee.com/openeuler/kernel/issues/IAO4S0 
 
Link:https://gitee.com/openeuler/kernel/pulls/11327

 

Reviewed-by: default avatarXiongfeng Wang <wangxiongfeng2@huawei.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parents 0e5a9244 27a047c9
Loading
Loading
Loading
Loading
+16 −6
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@ static int run_inspector(void *data)
	return 0;
}

int start_inspect_threads(void)
void start_inspect_threads(void)
{
	unsigned int cpu = 0;

@@ -129,24 +129,34 @@ int start_inspect_threads(void)
		ci_core.inspect_on = 0;
		cpuinspect_result_notify();
	}

	return 0;
}

int stop_inspect_threads(void)
void stop_inspect_threads(void)
{
	unsigned int cpu = 0;

	/* All inspection threads has been stopped */
	if (atomic_read(&active_threads_num) == 0)
		return 0;
		return;

	for_each_cpu(cpu, &ci_core.inspect_cpumask) {
		if (cpuinspect_threads[cpu])
			kthread_stop(cpuinspect_threads[cpu]);
	}
}

	return 0;
/**
 * stop_inspect_threads_sync - Stop all the inspect threads and wait for
 * current inspect tasks to finish.
 *
 * This function must be called with the cpuinspect lock held.
 */
void stop_inspect_threads_sync(void)
{
	stop_inspect_threads();

	while (atomic_read(&active_threads_num))
		cpu_relax();
}

/**
+3 −2
Original line number Diff line number Diff line
@@ -14,8 +14,9 @@ void cpuinspect_remove_interface(struct device *dev);
void cpuinspect_result_notify(void);

/* inspect control */
int start_inspect_threads(void);
int stop_inspect_threads(void);
void start_inspect_threads(void);
void stop_inspect_threads(void);
void stop_inspect_threads_sync(void);
int cpuinspect_is_running(void);

/* switch inspector */
+1 −4
Original line number Diff line number Diff line
@@ -106,10 +106,7 @@ int cpuinspect_unregister_inspector(struct cpu_inspector *insp)

	mutex_lock(&cpuinspect_lock);
	if (curr_cpu_inspector == insp) {
		if (ci_core.inspect_on) {
			mutex_unlock(&cpuinspect_lock);
			return -EBUSY;
		}
		stop_inspect_threads_sync();

		curr_cpu_inspector = NULL;
	}