[PATCH 10/14] padata debug

Tvrtko Ursulin tursulin at ursulin.net
Thu Oct 19 08:48:03 UTC 2017


From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
 kernel/padata.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 49 insertions(+), 2 deletions(-)

diff --git a/kernel/padata.c b/kernel/padata.c
index 868f947166d7..1ee2d32a766d 100644
--- a/kernel/padata.c
+++ b/kernel/padata.c
@@ -441,6 +441,7 @@ static struct parallel_data *padata_alloc_pd(struct padata_instance *pinst,
 
 static void padata_free_pd(struct parallel_data *pd)
 {
+	printk("padata_free_pd pd=%p\n", pd);
 	free_cpumask_var(pd->cpumask.pcpu);
 	free_cpumask_var(pd->cpumask.cbcpu);
 	free_percpu(pd->pqueue);
@@ -455,6 +456,7 @@ static void padata_flush_queues(struct parallel_data *pd)
 	struct padata_parallel_queue *pqueue;
 	struct padata_serial_queue *squeue;
 
+	printk("padata_flush_queues pd=%p\n", pd);
 	for_each_cpu(cpu, pd->cpumask.pcpu) {
 		pqueue = per_cpu_ptr(pd->pqueue, cpu);
 		flush_work(&pqueue->work);
@@ -496,9 +498,17 @@ static void __padata_stop(struct padata_instance *pinst)
 static void padata_replace(struct padata_instance *pinst,
 			   struct parallel_data *pd_new)
 {
-	struct parallel_data *pd_old = pinst->pd;
+	struct parallel_data *pd_old = rcu_access_pointer(pinst->pd);
 	int notification_mask = 0;
 
+	printk("padata_replace pinst=%p pd_old=%p pd_new=%p cpumasks=%*pbl,%*pbl\n",
+	       pinst,
+	       pd_old,
+	       pd_new,
+	       cpumask_pr_args(pinst->cpumask.pcpu),
+	       cpumask_pr_args(pinst->cpumask.cbcpu));
+	WARN_ON(!pd_old);
+
 	pinst->flags |= PADATA_RESET;
 
 	rcu_assign_pointer(pinst->pd, pd_new);
@@ -591,6 +601,12 @@ static int __padata_set_cpumasks(struct padata_instance *pinst,
 	cpumask_copy(pinst->cpumask.pcpu, pcpumask);
 	cpumask_copy(pinst->cpumask.cbcpu, cbcpumask);
 
+	printk("__padata_set_cpumasks pinst=%p pd=%p cpumasks=%*pbl,%*pbl\n",
+	       pinst,
+	       pd,
+	       cpumask_pr_args(pinst->cpumask.pcpu),
+	       cpumask_pr_args(pinst->cpumask.cbcpu));
+
 	padata_replace(pinst, pd);
 
 	if (valid)
@@ -687,6 +703,13 @@ static int __padata_add_cpu(struct padata_instance *pinst, int cpu)
 		if (!pd)
 			return -ENOMEM;
 
+	printk("__padata_add_cpu cpu=%u pinst=%p pd=%p cpumasks=%*pbl,%*pbl\n",
+	       cpu,
+	       pinst,
+	       pd,
+	       cpumask_pr_args(pinst->cpumask.pcpu),
+	       cpumask_pr_args(pinst->cpumask.cbcpu));
+
 		padata_replace(pinst, pd);
 
 		if (padata_validate_cpumask(pinst, pinst->cpumask.pcpu) &&
@@ -712,6 +735,13 @@ static int __padata_remove_cpu(struct padata_instance *pinst, int cpu)
 		if (!pd)
 			return -ENOMEM;
 
+	printk("__padata_remove_cpu cpu=%u pinst=%p pd=%p cpumasks=%*pbl,%*pbl\n",
+	       cpu,
+	       pinst,
+	       pd,
+	       cpumask_pr_args(pinst->cpumask.pcpu),
+	       cpumask_pr_args(pinst->cpumask.cbcpu));
+
 		padata_replace(pinst, pd);
 
 		cpumask_clear_cpu(cpu, pd->cpumask.cbcpu);
@@ -758,6 +788,11 @@ EXPORT_SYMBOL(padata_remove_cpu);
 
 static inline int pinst_has_cpu(struct padata_instance *pinst, int cpu)
 {
+	printk("padata:pinst_has_cpu cpu=%u pinst=%p cpumasks=%*pbl,%*pbl\n",
+	       cpu,
+	       pinst,
+	       cpumask_pr_args(pinst->cpumask.pcpu),
+	       cpumask_pr_args(pinst->cpumask.cbcpu));
 	return cpumask_test_cpu(cpu, pinst->cpumask.pcpu) ||
 		cpumask_test_cpu(cpu, pinst->cpumask.cbcpu);
 }
@@ -783,6 +818,13 @@ static int padata_cpu_prep_down(unsigned int cpu, struct hlist_node *node)
 	int ret;
 
 	pinst = hlist_entry_safe(node, struct padata_instance, node);
+	printk("padata_cpu_prep_down cpu=%u pinst=%p pd=%p cpumasks=%*pbl,%*pbl\n",
+	       cpu,
+	       pinst,
+	       rcu_access_pointer(pinst->pd),
+	       cpumask_pr_args(pinst->cpumask.pcpu),
+	       cpumask_pr_args(pinst->cpumask.cbcpu));
+	WARN_ON(!pinst);
 	if (!pinst_has_cpu(pinst, cpu))
 		return 0;
 
@@ -800,7 +842,7 @@ static void __padata_free(struct padata_instance *pinst)
 #ifdef CONFIG_HOTPLUG_CPU
 	cpuhp_state_remove_instance_nocalls(hp_online, &pinst->node);
 #endif
-
+	printk("__data_free pinst=%p\n", pinst);
 	padata_stop(pinst);
 	padata_free_pd(pinst->pd);
 	free_cpumask_var(pinst->cpumask.pcpu);
@@ -984,6 +1026,11 @@ static struct padata_instance *padata_alloc(struct workqueue_struct *wq,
 #ifdef CONFIG_HOTPLUG_CPU
 	cpuhp_state_add_instance_nocalls_cpuslocked(hp_online, &pinst->node);
 #endif
+	printk("padata_alloc pinst=%p pd=%p cpumasks=%*pbl,%*pbl\n",
+	       pinst,
+	       pd,
+	       cpumask_pr_args(pinst->cpumask.pcpu),
+	       cpumask_pr_args(pinst->cpumask.cbcpu));
 	return pinst;
 
 err_free_masks:
-- 
2.9.5



More information about the Intel-gfx-trybot mailing list