Received: by 2002:ac0:8845:0:0:0:0:0 with SMTP id g63csp1500350img; Tue, 26 Feb 2019 23:53:15 -0800 (PST) X-Google-Smtp-Source: AHgI3IY1uFy+CMqPW8llozmgK/F/oSKx2vq3/khWrV+JstdjW6I6s50AtS83Rz01pe96BtGaVwOL X-Received: by 2002:a63:f718:: with SMTP id x24mr1736240pgh.107.1551253995358; Tue, 26 Feb 2019 23:53:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551253995; cv=none; d=google.com; s=arc-20160816; b=xfZwDsNuG/VRg8LU5eJdqnh3ohOV0dPQGE9I6hxGd47XX0VCbQcipBVUvC+6mLCyUY O9m5nOwjkVXg7YWhO7VxJHEzkeMmziFij8f3rEABsmb/yjnXpQ0MNoLt6vyRpdDl767f iQMVgpSGMJorzUgy8i8WB3rJTQdMTG1Fj8wMrcwJjp5/qmagdjRkuSnSNkEDW4SsREzC K6nQ+kRTShrwOT6CoUdLpsIFcot9ggB8Md5PnoFYful1iD6cCARSRCrSQVPbyeKPIsNy B6KxLJuh/8Cz0NMRSaitylW2GHGpvjA/qQgZJ70K65aczgmtTPCtJa6XRDn2ZNKKiFjm +qgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=XSrAlgG6VhJedlmr+pQmi+EgS9OsXLXzjmZGc5W4rpk=; b=Mw1WGLfthKN9PuV0tkH9eXtyuIAKgXnpmOxkuHdhDxwcrkyLscrodNleER/cU6sY87 /2bTP0REHOl9lA5eARHhHktfD8QznilC2U//9WswjWG12Y1i0sAcEb2lnHarS2sUhzsP Lsgmg1Wo5XxQqKSUrAUJMFmP/k2QtnEOyeccy+02h4hq+ptv650DkUzPpDSJ2bRokajf ly8ALsGbv1qgoimE1KxQ0myrYvXnMIVD2ZNfM1rAL0srkYgi2clijwFQPwTR5EgXw3yQ BZcH2AhZI6xMwNX8ebCd6PZefL33wBFX3+Nzk8mhBM9COA4xrS3LChn1BWVEK4BiBYNA 5YWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L8uPvWsX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f66si9667914plb.261.2019.02.26.23.52.59; Tue, 26 Feb 2019 23:53:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=L8uPvWsX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726931AbfB0Hwb (ORCPT + 99 others); Wed, 27 Feb 2019 02:52:31 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:39179 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726702AbfB0Hwa (ORCPT ); Wed, 27 Feb 2019 02:52:30 -0500 Received: by mail-pg1-f193.google.com with SMTP id h8so7042228pgp.6 for ; Tue, 26 Feb 2019 23:52:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=XSrAlgG6VhJedlmr+pQmi+EgS9OsXLXzjmZGc5W4rpk=; b=L8uPvWsXSaMxb4tj8+Oo2q0w8P2HO6d9Nl07Wd6Ic3s+3AnpLFdO2OiNZAnMZKWf+A lGrHlSy+Y34CnXLV/hASCsHzsKXRNjtZpUzH/3Ll9pdmJ+dkS6FNt/Fe2nIfR5BlIYwx j4vkk+Lgpr8j2Va9QotPXP1VMHObdXHAZtce0ILqT+maY1mnz2LSHjusbWo2g3EwjJjR SPeuh8ssUwahoYECqkckQkrGpNOxglUmWqntpPQQAUetpcTK9vUN1BukthsvooDIbBOf uQ+Fya7wcr6cG3OAY0DVpin8IP4fnSrGx8UrpYoVOd1gaFLpJjOVEXtHTOGcc/adNi1d gxUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=XSrAlgG6VhJedlmr+pQmi+EgS9OsXLXzjmZGc5W4rpk=; b=d310iGFC6aV21ZtUSM1d666i5z6xpiEsT6NmJOe+NTqIehWws2n03wxpLyUQm839+3 WHLmw7a5HPuC8Yj2XnnEkhzOn6qsMEeFQHeG17MRCIi1t0whq/nIa2eFpDCVu4sSx+ct RpvaCxQW2A4GIFmunKdUVreMRisI9gDEd5Xg17sV+97mCJ1xlIbR7Fgl0fWv3x4nbiNI j69AtHQqcJxdhqxoIy0SrSyg5HY0tZm5R/aA2a1/6td4Be6Uay7AW27TKhBQ4qcIrhR0 d5Yx5iQ+SWstXyWx1WlSBJyuavY4H2/iWmXCUsoD4bFEN6rtxcgA6bgjdpgtoIs/MNa6 M6BQ== X-Gm-Message-State: AHQUAubqdtR1Z5kEyYMMM4p0I1WEh30wSucWjNdbLgP98kf+/Z+ro87Z CU0Q0cWuW23902SGlUSQfWXvsg== X-Received: by 2002:a63:3193:: with SMTP id x141mr1561015pgx.438.1551253949488; Tue, 26 Feb 2019 23:52:29 -0800 (PST) Received: from localhost ([122.167.168.92]) by smtp.gmail.com with ESMTPSA id t23sm22570443pfa.111.2019.02.26.23.52.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Feb 2019 23:52:24 -0800 (PST) Date: Wed, 27 Feb 2019 13:22:22 +0530 From: Viresh Kumar To: Rafael Wysocki , Ilia Lin Cc: linux-pm@vger.kernel.org, Vincent Guittot , Arnd Bergmann , amit.kucheria@linaro.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] cpufreq: kyro: Reduce frame-size of qcom_cpufreq_kryo_probe() Message-ID: <20190227075222.ib7qg6ycrwyztms5@vireshk-i7> References: <5919a74b74f466e803e07f70136517119dcd4560.1550661235.git.viresh.kumar@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5919a74b74f466e803e07f70136517119dcd4560.1550661235.git.viresh.kumar@linaro.org> User-Agent: NeoMutt/20180323-120-3dd1ac Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20-02-19, 16:44, Viresh Kumar wrote: > With the introduction of commit 846a415bf440 ("arm64: default NR_CPUS to > 256"), we have started getting following compilation warning: > > qcom-cpufreq-kryo.c:168:1: warning: the frame size of 2160 bytes is larger than 2048 bytes [-Wframe-larger-than=] > > Fix that by dynamically allocating opp_tables and freeing it later. > > Compile tested only. > > Signed-off-by: Viresh Kumar > --- > drivers/cpufreq/qcom-cpufreq-kryo.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/cpufreq/qcom-cpufreq-kryo.c b/drivers/cpufreq/qcom-cpufreq-kryo.c > index 1c8583cc06a2..6888cb6db2ef 100644 > --- a/drivers/cpufreq/qcom-cpufreq-kryo.c > +++ b/drivers/cpufreq/qcom-cpufreq-kryo.c > @@ -75,7 +75,7 @@ static enum _msm8996_version qcom_cpufreq_kryo_get_msm_id(void) > > static int qcom_cpufreq_kryo_probe(struct platform_device *pdev) > { > - struct opp_table *opp_tables[NR_CPUS] = {0}; > + struct opp_table **opp_tables; > enum _msm8996_version msm8996_version; > struct nvmem_cell *speedbin_nvmem; > struct device_node *np; > @@ -133,6 +133,10 @@ static int qcom_cpufreq_kryo_probe(struct platform_device *pdev) > } > kfree(speedbin); > > + opp_tables = kcalloc(num_possible_cpus(), sizeof(*opp_tables), GFP_KERNEL); > + if (!opp_tables) > + return -ENOMEM; > + > for_each_possible_cpu(cpu) { > cpu_dev = get_cpu_device(cpu); > if (NULL == cpu_dev) { > @@ -149,6 +153,8 @@ static int qcom_cpufreq_kryo_probe(struct platform_device *pdev) > } > } > > + kfree(opp_tables); > + > cpufreq_dt_pdev = platform_device_register_simple("cpufreq-dt", -1, > NULL, 0); > if (!IS_ERR(cpufreq_dt_pdev)) We can fail here and then we will try to use opp_tables which is already freed. I wonder how this stupid patch made it through the reviews :) > @@ -163,6 +169,7 @@ static int qcom_cpufreq_kryo_probe(struct platform_device *pdev) > break; > dev_pm_opp_put_supported_hw(opp_tables[cpu]); > } > + kfree(opp_tables); > > return ret; > } Having said that, there is another problem which I just noticed in the remove() path where we don't call dev_pm_opp_put_supported_hw(). That will create problems if we try to remove module of this driver and then reinstall it as the OPP table was never freed. The fix for that problem needs to go into stable kernels past 4.18 and so I will abandon this patch and send a new fix which will fix the issues of $subject patch as well. -- viresh