[PATCH 13/14] more debug

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


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

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
 drivers/gpu/drm/i915/i915_pmu.c |  6 +++++-
 include/linux/padata.h          |  1 +
 kernel/padata.c                 | 28 +++++++++++++++++++++++++++-
 3 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_pmu.c b/drivers/gpu/drm/i915/i915_pmu.c
index 25ff1f5a5cc9..e2ce66159041 100644
--- a/drivers/gpu/drm/i915/i915_pmu.c
+++ b/drivers/gpu/drm/i915/i915_pmu.c
@@ -788,10 +788,13 @@ static int i915_pmu_register_cpuhp_state(struct drm_i915_private *i915)
 				      "perf/x86/intel/i915:online",
 				      i915_pmu_cpu_online,
 				      i915_pmu_cpu_offline);
-	if (ret < 0)
+	if (ret < 0) {
+		printk("i915 cpuhp setup %d\n", ret);
 		return ret;
+	}
 
 	slot = ret;
+	printk("i915 cpuhp slot %d\n", ret);
 	ret = cpuhp_state_add_instance(slot, &i915->pmu.node);
 	if (ret) {
 		cpuhp_remove_multi_state(slot);
@@ -812,6 +815,7 @@ static void i915_pmu_unregister_cpuhp_state(struct drm_i915_private *i915)
 #else
 static int i915_pmu_register_cpuhp_state(void)
 {
+	printk("i915 cpuhp off\n");
 	return 0;
 }
 
diff --git a/include/linux/padata.h b/include/linux/padata.h
index 2f9c1f93b1ce..3234c9c29d16 100644
--- a/include/linux/padata.h
+++ b/include/linux/padata.h
@@ -151,6 +151,7 @@ struct parallel_data {
  * @flags: padata flags.
  */
 struct padata_instance {
+	u64				magic;
 	struct hlist_node		 node;
 	struct workqueue_struct		*wq;
 	struct parallel_data		*pd;
diff --git a/kernel/padata.c b/kernel/padata.c
index 1ee2d32a766d..a4117d0c575d 100644
--- a/kernel/padata.c
+++ b/kernel/padata.c
@@ -33,6 +33,8 @@
 #include <linux/module.h>
 
 #define MAX_OBJ_NUM 1000
+#define PADATA_MAGIC		0xf414e1015deed1d0ULL
+#define PADATA_MAGIC_FREED	0x0414e1015deed1d0ULL
 
 static int padata_index_to_cpu(struct parallel_data *pd, int cpu_index)
 {
@@ -803,6 +805,20 @@ static int padata_cpu_online(unsigned int cpu, struct hlist_node *node)
 	int ret;
 
 	pinst = hlist_entry_safe(node, struct padata_instance, node);
+	WARN_ON(!pinst);
+	if (WARN_ON(pinst->magic != PADATA_MAGIC)) {
+		printk("padata_cpu_online WRONG_MAGIC %llx node=%p\n",
+		       pinst->magic, node);
+		return 0;
+	}
+
+	printk("padata_cpu_online 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));
+
 	if (!pinst_has_cpu(pinst, cpu))
 		return 0;
 
@@ -818,13 +834,19 @@ static int padata_cpu_prep_down(unsigned int cpu, struct hlist_node *node)
 	int ret;
 
 	pinst = hlist_entry_safe(node, struct padata_instance, node);
+	WARN_ON(!pinst);
+	if (WARN_ON(pinst->magic != PADATA_MAGIC)) {
+		printk("padata_cpu_prep_down WRONG MAGIC %llx node=%p\n",
+		       pinst->magic, node);
+		return 0;
+	}
+
 	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;
 
@@ -847,6 +869,7 @@ static void __padata_free(struct padata_instance *pinst)
 	padata_free_pd(pinst->pd);
 	free_cpumask_var(pinst->cpumask.pcpu);
 	free_cpumask_var(pinst->cpumask.cbcpu);
+	pinst->magic = PADATA_MAGIC_FREED;
 	kfree(pinst);
 }
 
@@ -1012,6 +1035,7 @@ static struct padata_instance *padata_alloc(struct workqueue_struct *wq,
 
 	rcu_assign_pointer(pinst->pd, pd);
 
+	pinst->magic = PADATA_MAGIC;
 	pinst->wq = wq;
 
 	cpumask_copy(pinst->cpumask.pcpu, pcpumask);
@@ -1037,6 +1061,7 @@ static struct padata_instance *padata_alloc(struct workqueue_struct *wq,
 	free_cpumask_var(pinst->cpumask.pcpu);
 	free_cpumask_var(pinst->cpumask.cbcpu);
 err_free_inst:
+	pinst->magic = PADATA_MAGIC_FREED;
 	kfree(pinst);
 err:
 	return NULL;
@@ -1081,6 +1106,7 @@ static __init int padata_driver_init(void)
 	if (ret < 0)
 		return ret;
 	hp_online = ret;
+	printk("padata cpuhp slot %u\n", ret);
 	return 0;
 }
 module_init(padata_driver_init);
-- 
2.9.5



More information about the Intel-gfx-trybot mailing list