mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vaneet Narang <v.narang@samsung.com>
To: Maninder Singh <maninder1.s@samsung.com>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"dvyukov@google.com" <dvyukov@google.com>,
	"chris@chris-wilson.co.uk" <chris@chris-wilson.co.uk>,
	"kasan-dev@googlegroups.com" <kasan-dev@googlegroups.com>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	PANKAJ MISHRA <pankaj.m@samsung.com>,
	AMIT SAHRAWAT <a.sahrawat@samsung.com>
Subject: RE: [PATCH v2] stackdepot: ignore junk last entry in case of switch from user mode.
Date: Thu, 12 Oct 2017 11:10:51 +0000	[thread overview]
Message-ID: <20171012111051epcms5p3117f59d0ec83cd2d62e36a0a2f73369f@epcms5p3> (raw)
In-Reply-To: <1507725802-44574-1-git-send-email-maninder1.s@samsung.com>

Hi Dmitry,

>diff --git a/lib/stackdepot.c b/lib/stackdepot.c
>index f87d138..a045748 100644
>--- a/lib/stackdepot.c
>+++ b/lib/stackdepot.c
>@@ -214,6 +214,13 @@ depot_stack_handle_t depot_save_stack(struct stack_trace *trace,
> 	if (unlikely(trace->nr_entries == 0))
> 		goto fast_exit;
> 
>+	/* 
>+	 * Ignore last entry if it belongs to user space
>+	 * in case of switch from user mode.
>+	 */
>+	if (!kernel_text_address(trace->entries[trace->nr_entries - 1]))

can we also add this check here:-
if (!kernel_text_address(trace->entries[trace->nr_entries - 1]) || in_interrupt())

Because on further checking , last frame in case of svc to interrupt mode is some random core kernel / Kernel Module address
like below:-

irq_exit+0xe4/0x140
__handle_domain_irq+0x9c/0x130
gic_handle_irq+0x40/0x80
__irq_svc+0x44/0x7c
hdmi_ocm_rx_get_scdc_sts+0x160/0x170 [sdp_hdmi]   >> we need this frme??

This generates mismatch with existing entires and new entries get created and depot_index
value keep on increasing slowly and reaches max value (STACK_ALLOC_SLABS_CAP) but after this change 
depot_index gets a stable value after some time. (Tested on ARM)

>+		trace->nr_entries--;
>+
> 	hash = hash_stack(trace->entries, trace->nr_entries);
> 	bucket = &stack_table[hash & STACK_HASH_MASK];
> 
>-- 
>1.9.1

Regards,
Vaneet Narang

  parent reply	other threads:[~2017-10-12 11:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20171011124443epcas5p23a0d74a4628baa3a1b424cb363fc5c81@epcas5p2.samsung.com>
2017-10-11 12:43 ` Maninder Singh
     [not found]   ` <CGME20171011124443epcas5p23a0d74a4628baa3a1b424cb363fc5c81@epcms5p3>
2017-10-12 11:10     ` Vaneet Narang [this message]
2017-10-12 13:59       ` Dmitry Vyukov
2017-10-13 15:19   ` Andrey Ryabinin

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=20171012111051epcms5p3117f59d0ec83cd2d62e36a0a2f73369f@epcms5p3 \
    --to=v.narang@samsung.com \
    --cc=a.sahrawat@samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=chris@chris-wilson.co.uk \
    --cc=dvyukov@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maninder1.s@samsung.com \
    --cc=mark.rutland@arm.com \
    --cc=pankaj.m@samsung.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®