[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <89ee198e-3c6b-db02-3eec-f2ae0e2b1971@colorfullife.com>
Date: Thu, 30 Dec 2021 17:47:32 +0100
From: Manfred Spraul <manfred@...orfullife.com>
To: "Rafael J. Wysocki" <rafael@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
Zhang Rui <rui.zhang@...el.com>, Len Brown <lenb@...nel.org>,
1vier1@....de
Subject: Re: drivers/acpi/processor_thermal.c: avoid cpufreq_get_policy()
Hi Rafael,
On 12/30/21 17:23, Rafael J. Wysocki wrote:
> On Wed, Dec 22, 2021 at 8:14 PM Manfred Spraul <manfred@...orfullife.com> wrote:
>> cpu_has_cpufreq() stores a 'struct cpufreq_policy' on the stack.
>> Unfortunately, with debugging options enabled, the structure can be
>> larger than 1024 bytes, which causes a compiler warning/error.
>>
>> (actually observed: 1184 bytes).
>>
>> Therefore: Switch to cpufreq_cpu_get().
>>
>> Signed-off-by: Manfred Spraul <manfred@...orfullife.com>
>>
>> ---
>> drivers/acpi/processor_thermal.c | 15 ++++++++++++---
>> 1 file changed, 12 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/acpi/processor_thermal.c b/drivers/acpi/processor_thermal.c
>> index a3d34e3f9f94..74210d63f62c 100644
>> --- a/drivers/acpi/processor_thermal.c
>> +++ b/drivers/acpi/processor_thermal.c
>> @@ -53,10 +53,19 @@ static int phys_package_first_cpu(int cpu)
>>
>> static int cpu_has_cpufreq(unsigned int cpu)
>> {
>> - struct cpufreq_policy policy;
>> - if (!acpi_processor_cpufreq_init || cpufreq_get_policy(&policy, cpu))
>> + struct cpufreq_policy *policy;
>> + int retval;
> Why is this needed?
You are right, this can be simplified. Updated patch is attached.
>> +
>> + if (!acpi_processor_cpufreq_init)
>> return 0;
>> - return 1;
>> +
>> + retval = 0;
>> + policy = cpufreq_cpu_get(cpu);
>> + if (policy) {
>> + cpufreq_cpu_put(policy);
> return 1;
>
>> + retval = 1;
>> + }
>> + return retval;
> return 0;
>
>> }
>>
>> static int cpufreq_get_max_state(unsigned int cpu)
>> --
>> 2.33.1
>>
View attachment "0001-drivers-acpi-processor_thermal.c-avoid-cpufreq_get_p.patch" of type "text/x-patch" (1363 bytes)
Powered by blists - more mailing lists