LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 1/1] exception/stackdepot: add irqentry section in case of STACKDEPOT
       [not found] <CGME20210818071602epcas5p4fecf459638312c95c5d5aaa29e7e983a@epcas5p4.samsung.com>
@ 2021-08-18  7:15 ` Maninder Singh
       [not found]   ` <CGME20210818071602epcas5p4fecf459638312c95c5d5aaa29e7e983a@epcms5p6>
  0 siblings, 1 reply; 4+ messages in thread
From: Maninder Singh @ 2021-08-18  7:15 UTC (permalink / raw)
  To: linux, catalin.marinas, will, mark.rutland, joey.gouly, maz, pcc,
	amit.kachhap, ryabinin.a.a, dvyukov, akpm
  Cc: linux-arm-kernel, linux-kernel, kasan-dev, v.narang, a.sahrawat,
	Maninder Singh

As of now if CONFIG_FUNCTION_GRAPH_TRACER is disabled some functions
like gic_handle_irq will not be added in irqentry text section.

which leads to adding more stacks in stackdepot as frames below IRQ
will not be filtered with filter_irq_stack() function.

checked with debug interface for satckdepot:
https://lkml.org/lkml/2017/11/22/242

e.g. (ARM)
stack count 23188 backtrace
 prep_new_page+0x14c/0x160
 get_page_from_freelist+0x1258/0x1350
...
 __handle_domain_irq+0x1ac/0x4ac
 gic_handle_irq+0x44/0x80
 __irq_svc+0x5c/0x98
 __slab_alloc.constprop.0+0x84/0xac
 __kmalloc+0x31c/0x340
 sf_malloc+0x14/0x18

and for same _irq_svc there were 25000 calls which was causing
memory pressure of 2MB more on satckdepot, which will keep increasing.

Before patch memory consumption on ARM target after 2 hours:
Memory consumed by Stackdepot:3600 KB

After change:
============
Memory consumed by Stackdepot:1744 KB

 prep_new_page+0x14c/0x160
 get_page_from_freelist+0x2e4/0x1350
...
 __handle_domain_irq+0x1ac/0x4ac
 gic_handle_irq+0x44/0x80

^^^^^ no frames below this.

Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Signed-off-by: Vaneet Narang <v.narang@samsung.com>
---
 arch/arm/include/asm/exception.h   | 2 +-
 arch/arm64/include/asm/exception.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/exception.h b/arch/arm/include/asm/exception.h
index 58e039a851af..3f4534cccc0f 100644
--- a/arch/arm/include/asm/exception.h
+++ b/arch/arm/include/asm/exception.h
@@ -10,7 +10,7 @@
 
 #include <linux/interrupt.h>
 
-#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+#if defined(CONFIG_FUNCTION_GRAPH_TRACER) || defined(CONFIG_STACKDEPOT)
 #define __exception_irq_entry	__irq_entry
 #else
 #define __exception_irq_entry
diff --git a/arch/arm64/include/asm/exception.h b/arch/arm64/include/asm/exception.h
index 339477dca551..ef2581b63405 100644
--- a/arch/arm64/include/asm/exception.h
+++ b/arch/arm64/include/asm/exception.h
@@ -13,7 +13,7 @@
 
 #include <linux/interrupt.h>
 
-#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+#if defined(CONFIG_FUNCTION_GRAPH_TRACER) || defined(CONFIG_STACKDEPOT)
 #define __exception_irq_entry	__irq_entry
 #else
 #define __exception_irq_entry	__kprobes
-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH 1/1] exception/stackdepot: add irqentry section in case of STACKDEPOT
       [not found]   ` <CGME20210818071602epcas5p4fecf459638312c95c5d5aaa29e7e983a@epcms5p6>
@ 2021-09-06 12:43     ` Maninder Singh
  2021-09-06 12:57       ` Russell King (Oracle)
       [not found]       ` <CGME20210818071602epcas5p4fecf459638312c95c5d5aaa29e7e983a@epcms5p4>
  0 siblings, 2 replies; 4+ messages in thread
From: Maninder Singh @ 2021-09-06 12:43 UTC (permalink / raw)
  To: Maninder Singh, linux, catalin.marinas, will, mark.rutland,
	joey.gouly, maz, pcc, amit.kachhap, ryabinin.a.a, dvyukov, akpm
  Cc: linux-arm-kernel, linux-kernel, kasan-dev, Vaneet Narang, AMIT SAHRAWAT


Hi,

Any inputs on this?

