[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <131ceefe-a205-44e7-99be-275858b3a2df@app.fastmail.com>
Date: Mon, 30 Jan 2023 19:50:37 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Serge Semin" <fancer.lancer@...il.com>,
"Arnd Bergmann" <arnd@...nel.org>
Cc: "Gustavo Pimentel" <gustavo.pimentel@...opsys.com>,
"Vinod Koul" <vkoul@...nel.org>,
"Serge Semin" <Sergey.Semin@...kalelectronics.ru>,
"Bjorn Helgaas" <bhelgaas@...gle.com>,
"Manivannan Sadhasivam" <mani@...nel.org>,
"Lorenzo Pieralisi" <lpieralisi@...nel.org>,
"Frank Li" <Frank.Li@....com>, dmaengine@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] dmaengine: dw-edma: reduce stack usage after debugfs rework
On Mon, Jan 30, 2023, at 18:12, Serge Semin wrote:
> Hi Arnd
>
> On Mon, Jan 30, 2023 at 02:08:10PM +0100, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@...db.de>
>>
>> After the dw_edma_debugfs_entry arrays are no longer compile-time
>> constant, they take up space on the stack, which exceeds the
>> warning limit after inlining:
>>
>> drivers/dma/dw-edma/dw-edma-v0-debugfs.c:280:6: error: stack frame size (1784) exceeds limit (1400) in 'dw_edma_v0_debugfs_on' [-Werror,-Wframe-larger-than]
>> void dw_edma_v0_debugfs_on(struct dw_edma *dw)
>>
>
>> Work around this by marking the functions with the largest arrays
>> as 'noinline_for_stack' to make them not use up space on the same
>> stack together.
>
> You mean the same stack !frame!, right?
Right.
>> -static void dw_edma_debugfs_regs_ch(struct dw_edma *dw, enum dw_edma_dir dir,
>> +static noinline_for_stack void
>> +dw_edma_debugfs_regs_ch(struct dw_edma *dw, enum dw_edma_dir dir,
>> u16 ch, struct dentry *dent)
>
> This doesn't seem like required. Does it? This method is called from
> two functions: dw_edma_debugfs_regs_wr() and dw_edma_debugfs_regs_rd()
> and if I am not mistaken will unlikely be inlined. Even if compiler will
> inline it the stack memory consumption won't change much since the
> functions aren't called from each other.
I did this mainly for consistency, marking all the functions that
have an array of dw_edma_debugfs_entry. I have retested without this
change now and adapted the changelog accordingly.
>> @@ -159,7 +161,7 @@ static void dw_edma_debugfs_regs_wr(struct dw_edma *dw, struct dentry *dent)
>> WR_REGISTER(dw, ch67_imwr_data),
>> WR_REGISTER(dw, linked_list_err_en),
>> };
>> - static const struct dw_edma_debugfs_entry debugfs_unroll_regs[] = {
>> + const struct dw_edma_debugfs_entry debugfs_unroll_regs[] = {
>
> I am confused how come these locals've turned to be static const?
> Neither my patches nor the Bjorn repo provide such changes:
> https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git/tree/drivers/dma/dw-edma/dw-edma-v0-debugfs.c?h=next#n139
> they were supposed to be just const.
>
> What repo is this patch based on?
My mistake, that was a revert from an earlier broken attempt to
fix the issue. It's fixed now after reverting the other patch
and rebasing.
>> /* eDMA channel context grouping */
>> WR_REGISTER_UNROLL(dw, engine_chgroup),
>> WR_REGISTER_UNROLL(dw, engine_hshake_cnt.lsb),
>> @@ -197,7 +199,8 @@ static void dw_edma_debugfs_regs_wr(struct dw_edma *dw, struct dentry *dent)
>> }
>> }
>>
>
>> -static void dw_edma_debugfs_regs_rd(struct dw_edma *dw, struct dentry *dent)
>> +static noinline void
>
> noinline_for_stack, right?
Fixed.
Arnd
Powered by blists - more mailing lists