Skip to contentSkip to conversation

thermal: Add missing cpumask_clear

PATCH New Jonghwan Choi 4 participants 7 messages Jul 4, 2014 – Jul 8, 2014

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 thermal: Add missing cpumask_clear

Cpumasks should be cleared before using.

---
 drivers/thermal/db8500_cpufreq_cooling.c        |    1 +
 drivers/thermal/imx_thermal.c                   |    1 +
 drivers/thermal/samsung/exynos_thermal_common.c |    1 +
 3 files changed, 3 insertions(+)
drivers/thermal/db8500_cpufreq_cooling.c +1 -0
index 786d192..1fa46ff 100644
@@ -34,6 +34,7 @@ static int db8500_cpufreq_cooling_probe(struct platform_device *pdev)
 	if (!cpufreq_frequency_get_table(0))
 		return -EPROBE_DEFER;
 
+	cpumask_clear(&mask_val);
 	cpumask_set_cpu(0, &mask_val);
 	cdev = cpufreq_cooling_register(&mask_val);
 
drivers/thermal/imx_thermal.c +1 -0
index a99c631..a21acf8 100644
@@ -449,6 +449,7 @@ static int imx_thermal_probe(struct platform_device *pdev)
 	regmap_write(map, MISC0 + REG_SET, MISC0_REFTOP_SELBIASOFF);
 	regmap_write(map, TEMPSENSE0 + REG_SET, TEMPSENSE0_POWER_DOWN);
 