>As of now if CONFIG_FUNCTION_GRAPH_TRACER is disabled some functions
>like gic_handle_irq will not be added in irqentry text section.
> 
>which leads to adding more stacks in stackdepot as frames below IRQ
>will not be filtered with filter_irq_stack() function.
> 
>checked with debug interface for satckdepot:
>https://lkml.org/lkml/2017/11/22/242
> 
>e.g. (ARM)
>stack count 23188 backtrace
> prep_new_page+0x14c/0x160
> get_page_from_freelist+0x1258/0x1350
>...
> __handle_domain_irq+0x1ac/0x4ac
> gic_handle_irq+0x44/0x80
> __irq_svc+0x5c/0x98
> __slab_alloc.constprop.0+0x84/0xac
> __kmalloc+0x31c/0x340
> sf_malloc+0x14/0x18
> 
>and for same _irq_svc there were 25000 calls which was causing
>memory pressure of 2MB more on satckdepot, which will keep increasing.
> 
>Before patch memory consumption on ARM target after 2 hours:
>Memory consumed by Stackdepot:3600 KB
> 
>After change:
>============
>Memory consumed by Stackdepot:1744 KB
> 
> prep_new_page+0x14c/0x160
> get_page_from_freelist+0x2e4/0x1350
>...
> __handle_domain_irq+0x1ac/0x4ac
> gic_handle_irq+0x44/0x80
> 
>^^^^^ no frames below this.
> 
>Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
>Signed-off-by: Vaneet Narang <v.narang@samsung.com>
>---
> arch/arm/include/asm/exception.h   | 2 +-
> arch/arm64/include/asm/exception.h | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
> 
>diff --git a/arch/arm/include/asm/exception.h b/arch/arm/include/asm/exception.h
>index 58e039a851af..3f4534cccc0f 100644
>--- a/arch/arm/include/asm/exception.h
>+++ b/arch/arm/include/asm/exception.h
>@@ -10,7 +10,7 @@
> 
> #include <linux/interrupt.h>
> 
>-#ifdef CONFIG_FUNCTION_GRAPH_TRACER
>+#if defined(CONFIG_FUNCTION_GRAPH_TRACER) || defined(CONFIG_STACKDEPOT)
> #define __exception_irq_entry        __irq_entry
> #else
> #define __exception_irq_entry
>diff --git a/arch/arm64/include/asm/exception.h b/arch/arm64/include/asm/exception.h
>index 339477dca551..ef2581b63405 100644
>--- a/arch/arm64/include/asm/exception.h
>+++ b/arch/arm64/include/asm/exception.h
>@@ -13,7 +13,7 @@
> 
> #include <linux/interrupt.h>
> 
>-#ifdef CONFIG_FUNCTION_GRAPH_TRACER
>+#if defined(CONFIG_FUNCTION_GRAPH_TRACER) || defined(CONFIG_STACKDEPOT)
> #define __exception_irq_entry        __irq_entry
> #else
> #define __exception_irq_entry        __kprobes
>-- 

 
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] exception/stackdepot: add irqentry section in case of STACKDEPOT
  2021-09-06 12:43     ` Maninder Singh
@ 2021-09-06 12:57       ` Russell King (Oracle)
       [not found]       ` <CGME20210818071602epcas5p4fecf459638312c95c5d5aaa29e7e983a@epcms5p4>
  1 sibling, 0 replies; 4+ messages in thread
From: Russell King (Oracle) @ 2021-09-06 12:57 UTC (permalink / raw)
  To: Maninder Singh
  Cc: catalin.marinas, will, mark.rutland, joey.gouly, maz, pcc,
	amit.kachhap, ryabinin.a.a, dvyukov, akpm, linux-arm-kernel,
	linux-kernel, kasan-dev, Vaneet Narang, AMIT SAHRAWAT

On Mon, Sep 06, 2021 at 06:13:51PM +0530, Maninder Singh wrote:
> 
> Hi,
> 
> Any inputs on this?

No, I've not heard of stackdepot, I don't know what it is, or what
it does. It doesn't appear to be documented in Documentation - case
insensitive grep for "stackdepot" gets no hits. No help text on its
Kconfig option.

How are arch maintainers supposed to know anything about this?

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH 1/1] exception/stackdepot: add irqentry section in case of STACKDEPOT
       [not found]       ` <CGME20210818071602epcas5p4fecf459638312c95c5d5aaa29e7e983a@epcms5p4>
@ 2021-09-10 12:59         ` Maninder Singh
  0 siblings, 0 replies; 4+ messages in thread
From: Maninder Singh @ 2021-09-10 12:59 UTC (permalink / raw)
  To: Russell King (Oracle), ryabinin.a.a, glider
  Cc: catalin.marinas, will, mark.rutland, joey.gouly, maz, pcc,
	amit.kachhap, dvyukov, akpm, linux-arm-kernel, linux-kernel,
	kasan-dev, Vaneet Narang, AMIT SAHRAWAT

Hi,

>No, I've not heard of stackdepot, I don't know what it is, or what
>it does. It doesn't appear to be documented in Documentation - case
>insensitive grep for "stackdepot" gets no hits. No help text on its
>Kconfig option.
> 
>How are arch maintainers supposed to know anything about this?

ok.

Added reviewers/maintainers of stackdepot and KASAN(filter_irq_stack) code.
Because on our ARM H/W it was causing memory issue, and without this change
purpose of filter_irq_stack was gone as it was not filtering irq stacks.

If anyone else has any views or comments for this.

Thanks
Maninder Singh

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-09-10 12:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20210818071602epcas5p4fecf459638312c95c5d5aaa29e7e983a@epcas5p4.samsung.com>
2021-08-18  7:15 ` [PATCH 1/1] exception/stackdepot: add irqentry section in case of STACKDEPOT Maninder Singh
     [not found]   ` <CGME20210818071602epcas5p4fecf459638312c95c5d5aaa29e7e983a@epcms5p6>
2021-09-06 12:43     ` Maninder Singh
2021-09-06 12:57       ` Russell King (Oracle)
     [not found]       ` <CGME20210818071602epcas5p4fecf459638312c95c5d5aaa29e7e983a@epcms5p4>
2021-09-10 12:59         ` Maninder Singh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).