Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1366890 > unrolled thread
| Started by | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| First post | 2016-03-30 06:30 +0200 |
| Last post | 2016-03-30 13:30 +0200 |
| Articles | 7 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] cpufreq: acpi: policy->driver_data can't be NULL in ->exit() Viresh Kumar <viresh.kumar@linaro.org> - 2016-03-30 06:30 +0200
Re: [PATCH] cpufreq: acpi: policy->driver_data can't be NULL in ->exit() "Rafael J. Wysocki" <rafael@kernel.org> - 2016-03-30 13:20 +0200
Re: [PATCH] cpufreq: acpi: policy->driver_data can't be NULL in ->exit() Viresh Kumar <viresh.kumar@linaro.org> - 2016-03-30 13:30 +0200
Re: [PATCH] cpufreq: acpi: policy->driver_data can't be NULL in ->exit() Viresh Kumar <viresh.kumar@linaro.org> - 2016-04-01 10:30 +0200
Re: [PATCH] cpufreq: acpi: policy->driver_data can't be NULL in ->exit() "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2016-04-01 23:00 +0200
Re: [PATCH] cpufreq: acpi: policy->driver_data can't be NULL in ->exit() "Rafael J. Wysocki" <rafael@kernel.org> - 2016-03-30 13:20 +0200
Re: [PATCH] cpufreq: acpi: policy->driver_data can't be NULL in ->exit() Viresh Kumar <viresh.kumar@linaro.org> - 2016-03-30 13:30 +0200
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2016-03-30 06:30 +0200 |
| Subject | [PATCH] cpufreq: acpi: policy->driver_data can't be NULL in ->exit() |
| Message-ID | <rifVw-5u-11@gated-at.bofh.it> |
Its always set by ->init() and so it will always be there in ->exit().
There is no need to have a special check for just that.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/cpufreq/acpi-cpufreq.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index eb2196f9d7fa..e20cbb1317cc 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -847,13 +847,11 @@ static int acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy)
pr_debug("acpi_cpufreq_cpu_exit\n");
- if (data) {
- policy->driver_data = NULL;
- acpi_processor_unregister_performance(data->acpi_perf_cpu);
- free_cpumask_var(data->freqdomain_cpus);
- kfree(policy->freq_table);
- kfree(data);
- }
+ policy->driver_data = NULL;
+ acpi_processor_unregister_performance(data->acpi_perf_cpu);
+ free_cpumask_var(data->freqdomain_cpus);
+ kfree(policy->freq_table);
+ kfree(data);
return 0;
}
--
2.7.1.410.g6faf27b
[toc] | [next] | [standalone]
| From | "Rafael J. Wysocki" <rafael@kernel.org> |
|---|---|
| Date | 2016-03-30 13:20 +0200 |
| Message-ID | <rimkh-4wo-1@gated-at.bofh.it> |
| In reply to | #1366890 |
On Wed, Mar 30, 2016 at 1:15 PM, Rafael J. Wysocki <rafael@kernel.org> wrote: > On Wed, Mar 30, 2016 at 6:24 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote: >> Its always set by ->init() and so it will always be there in ->exit(). >> There is no need to have a special check for just that. > > I'm not sure what happens if there are two (or more) CPUs in the policy, though. > > That case is almost certainly handled incorrectly here (or rather not > handled at all), but it may just happen to sort of work, because the > first exiting CPU will clear driver_data and the second one will > notice that it is NULL now. Of course, that still is racy with > respect to governors etc, but I'd rather fix the driver properly. Sorry, scratch that. To core only calls ->exit for the last CPU in the policy, so I agree with the patch. It conflicts with other stuff (as you know), so I'm not sure about the order in which they are going to be applied, though. Thanks, Rafael
[toc] | [prev] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2016-03-30 13:30 +0200 |
| Subject | Re: [PATCH] cpufreq: acpi: policy->driver_data can't be NULL in ->exit() |
| Message-ID | <rimtX-4Cw-1@gated-at.bofh.it> |
| In reply to | #1367107 |
On 30-03-16, 13:18, Rafael J. Wysocki wrote: > It conflicts with other stuff (as you know), so I'm not sure about the > order in which they are going to be applied, though. Yeah, I know. I noticed the ugliness only after looking at your changes :) I am fine to rebase them over if you want. Its really trivial. -- viresh
[toc] | [prev] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2016-04-01 10:30 +0200 |
| Subject | Re: [PATCH] cpufreq: acpi: policy->driver_data can't be NULL in ->exit() |
| Message-ID | <rj2CS-1CC-19@gated-at.bofh.it> |
| In reply to | #1367107 |
On 30-03-16, 13:18, Rafael J. Wysocki wrote: > It conflicts with other stuff (as you know), so I'm not sure about the > order in which they are going to be applied, though. Please let me know when can I rebase and resend this one. I saw that you have moved your patches to linux-next now. -- viresh
[toc] | [prev] | [next] | [standalone]
| From | "Rafael J. Wysocki" <rjw@rjwysocki.net> |
|---|---|
| Date | 2016-04-01 23:00 +0200 |
| Message-ID | <rjekG-1kN-5@gated-at.bofh.it> |
| In reply to | #1369101 |
On Friday, April 01, 2016 01:52:54 PM Viresh Kumar wrote: > On 30-03-16, 13:18, Rafael J. Wysocki wrote: > > It conflicts with other stuff (as you know), so I'm not sure about the > > order in which they are going to be applied, though. > > Please let me know when can I rebase and resend this one. I saw that you have > moved your patches to linux-next now. I have, but they need to be rebased on top of 2 intel_pstate fixes I want to push for v4.6 still and some more minor changes will be necessary. I guess next week will be the right time kind of, but I will be traveling 10-17 Apr, so I may not have much time to process stuff. Thanks, Rafael
[toc] | [prev] | [next] | [standalone]
| From | "Rafael J. Wysocki" <rafael@kernel.org> |
|---|---|
| Date | 2016-03-30 13:20 +0200 |
| Message-ID | <rimkh-4wo-3@gated-at.bofh.it> |
| In reply to | #1366890 |
On Wed, Mar 30, 2016 at 6:24 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> Its always set by ->init() and so it will always be there in ->exit().
> There is no need to have a special check for just that.
I'm not sure what happens if there are two (or more) CPUs in the policy, though.
That case is almost certainly handled incorrectly here (or rather not
handled at all), but it may just happen to sort of work, because the
first exiting CPU will clear driver_data and the second one will
notice that it is NULL now. Of course, that still is racy with
respect to governors etc, but I'd rather fix the driver properly.
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
> drivers/cpufreq/acpi-cpufreq.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
> index eb2196f9d7fa..e20cbb1317cc 100644
> --- a/drivers/cpufreq/acpi-cpufreq.c
> +++ b/drivers/cpufreq/acpi-cpufreq.c
> @@ -847,13 +847,11 @@ static int acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy)
>
> pr_debug("acpi_cpufreq_cpu_exit\n");
>
> - if (data) {
> - policy->driver_data = NULL;
> - acpi_processor_unregister_performance(data->acpi_perf_cpu);
> - free_cpumask_var(data->freqdomain_cpus);
> - kfree(policy->freq_table);
> - kfree(data);
> - }
> + policy->driver_data = NULL;
> + acpi_processor_unregister_performance(data->acpi_perf_cpu);
> + free_cpumask_var(data->freqdomain_cpus);
> + kfree(policy->freq_table);
> + kfree(data);
>
> return 0;
> }
> --
> 2.7.1.410.g6faf27b
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
[toc] | [prev] | [next] | [standalone]
| From | Viresh Kumar <viresh.kumar@linaro.org> |
|---|---|
| Date | 2016-03-30 13:30 +0200 |
| Subject | Re: [PATCH] cpufreq: acpi: policy->driver_data can't be NULL in ->exit() |
| Message-ID | <rimtY-4Cw-21@gated-at.bofh.it> |
| In reply to | #1367108 |
On 30-03-16, 13:15, Rafael J. Wysocki wrote: > On Wed, Mar 30, 2016 at 6:24 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote: > > Its always set by ->init() and so it will always be there in ->exit(). > > There is no need to have a special check for just that. > > I'm not sure what happens if there are two (or more) CPUs in the policy, though. > > That case is almost certainly handled incorrectly here (or rather not > handled at all), but it may just happen to sort of work, because the > first exiting CPU will clear driver_data and the second one will > notice that it is NULL now. Of course, that still is racy with > respect to governors etc, but I'd rather fix the driver properly. Sorry, I probably didn't understood your comments properly. But, the core will call ->exit() only for the last exiting CPU. So, driver_data will never be NULL. -- viresh
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web