From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Charles Keepax <ckeepax@opensource.cirrus.com>,
Mark Brown <broonie@kernel.org>
Cc: yung-chuan.liao@linux.intel.com, lgirdwood@gmail.com,
alsa-devel@alsa-project.org, patches@opensource.cirrus.com
Subject: Re: [PATCH] ASoC: soc-pcm: Shrink stack frame for __soc_pcm_hw_params
Date: Thu, 24 Aug 2023 09:43:39 -0500 [thread overview]
Message-ID: <728cb1cc-4d5e-112b-fa93-b25696dabc5b@linux.intel.com> (raw)
In-Reply-To: <20230824093328.GH103419@ediswmail.ad.cirrus.com>
On 8/24/23 04:33, Charles Keepax wrote:
> On Wed, Aug 23, 2023 at 04:39:35PM +0000, Charles Keepax wrote:
>> On Wed, Aug 23, 2023 at 05:19:31PM +0100, Mark Brown wrote:
>>> On Wed, Aug 23, 2023 at 03:49:58PM +0000, Charles Keepax wrote:
>>>> On Wed, Aug 23, 2023 at 10:21:13AM +0100, Charles Keepax wrote:
>>>>> Commit ac950278b087 ("ASoC: add N cpus to M codecs dai link support")
>>>>> added an additional local params in __soc_pmc_hw_params, for the
>>>>> CPU side of the DAI. The snd_pcm_hw_params struct is pretty large (604
>>>>> bytes) and keeping two local copies of it makes the stack frame for
>>>>> __soc_pcm_hw_params really large. As the two copies are only used
>>>>> sequentially combine these into a single local variable to shrink the
>>>>> stack frame.
>>>
>>>> Hmm... this might need a little more thought its not clear why this
>>>> should change the frame size and it only seems to change the frame
>>>> size on the ARM cross compiler I am using, not x86.
>>>
>>> Isn't that just going to be a function of the compiler being smart
>>> enough to work out that there aren't overlapping uses of the two
>>> variables and they can share stack space? There's no reason not to help
>>> it figure that out.
>>
>> Yeah I think my only concern here was I no longer was certain I
>> understood what was happening. I don't think the patch can do any
>> harm, well except for the names being slightly less clear in the
>> code. It is starting to look like the mostly comes down to the
>> compiler being smart enough, although both were GCC in my case
>> so the difference is still a little surprising to me.
>>
>
> Ah ok I see what is going on here, it depends on if you have
> -Os or -O2 set. -O2 will merge the two variables and give a
> smaller stack frame, -Os does not.
>
> I would be inclined to say merge the patch, since it does help
> if some is trying to size optimise their kernel, but I don't
> feel strongly. Also I could respin to put this in the commit
> message if people prefer?
v2 with an updated commit message sounds good to me.
next prev parent reply other threads:[~2023-08-24 16:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-23 9:21 [PATCH] ASoC: soc-pcm: Shrink stack frame for __soc_pcm_hw_params Charles Keepax
2023-08-23 15:49 ` Charles Keepax
2023-08-23 16:19 ` Mark Brown
2023-08-23 16:26 ` Pierre-Louis Bossart
2023-08-23 16:39 ` Mark Brown
2023-08-23 16:39 ` Charles Keepax
2023-08-24 9:33 ` Charles Keepax
2023-08-24 14:43 ` Pierre-Louis Bossart [this message]
2023-09-11 15:07 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=728cb1cc-4d5e-112b-fa93-b25696dabc5b@linux.intel.com \
--to=pierre-louis.bossart@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=ckeepax@opensource.cirrus.com \
--cc=lgirdwood@gmail.com \
--cc=patches@opensource.cirrus.com \
--cc=yung-chuan.liao@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.