Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp223187ybk; Sat, 9 May 2020 00:45:53 -0700 (PDT) X-Google-Smtp-Source: APiQypKaG0TLcQ2+9R00CEIx+nEVhC5L8DCY68o/6dL7PGe9B6oRvIpcaD3K3odEYzi7b9B3t3pc X-Received: by 2002:a05:6402:2208:: with SMTP id cq8mr5452406edb.293.1589010352923; Sat, 09 May 2020 00:45:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589010352; cv=none; d=google.com; s=arc-20160816; b=gqGYeJm1K9I7jF0NqGXzqX9O4/fWc1gdOQEiLnBCLCku4IwXyF8p5EYJO4RArsZfwf lkK5VaYLfIBhRVFIbhzPI/9WcAJ6B4HKKDVwGUiHfLJ08tpdRn+yaY/UlkWMmmyABk72 IzjsqPw5wER49n01v8JD582dlgGtOhs7OjAgdc8WNI4WOchIvPvzgOSP39QUMwn00y4p f960kpCiaulyiIL9iO+RNF8PL29U9QpieA0c5DzyqlUuvEUTMs3xhtUiSRHpmHRMGv4k E3no9a/7mnGK7WN89679ve4RI98lVVl0TqnokkahxnEnGDTKm0CgUhMreZJ9WNBVrPIt G9pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=cvyOd1WsEVjCH2wf8G/bwMzDjemoQm3XWekZsG7OlCg=; b=IKOTNCkSCN7wxPb0541q8pBpuqKK4KqX8c781w8o/uqcn3cSVg2PpwwNyOVoK48lJX ZfOvPnnWjwTEmcp78NpPIqHUh+RGcnNdv3dN8YSfE3gmfl+Lz4HTDilPW1vz4eTIMzLH /iVxQXuquYaDpyJmwLo2Z4U1TMJr/jee8dcRtDUjaI2YrBqsbDyJ0SncZFQSOi0djk+X S2FlxINWcPYWZFP4kVsXDIZW2islORmRNq38/sYCSw3jhPp2X1HRiaWKTwjG5GFqS8Dn yDs6fBYf2hBRQ0h02Jt4wOALIQ5SpXHpMLXzsnQKaHv1fXYKR50sR1y3L8nzuG4w98WC qOJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=tCNhpZxM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 4si2619716ejy.347.2020.05.09.00.45.30; Sat, 09 May 2020 00:45:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=tCNhpZxM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726415AbgEIHnI (ORCPT + 99 others); Sat, 9 May 2020 03:43:08 -0400 Received: from conssluserg-02.nifty.com ([210.131.2.81]:30489 "EHLO conssluserg-02.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725730AbgEIHnI (ORCPT ); Sat, 9 May 2020 03:43:08 -0400 Received: from mail-vs1-f50.google.com (mail-vs1-f50.google.com [209.85.217.50]) (authenticated) by conssluserg-02.nifty.com with ESMTP id 0497glKL009568 for ; Sat, 9 May 2020 16:42:48 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com 0497glKL009568 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1589010168; bh=cvyOd1WsEVjCH2wf8G/bwMzDjemoQm3XWekZsG7OlCg=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=tCNhpZxMyGb9KyIL5m5vkSNe+bvedTRJeX/PrYaljbF1zN5Ha95fDOko+86gbTIOk OeC8hxe1Tg4Tl17Z4Ym9vAvu1TtUHP74Df1G5/AyY98X8/Jzoc1xXpH7/omPcLziOE 0BJV1fW7newWr0lRHQfLfX80XRtJAhrSHtcV3/XCHEpRDfnftccJCGN8RHM0aGpt91 wrtRgfNruSX7c8myupqXi22JbcR62tHBps+7umRLzfwWVUnpmBUJ27RCLPOapOmX7G 0w7l1BdAlOKetzcjrVcIWNHdXnkaR37auRAhRL0R7uwERsXa2UE0TMElecY4Iz1ViR XT0r+Yq5T8Oug== X-Nifty-SrcIP: [209.85.217.50] Received: by mail-vs1-f50.google.com with SMTP id s11so2505913vsq.13 for ; Sat, 09 May 2020 00:42:47 -0700 (PDT) X-Gm-Message-State: AGi0PuZElUxy1If/0bNdHbDV8pi2FN/K9RxiglDEh6GN3jq1kilPnwCV oA3dg+WFS2qHfMZNOZ4TT40CvXihq5l+fAimEbw= X-Received: by 2002:a05:6102:3c7:: with SMTP id n7mr4732676vsq.179.1589010166640; Sat, 09 May 2020 00:42:46 -0700 (PDT) MIME-Version: 1.0 References: <1588935797-7283-1-git-send-email-maninder1.s@samsung.com> In-Reply-To: <1588935797-7283-1-git-send-email-maninder1.s@samsung.com> From: Masahiro Yamada Date: Sat, 9 May 2020 16:42:10 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 1/4] scripts/checkstack.pl: don't display $dre as different entity To: Maninder Singh Cc: "George G. Davis" , Linux Kernel Mailing List , AMIT SAHRAWAT , Arnd Bergmann , Andi Kleen , Vaneet Narang Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 8, 2020 at 8:10 PM Maninder Singh wrote: > > currently script prints stack usage for functions > in two ways:($re and $dre) > > dre breaks sorting mechanism. > 0xffffa00011f26f88 sunxi_mux_clk_setup.isra.0 [vmlinux]:Dynamic (0x140) > .. > 0xffffa00011f27210 sunxi_divs_clk_setup [vmlinux]: Dynamic (0x1d0) > > so we can print it in decimal only. > > Also address before function name is changed to function > start address rather than stack consumption address. > Because in next patch, arm has two ways to use stack > which can be clubbed and printed in one function only. > > All symbols whose stack by adding(re and dre) is greater than > 100, will be printed. > > 0xffffa00011f2720c0 sunxi_divs_clk_setup [vmlinux]: 464 > ... > 0xffffa00011f26f840 sunxi_mux_clk_setup.isra.0 [vmlinux]:320 > > Co-developed-by: Vaneet Narang > Signed-off-by: Vaneet Narang > Signed-off-by: Maninder Singh > --- All applied to linux-kbuild. Thanks. > v1: https://lkml.org/lkml/2020/4/30/530 > v2: review comments by Masahiro Yamada incorporated > > scripts/checkstack.pl | 54 +++++++++++++++++++++++++-------------------------- > 1 file changed, 27 insertions(+), 27 deletions(-) > > diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl > index 371bd17..6957108 100755 > --- a/scripts/checkstack.pl > +++ b/scripts/checkstack.pl > @@ -109,11 +109,30 @@ my (@stack, $re, $dre, $x, $xs, $funcre); > # > # main() > # > -my ($func, $file, $lastslash); > +my ($func, $file, $lastslash, $total_size, $addr, $intro); > + > +$total_size = 0; > > while (my $line = ) { > if ($line =~ m/$funcre/) { > $func = $1; > + next if $line !~ m/^($xs*)/; > + if ($total_size > 100) { > + push @stack, "$intro$total_size\n"; > + } > + > + $addr = $1; > + $addr =~ s/ /0/g; > + $addr = "0x$addr"; > + > + $intro = "$addr $func [$file]:"; > + my $padlen = 56 - length($intro); > + while ($padlen > 0) { > + $intro .= ' '; > + $padlen -= 8; > + } > + > + $total_size = 0; > } > elsif ($line =~ m/(.*):\s*file format/) { > $file = $1; > @@ -134,37 +153,18 @@ while (my $line = ) { > } > next if ($size > 0x10000000); > > - next if $line !~ m/^($xs*)/; > - my $addr = $1; > - $addr =~ s/ /0/g; > - $addr = "0x$addr"; > - > - my $intro = "$addr $func [$file]:"; > - my $padlen = 56 - length($intro); > - while ($padlen > 0) { > - $intro .= ' '; > - $padlen -= 8; > - } > - next if ($size < 100); > - push @stack, "$intro$size\n"; > + $total_size += $size; > } > elsif (defined $dre && $line =~ m/$dre/) { > - my $size = "Dynamic ($1)"; > - > - next if $line !~ m/^($xs*)/; > - my $addr = $1; > - $addr =~ s/ /0/g; > - $addr = "0x$addr"; > + my $size = $1; > > - my $intro = "$addr $func [$file]:"; > - my $padlen = 56 - length($intro); > - while ($padlen > 0) { > - $intro .= ' '; > - $padlen -= 8; > - } > - push @stack, "$intro$size\n"; > + $size = hex($size) if ($size =~ /^0x/); > + $total_size += $size; > } > } > +if ($total_size > 100) { > + push @stack, "$intro$total_size\n"; > +} > > # Sort output by size (last field) > print sort { ($b =~ /:\t*(\d+)$/)[0] <=> ($a =~ /:\t*(\d+)$/)[0] } @stack; > -- > 1.9.1 > -- Best Regards Masahiro Yamada