Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1759138ybg; Sat, 19 Oct 2019 01:55:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqxP4zJQpMcsg/2GLfHVJqyG9MZyht1AWbVsGQWfICMJ6LIfuVUr+3g0ZuDWuoMcaO7CK59l X-Received: by 2002:a05:6402:1514:: with SMTP id f20mr14272575edw.35.1571475342462; Sat, 19 Oct 2019 01:55:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571475342; cv=none; d=google.com; s=arc-20160816; b=psINVq/QpIC173InV5Gx+6QR3o8afrBlYPbRxVYOJit0dCleKzdoHBmvzyZdA2zLaB E5S5Rz8j28yA3+vPKGdsyBBzTeMOyCF6Uc9d9L7EeURRRBPda7ha3IhABzrZsGOzs3qq cFyI2DaUZnBDpivrzBRfjD2K6RAsQG+sA77I1ywPd5kOL+j5sHD9kbkjNYqBAmk7yjWr DqsSgm+GR4M8KTFZuFpINTK7a5aliSFiPp1HzTmIEXYD0yCH4KBWCtq+g9xfVmLWJQtW MosEoaUWS84r/Pg24sArB97wfDq4B9tCRi2lTauTJfxczUa/a9YOac8lmr7nCylqacKc b1/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=FA/4o5rCEl0+NUCM2e6X/jnf+PG2fgwrQWDpcdAKjug=; b=Lb6cse5BsgWW57Apj79CEyTU5+xT73wwkTebFRWBG0QFOB5VHKyC5za+RMDPwpKmvg atc8T3+Ui0EGZ4o16UqOdT8OM2eROO8pwsm7TuY2th1GvoGNTCQ14l1a11P4T/iQAA6o DZVsuTCJ5Dl+5JjBF7FFk2KHdfzVojnMWcojbEELOhdHWGF0upQyWkEMKs1wpll5Uu5t WCo0+RagwX5xp6ep/Yv2yMVkKTLpi1wXTrLT/0zAycjMVj2vB8uI/Fqb9Cjc7OocAbxQ SO54ebbkzsJMucSi1O2eWtR0oxQlBeZyLS54xKfZbP9CfbSYLgxGq3M+oN3kyQJ9FAxY qO6Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c14si5684062edc.81.2019.10.19.01.55.19; Sat, 19 Oct 2019 01:55:42 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2634506AbfJRR1m (ORCPT + 99 others); Fri, 18 Oct 2019 13:27:42 -0400 Received: from eddie.linux-mips.org ([148.251.95.138]:46700 "EHLO cvs.linux-mips.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2505513AbfJRR1f (ORCPT ); Fri, 18 Oct 2019 13:27:35 -0400 Received: (from localhost user: 'ladis' uid#1021 fake: STDIN (ladis@eddie.linux-mips.org)) by eddie.linux-mips.org id S23993628AbfJRR1bkgOYe (ORCPT + 2 others); Fri, 18 Oct 2019 19:27:31 +0200 Date: Fri, 18 Oct 2019 19:27:28 +0200 From: Ladislav Michl To: Sudip Mukherjee Cc: Bartlomiej Zolnierkiewicz , linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: Re: [PATCH] omapfb: reduce stack usage Message-ID: <20191018172728.GA11857@lenoch> References: <20191018163004.23498-1-sudipm.mukherjee@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191018163004.23498-1-sudipm.mukherjee@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 18, 2019 at 05:30:04PM +0100, 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. So now function can fail silently, executes longer, code is sligthly bigger... And all that to silent warning about exceeding frame size. Is it really worth "fixing"? > 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)); > 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) > -- > 2.11.0