Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp18560806ybl; Fri, 3 Jan 2020 04:52:35 -0800 (PST) X-Google-Smtp-Source: APXvYqx37GZHlcu8AAg34iEd4jciX5CJ13/DlGF6MBW0EDCpEpJuYo/pTon2VwuCbz2EQVaVjH9C X-Received: by 2002:a9d:7b4e:: with SMTP id f14mr100384915oto.355.1578055954924; Fri, 03 Jan 2020 04:52:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578055954; cv=none; d=google.com; s=arc-20160816; b=VbbCBjPnX6Su9hnobpl+RFETskgzVJkKSUp7t+vDLtmftgaE2Oe9mlOFJtFjlWiIfY OvyAOn5CuwjCfVddYIzes+S9MoZBcoimKdwmkT82J69za6w/H8qvyE/6TlyYBHV6q0ox eR+5zlfLNNyDKQOJrZz2JuV/H0f+YNhaJgkN9bVNAvzkZboQ7SwU9ebrKToKA7P++v8d kcmz+QzJbzF5h9/FQNKY1xw6dC4N46kWyy6RH3UYGcbXyt9HHyRTtxowrGwm8n27F4Bk qv+4EsSOvfdBYBK3SQZ3/4rWbIH8C2rcoTxYKqlF2nIqafY1cOB7aowMzrSOHwctyUE6 ohXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type :content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:cc:to:subject:dkim-signature :dkim-filter; bh=0ZeVM/KjBET1JFzYLjy5seckIDWrndtGfSryu8ihgKs=; b=wxOfdLDgwUkZ+SoQfVr2yggyXY8KWA4bAmY2W02WtcwzRZrAETA8JFpUgU0NKxLgRM ytAyFjTgLPFgWkpPjug55oN5rKhMAf9sINcNBaRVUMLf/AQ/MGKi5whz+wQWYPpiCBqA FRWCXvjdh7AQQbSi0oGXj5jcyzRyb4F9PLi/J/O9Ppb6hYJtDC01rFyOPbjw4sI5vbp1 cgLzeZb9QgKFKf/Lqwx2UEuTX/p1tpA4QPNcebKNMZOdhYu+1qvxF53vUvk4yiEceZmm d1OkpYaSfzyDf9Xatr/qYbOuwUXumu2qw97oyYCwstIUyJa4YrjHtrvYZLztEv/FM4gf s2BQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=cXOpPzu5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d20si24711673oic.40.2020.01.03.04.52.22; Fri, 03 Jan 2020 04:52:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=cXOpPzu5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727754AbgACMuo (ORCPT + 99 others); Fri, 3 Jan 2020 07:50:44 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:40670 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727350AbgACMuo (ORCPT ); Fri, 3 Jan 2020 07:50:44 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200103125042euoutp01d117a0881d289f38c4851a9df67161d3~mYW2ezTSd0051000510euoutp01r for ; Fri, 3 Jan 2020 12:50:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200103125042euoutp01d117a0881d289f38c4851a9df67161d3~mYW2ezTSd0051000510euoutp01r DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1578055842; bh=0ZeVM/KjBET1JFzYLjy5seckIDWrndtGfSryu8ihgKs=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=cXOpPzu5PFuwE5VlgesZx/LMQ+3nxaqzMw/RLtLvDQBlRmOs7WpWv+mqPs0DdXd6e rh44rsDrcQd+zB5ZGStbfkoFVcOarnxojd56FVoZcXVc68ynkvbgMy5JmdnnM/O54b rWXvpjqv47MGVBIcb26j+VpQSAtPBVs9wR3OS+dw= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200103125042eucas1p190d0d109ec05b856726b70e1e36f6719~mYW2SM93B1400814008eucas1p1r; Fri, 3 Jan 2020 12:50:42 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id BB.79.60679.2A83F0E5; Fri, 3 Jan 2020 12:50:42 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200103125042eucas1p1bcd7c14d3bdf141992015c37db683b15~mYW1z_Phg1400814008eucas1p1q; Fri, 3 Jan 2020 12:50:42 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200103125042eusmtrp282b436f048fa0636dfab60cc089be734~mYW1zUnIn1566015660eusmtrp2A; Fri, 3 Jan 2020 12:50:42 +0000 (GMT) X-AuditID: cbfec7f4-0e5ff7000001ed07-a6-5e0f38a29d0d Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 50.D6.08375.2A83F0E5; Fri, 3 Jan 2020 12:50:42 +0000 (GMT) Received: from [106.120.51.71] (unknown [106.120.51.71]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200103125040eusmtip21c99b86af833f345b01fa301fb31bdd5~mYW0q4G8v2676126761eusmtip2n; Fri, 3 Jan 2020 12:50:40 +0000 (GMT) Subject: Re: [PATCH] omapfb: reduce stack usage To: Sudip Mukherjee Cc: linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, Ladislav Michl , Joe Perches From: Bartlomiej Zolnierkiewicz Message-ID: Date: Fri, 3 Jan 2020 13:50:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20191018163004.23498-1-sudipm.mukherjee@gmail.com> Content-Language: en-US Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrLKsWRmVeSWpSXmKPExsWy7djP87qLLPjjDJ68V7K48vU9m8Xs+49Z LGavnMxkcaLvA6vF5V1zgGJL+lksDpyewuzA7rFz1l12j6Mr1zJ53O8+zuTxZdU1Zo/Pm+QC WKO4bFJSczLLUov07RK4MhZO/Mde0CJT0b27mamBcYl4FyMnh4SAicT6870sXYxcHEICKxgl Oi8cZ4ZwvjBK/Fx/gxXC+cwosfHVK0aYlo+7XkIlljNKLGxbAdXyllFi9fGtYFXCAvoSTU1r WEBsEQEDibvrlrKDFDELHGGUeDd3MlgRm4CVxMT2VWA2r4CdxPH5k5hAbBYBFYnNEyeyg9ii AhESnx4cZoWoEZQ4OfMJ2FBOAQeJty8ugsWZBcQlbj2ZzwRhy0tsfzsH7CIJgV3sEsumn2eD uNtFYsGjf1C2sMSr41vYIWwZif87QZpBGtYxSvzteAHVvZ1RYvlkmA5riTvnfgHZHEArNCXW 79KHCDtKdH1qZQIJSwjwSdx4KwhxBJ/EpG3TmSHCvBIdbUIQ1WoSG5ZtYINZ27VzJfMERqVZ SF6bheSdWUjemYWwdwEjyypG8dTS4tz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UnuiRWRT17v4Hat2s1k+ uls/zVv+8vnpQVqTrgeocHm+ji0692/zjSf7hPQ3LWA23e4duoBr/xyLt2I192VcnTkzF1f9 Vcz9dtv7waawpc80XrQbGjW/zVy02bL46dGVu68HPSw/FL7Q9tLthwdrV/3Q+XD865M5zr0l 6ypWKbEUZyQaajEXFScCAOw4Q4DQAgAA X-CMS-MailID: 20200103125042eucas1p1bcd7c14d3bdf141992015c37db683b15 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20191018163010epcas4p1a11973fbca0b3248dae6b5e87cdbf1f3 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20191018163010epcas4p1a11973fbca0b3248dae6b5e87cdbf1f3 References: <20191018163004.23498-1-sudipm.mukherjee@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/18/19 6:30 PM, Sudip Mukherjee wrote: > The build of xtensa allmodconfig is giving a warning of: > In function 'dsi_dump_dsidev_irqs': > warning: the frame size of 1120 bytes is larger than 1024 bytes > > Allocate the memory for 'struct dsi_irq_stats' dynamically instead > of assigning it in stack. > > Signed-off-by: Sudip Mukherjee > --- > drivers/video/fbdev/omap2/omapfb/dss/dsi.c | 24 ++++++++++++++---------- > 1 file changed, 14 insertions(+), 10 deletions(-) > > diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dsi.c b/drivers/video/fbdev/omap2/omapfb/dss/dsi.c > index d620376216e1..43402467bf40 100644 > --- a/drivers/video/fbdev/omap2/omapfb/dss/dsi.c > +++ b/drivers/video/fbdev/omap2/omapfb/dss/dsi.c > @@ -1536,22 +1536,25 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev, > { > struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev); > unsigned long flags; > - struct dsi_irq_stats stats; > + struct dsi_irq_stats *stats; > > + stats = kmalloc(sizeof(*stats), GFP_KERNEL); > + if (!stats) > + return; > spin_lock_irqsave(&dsi->irq_stats_lock, flags); > > - stats = dsi->irq_stats; > + memcpy(stats, &dsi->irq_stats, sizeof(*stats)); "stats" copy is only needed for generating debugfs information. We can probably reduce the stack usage and also simplify the driver by just accessing dsi->irq_stats directly before cleaning it (we would also need to extend coverage of spinlock but the code is debug only so this should not be a problem). Care to try this approach? Best regards, -- Bartlomiej Zolnierkiewicz Samsung R&D Institute Poland Samsung Electronics > memset(&dsi->irq_stats, 0, sizeof(dsi->irq_stats)); > dsi->irq_stats.last_reset = jiffies; > > spin_unlock_irqrestore(&dsi->irq_stats_lock, flags); > > seq_printf(s, "period %u ms\n", > - jiffies_to_msecs(jiffies - stats.last_reset)); > + jiffies_to_msecs(jiffies - stats->last_reset)); > > - seq_printf(s, "irqs %d\n", stats.irq_count); > + seq_printf(s, "irqs %d\n", stats->irq_count); > #define PIS(x) \ > - seq_printf(s, "%-20s %10d\n", #x, stats.dsi_irqs[ffs(DSI_IRQ_##x)-1]); > + seq_printf(s, "%-20s %10d\n", #x, stats->dsi_irqs[ffs(DSI_IRQ_##x)-1]); > > seq_printf(s, "-- DSI%d interrupts --\n", dsi->module_id + 1); > PIS(VC0); > @@ -1575,10 +1578,10 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev, > > #define PIS(x) \ > seq_printf(s, "%-20s %10d %10d %10d %10d\n", #x, \ > - stats.vc_irqs[0][ffs(DSI_VC_IRQ_##x)-1], \ > - stats.vc_irqs[1][ffs(DSI_VC_IRQ_##x)-1], \ > - stats.vc_irqs[2][ffs(DSI_VC_IRQ_##x)-1], \ > - stats.vc_irqs[3][ffs(DSI_VC_IRQ_##x)-1]); > + stats->vc_irqs[0][ffs(DSI_VC_IRQ_##x)-1], \ > + stats->vc_irqs[1][ffs(DSI_VC_IRQ_##x)-1], \ > + stats->vc_irqs[2][ffs(DSI_VC_IRQ_##x)-1], \ > + stats->vc_irqs[3][ffs(DSI_VC_IRQ_##x)-1]); > > seq_printf(s, "-- VC interrupts --\n"); > PIS(CS); > @@ -1594,7 +1597,7 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev, > > #define PIS(x) \ > seq_printf(s, "%-20s %10d\n", #x, \ > - stats.cio_irqs[ffs(DSI_CIO_IRQ_##x)-1]); > + stats->cio_irqs[ffs(DSI_CIO_IRQ_##x)-1]); > > seq_printf(s, "-- CIO interrupts --\n"); > PIS(ERRSYNCESC1); > @@ -1618,6 +1621,7 @@ static void dsi_dump_dsidev_irqs(struct platform_device *dsidev, > PIS(ULPSACTIVENOT_ALL0); > PIS(ULPSACTIVENOT_ALL1); > #undef PIS > + kfree(stats); > } > > static void dsi1_dump_irqs(struct seq_file *s)