dmaengine: dw-edma: reduce stack usage after debugfs rework
Subsystems (2)
PATCH v2 1/1 dmaengine: dw-edma: reduce stack usage after debugfs rework
From: Arnd Bergmann <[email protected]>
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 preventing dw_edma_debugfs_regs_{wr,rd} from both being inlined together, which cuts the stack frame size in half and makes it fit below the warning limit.
---
v2: rebase on top of dmaengine tree
--- drivers/dma/dw-edma/dw-edma-v0-debugfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/dma/dw-edma/dw-edma-v0-debugfs.c +4 -2
@@ -136,7 +136,8 @@ static void dw_edma_debugfs_regs_ch(struct dw_edma *dw, enum dw_edma_dir dir,dw_edma_debugfs_create_x32 (dw, debugfs_regs, nr_entries, dent); } -static void dw_edma_debugfs_regs_wr (struct dw_edma *dw,struct dentry *dent) +static noinline_for_stack void +dw_edma_debugfs_regs_wr (struct dw_edma *dw,struct dentry *dent) {const struct dw_edma_debugfs_entry debugfs_regs[] = {/* eDMA global registers */
@@ -197,7 +198,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_for_stack void +dw_edma_debugfs_regs_rd (struct dw_edma *dw,struct dentry *dent) {const struct dw_edma_debugfs_entry debugfs_regs[] = {/* eDMA global registers */
Signature · 1 line
2.39.0
Quoted 3 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
After the
dw_edma_debugfs_entryarrays are no longer compile-time
This sentence doesn't look complete to me.
Quoted 6 lines
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] voiddw_edma_v0_debugfs_on(struct dw_edma *dw)
Quoted 6 lines
Work around this by preventing dw_edma_debugfs_regs_{wr,rd} from both being inlined together, which cuts the stack frame size in half and makes it fit below the warning limit.
Fixes 5c0373eafd83 ("dmaengine: dw-edma: Move eDMA data pointer to debugfs node descriptor")Signed-off-by Arnd Bergmann <[email protected]>
Small style comment below, with that:
Quoted 11 lines
---
v2: rebase on top of dmaengine tree--- drivers/dma/dw-edma/dw-edma-v0-debugfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/dma/dw-edma/dw-edma-v0-debugfs.c +0
-0
drivers/dma/dw-edma/dw-edma-v0-debugfs.c static void dw_edma_debugfs_regs_ch(struct dw_edma *dw, enum dw_edma_dir dir, · line 140
Quoted 6 lines
drivers/dma/dw-edma/dw-edma-v0-debugfs.c +2
-1@@ -136,7 +136,8 @@ static void dw_edma_debugfs_regs_ch(struct dw_edma *dw, enum dw_edma_dir dir,dw_edma_debugfs_create_x32 (dw, debugfs_regs, nr_entries, dent); } -static void dw_edma_debugfs_regs_wr (struct dw_edma *dw,struct dentry *dent) +static noinline_for_stack void +dw_edma_debugfs_regs_wr (struct dw_edma *dw,struct dentry *dent)
For consistency, the function arguments could be wrapped:
static noinline_for_stack void dw_edma_debugfs_regs_wr(struct dw_edma *dw,
struct dentry *dent)
I could see that with the addition of "noinline_for_stack", the arguments are shifted towards the end of the line. But this style matches rest of the functions in this file.
Thanks,
Mani
Quoted 16 lines
drivers/dma/dw-edma/dw-edma-v0-debugfs.c +2
-1{const struct dw_edma_debugfs_entry debugfs_regs[] = {/* eDMA global registers */ @@ -197,7 +198,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_for_stack void +dw_edma_debugfs_regs_rd (struct dw_edma *dw,struct dentry *dent) {const struct dw_edma_debugfs_entry debugfs_regs[] = {/* eDMA global registers */ Signature · 1 line
2.39.0
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Quoted 9 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
After the
dw_edma_debugfs_entryarrays 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] voiddw_edma_v0_debugfs_on(struct dw_edma *dw)
Quoted 6 lines
Work around this by preventing dw_edma_debugfs_regs_{wr,rd} from both being inlined together, which cuts the stack frame size in half and makes it fit below the warning limit.
Fixes 5c0373eafd83 ("dmaengine: dw-edma: Move eDMA data pointer to debugfs node descriptor")Signed-off-by Arnd Bergmann <[email protected]>
Great! Thanks for the patch.
-Serge(y)
Quoted 33 lines
---
v2: rebase on top of dmaengine tree--- drivers/dma/dw-edma/dw-edma-v0-debugfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/dma/dw-edma/dw-edma-v0-debugfs.c +4
-2@@ -136,7 +136,8 @@ static void dw_edma_debugfs_regs_ch(struct dw_edma *dw, enum dw_edma_dir dir,dw_edma_debugfs_create_x32 (dw, debugfs_regs, nr_entries, dent); } -static void dw_edma_debugfs_regs_wr (struct dw_edma *dw,struct dentry *dent) +static noinline_for_stack void +dw_edma_debugfs_regs_wr (struct dw_edma *dw,struct dentry *dent) {const struct dw_edma_debugfs_entry debugfs_regs[] = {/* eDMA global registers */ @@ -197,7 +198,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_for_stack void +dw_edma_debugfs_regs_rd (struct dw_edma *dw,struct dentry *dent) {const struct dw_edma_debugfs_entry debugfs_regs[] = {/* eDMA global registers */ Signature · 1 line
2.39.0
Vinod Koul
maintainerQuoted 9 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
After the
dw_edma_debugfs_entryarrays 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] voiddw_edma_v0_debugfs_on(struct dw_edma *dw)
Quoted 8 lines
Work around this by preventing dw_edma_debugfs_regs_{wr,rd} from both being inlined together, which cuts the stack frame size in half and makes it fit below the warning limit.
Fixes 5c0373eafd83 ("dmaengine: dw-edma: Move eDMA data pointer to debugfs node descriptor")Signed-off-by Arnd Bergmann <[email protected]>---
v2: rebase on top of dmaengine tree
I dont have 5c0373eafd83 in my tree, I guess that went thru PCI tree, so I am going to defer this after merge window
Quoted 30 lines
--- drivers/dma/dw-edma/dw-edma-v0-debugfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/dma/dw-edma/dw-edma-v0-debugfs.c +4
-2@@ -136,7 +136,8 @@ static void dw_edma_debugfs_regs_ch(struct dw_edma *dw, enum dw_edma_dir dir,dw_edma_debugfs_create_x32 (dw, debugfs_regs, nr_entries, dent); } -static void dw_edma_debugfs_regs_wr (struct dw_edma *dw,struct dentry *dent) +static noinline_for_stack void +dw_edma_debugfs_regs_wr (struct dw_edma *dw,struct dentry *dent) {const struct dw_edma_debugfs_entry debugfs_regs[] = {/* eDMA global registers */ @@ -197,7 +198,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_for_stack void +dw_edma_debugfs_regs_rd (struct dw_edma *dw,struct dentry *dent) {const struct dw_edma_debugfs_entry debugfs_regs[] = {/* eDMA global registers */ Signature · 1 line
2.39.0
Signature · 1 line
~Vinod
Hello Vinod
Quoted 14 lines · Vinod Koul
Quoted 13 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
After the
dw_edma_debugfs_entryarrays 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] voiddw_edma_v0_debugfs_on(struct dw_edma *dw)Work around this by preventing dw_edma_debugfs_regs_{wr,rd} from both being inlined together, which cuts the stack frame size in half and makes it fit below the warning limit.
Quoted 7 lines
Quoted 4 lines
Fixes 5c0373eafd83 ("dmaengine: dw-edma: Move eDMA data pointer to debugfs node descriptor")Signed-off-by Arnd Bergmann <[email protected]>---
v2: rebase on top of dmaengine treeI dont have
5c0373eafd83in my tree, I guess that went thru PCI tree, so I am going to defer this after merge window
It's in the @Bjorn tree now
https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git/commit/?h=pci/ctrl/dwc&id=5c0373eafd8334343da22338d8588ed61e8daba0
If you are ok with the fix then @Bjorn could take the patch in to his repo. Right, @Bjorn?
-Serge(y)
Quoted 34 lines
Quoted 31 lines
--- drivers/dma/dw-edma/dw-edma-v0-debugfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/dma/dw-edma/dw-edma-v0-debugfs.c +4
-2@@ -136,7 +136,8 @@ static void dw_edma_debugfs_regs_ch(struct dw_edma *dw, enum dw_edma_dir dir,dw_edma_debugfs_create_x32 (dw, debugfs_regs, nr_entries, dent); } -static void dw_edma_debugfs_regs_wr (struct dw_edma *dw,struct dentry *dent) +static noinline_for_stack void +dw_edma_debugfs_regs_wr (struct dw_edma *dw,struct dentry *dent) {const struct dw_edma_debugfs_entry debugfs_regs[] = {/* eDMA global registers */ @@ -197,7 +198,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_for_stack void +dw_edma_debugfs_regs_rd (struct dw_edma *dw,struct dentry *dent) {const struct dw_edma_debugfs_entry debugfs_regs[] = {/* eDMA global registers */ Signature · 1 line
2.39.0Signature · 1 line
~Vinod
Quoted 22 lines · Serge Semin
Hello Vinod
Quoted 19 lines · Vinod Koul
Quoted 17 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
After the
dw_edma_debugfs_entryarrays 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] voiddw_edma_v0_debugfs_on(struct dw_edma *dw)Work around this by preventing dw_edma_debugfs_regs_{wr,rd} from both being inlined together, which cuts the stack frame size in half and makes it fit below the warning limit.
Fixes 5c0373eafd83 ("dmaengine: dw-edma: Move eDMA data pointer to debugfs node descriptor")Signed-off-by Arnd Bergmann <[email protected]>---
v2: rebase on top of dmaengine tree
Quoted 8 lines
Quoted 2 lines
I dont have
5c0373eafd83in my tree, I guess that went thru PCI tree, so I am going to defer this after merge windowIt's in the @Bjorn tree now
https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git/commit/?h=pci/ctrl/dwc&id=5c0373eafd8334343da22338d8588ed61e8daba0If you are ok with the fix then @Bjorn could take the patch in to his repo. Right, @Bjorn?
Sure:
Signature · 1 line
~Vinod
Quoted 20 lines · Serge Semin
Quoted 19 lines · Vinod Koul
Quoted 17 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
After the
dw_edma_debugfs_entryarrays 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] voiddw_edma_v0_debugfs_on(struct dw_edma *dw)Work around this by preventing dw_edma_debugfs_regs_{wr,rd} from both being inlined together, which cuts the stack frame size in half and makes it fit below the warning limit.
Fixes 5c0373eafd83 ("dmaengine: dw-edma: Move eDMA data pointer to debugfs node descriptor")Signed-off-by Arnd Bergmann <[email protected]>---
v2: rebase on top of dmaengine tree
Quoted 8 lines
Quoted 2 lines
I dont have
5c0373eafd83in my tree, I guess that went thru PCI tree, so I am going to defer this after merge windowIt's in the @Bjorn tree now
https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git/commit/?h=pci/ctrl/dwc&id=5c0373eafd8334343da22338d8588ed61e8daba0If you are ok with the fix then @Bjorn could take the patch in to his repo. Right, @Bjorn?
Yes, I squashed this into the original patch and tweaked the whitespace per Manivannan's comment.
Note that we've moved to a shared PCI git tree, so the helgaas/pci.git tree is obsolete and will bit rot until we remove it completely.
The new one is:
https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/
Bjorn
Quoted 27 lines · Bjorn Helgaas
Quoted 26 lines · Serge Semin
Quoted 14 lines · Vinod Koul
Quoted 13 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
After the
dw_edma_debugfs_entryarrays 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] voiddw_edma_v0_debugfs_on(struct dw_edma *dw)Work around this by preventing dw_edma_debugfs_regs_{wr,rd} from both being inlined together, which cuts the stack frame size in half and makes it fit below the warning limit.
Quoted 7 lines
Quoted 4 lines
Fixes 5c0373eafd83 ("dmaengine: dw-edma: Move eDMA data pointer to debugfs node descriptor")Signed-off-by Arnd Bergmann <[email protected]>---
v2: rebase on top of dmaengine treeI dont have
5c0373eafd83in my tree, I guess that went thru PCI tree, so I am going to defer this after merge windowIt's in the @Bjorn tree now
https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git/commit/?h=pci/ctrl/dwc&id=5c0373eafd8334343da22338d8588ed61e8daba0
Quoted 6 lines
Quoted 2 lines
If you are ok with the fix then @Bjorn could take the patch in to his repo. Right, @Bjorn?
Yes, I squashed this into the original patch and tweaked the whitespace per Manivannan's comment.
Great! Thanks.
Quoted 7 lines
Note that we've moved to a shared PCI git tree, so the helgaas/pci.git tree is obsolete and will bit rot until we remove it completely.
The new one is:
https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git/
Good to know. Thanks again.
-Serge(y)
Quoted 2 lines
Bjorn