+	cpumask_clear(&clip_cpus);
 	cpumask_set_cpu(0, &clip_cpus);
 	data->cdev = cpufreq_cooling_register(&clip_cpus);
 	if (IS_ERR(data->cdev)) {
drivers/thermal/samsung/exynos_thermal_common.c +1 -0
index 3f5ad25..47efa4c 100644
@@ -361,6 +361,7 @@ int exynos_register_thermal(struct thermal_sensor_conf *sensor_conf)
 		return -ENOMEM;
 
 	th_zone->sensor_conf = sensor_conf;
+	cpumask_clear(&mask_val);
 	/*
 	 * TODO: 1) Handle multiple cooling devices in a thermal zone
 	 *	 2) Add a flag/name in cooling info to map to specific
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/1 thermal: Add missing cpumask_clear

Hi Jonghwan,

Quoted 1 line · Jonghwan Choi

Cpumasks should be cleared before using.

Please explain why and what is issue observed without this.

Quoted 3 lines

---

Signature · 2 lines
Regards,
Sachin.
#2 lore raw

PATCH 1/1 thermal: Add missing cpumask_clear

Quoted 4 lines · Sachin Kamat
Quoted 1 line

Cpumasks should be cleared before using.

Please explain why and what is issue observed without this.

-> When I checked the mask value, I knew that unwanted bit is set.

Test code without cpumask_clear.

+       cpumask_set_cpu(0, &mask_val);
+       cpulist_scnprintf(buf, 64, &mask_val);
+       printk("--ID [ %d] = %s \n", id, buf);
+       th_zone->cool_dev[id] = cpufreq_cooling_register(&mask_val);

Console message-> 4.861157] [c6] --ID [ 1] = 0,4-5,7 (4,5,7 cpu bit was set.)

And when I tried to register two cooling devices with cpumask_set_cpu(0, &mask_val) and cpumask_set_cpu(4, &mask_val).

I found that cpu 0 bit is also set in latter cpumask. (I hope latter cpumask has a cpu 4 bit.)

So I think that cpumask_clear should be inserted.

Thanks.

#3 lore raw

PATCH 1/1 thermal: Add missing cpumask_clear

Hi Jonghwan,

Quoted 17 lines · Jonghwan Choi
Quoted 4 lines · Sachin Kamat
Quoted 1 line

Cpumasks should be cleared before using.

Please explain why and what is issue observed without this.

-> When I checked the mask value, I knew that unwanted bit is set.

Test code without cpumask_clear.

(quoted diff) +4 -0
+       cpumask_set_cpu(0, &mask_val);
+       cpulist_scnprintf(buf, 64, &mask_val);
+       printk("--ID [ %d] = %s \n", id, buf);
+       th_zone->cool_dev[id] = cpufreq_cooling_register(&mask_val);
Quoted 7 lines

Console message-> 4.861157] [c6] --ID [ 1] = 0,4-5,7 (4,5,7 cpu bit was set.)

And when I tried to register two cooling devices with cpumask_set_cpu(0, &mask_val) and cpumask_set_cpu(4, &mask_val).

I found that cpu 0 bit is also set in latter cpumask. (I hope latter cpumask has a cpu 4 bit.)

So I think that cpumask_clear should be inserted.

I believe Sachin's concern was related to your patch description. A good description should say what the patch changes and what is the rationale behind this change. Also for fixes it is a good practice to specify observed issues in patch description as well.

Best regards,
Tomasz

#4 lore raw

PATCH 1/1 thermal: Add missing cpumask_clear

Quoted 9 lines · Tomasz Figa
Quoted 4 lines

Console message-> 4.861157] [c6] --ID [ 1] = 0,4-5,7 (4,5,7 cpu bit was set.)

And when I tried to register two cooling devices with cpumask_set_cpu(0, &mask_val) and

cpumask_set_cpu(4, &mask_val).

Quoted 4 lines

I found that cpu 0 bit is also set in latter cpumask. (I hope latter cpumask has a cpu 4 bit.)

Quoted 7 lines
Quoted 1 line

So I think that cpumask_clear should be inserted.

I believe Sachin's concern was related to your patch description. A good description should say what the patch changes and what is the rationale behind this change. Also for fixes it is a good practice to specify observed issues in patch description as well.

Best regards,

-> You are right.

Thanks for your kind advice.

Best regards.

#5 lore raw

PATCH 1/1 thermal: Add missing cpumask_clear

In reply to Tomasz Figa
Quoted 24 lines · Tomasz Figa

Hi Jonghwan,

Quoted 21 lines · Jonghwan Choi
Quoted 4 lines · Sachin Kamat
Quoted 1 line

Cpumasks should be cleared before using.

Please explain why and what is issue observed without this.

-> When I checked the mask value, I knew that unwanted bit is set.

Test code without cpumask_clear.

(quoted diff) +4 -0
+       cpumask_set_cpu(0, &mask_val);
+       cpulist_scnprintf(buf, 64, &mask_val);
+       printk("--ID [ %d] = %s \n", id, buf);
+       th_zone->cool_dev[id] = cpufreq_cooling_register(&mask_val);

Console message-> 4.861157] [c6] --ID [ 1] = 0,4-5,7 (4,5,7 cpu bit was set.)

And when I tried to register two cooling devices with cpumask_set_cpu(0, &mask_val) and cpumask_set_cpu(4, &mask_val).

Quoted 8 lines
Quoted 3 lines

I found that cpu 0 bit is also set in latter cpumask. (I hope latter cpumask has a cpu 4 bit.)

So I think that cpumask_clear should be inserted.

I believe Sachin's concern was related to your patch description. A good description should say what the patch changes and what is the rationale behind this change. Also for fixes it is a good practice to specify observed issues in patch description as well.

Yes, that is correct. Sorry if it wasn't clear in my previous mail.

Signature · 2 lines
Regards,
Sachin.
#6 lore raw

PATCH 1/1 thermal: Add missing cpumask_clear

In reply to Jonghwan Choi
Quoted 8 lines · Jonghwan Choi

Cpumasks should be cleared before using.

---
 drivers/thermal/db8500_cpufreq_cooling.c        |    1 +
 drivers/thermal/imx_thermal.c                   |    1 +
 drivers/thermal/samsung/exynos_thermal_common.c |    1 +
 3 files changed, 3 insertions(+)

You should send this patch to linux-pm, I think it should go via the thermal tree.

Cheers,
Javi