mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/omap: dsi: Fix excessive stack usage
@ 2022-09-16  8:22 Tomi Valkeinen
  2022-09-16  8:22 ` [PATCH 2/2] drm/omap: Fix kernel docs Tomi Valkeinen
  2022-09-16  8:23 ` [PATCH 1/2] drm/omap: dsi: Fix excessive stack usage Arnd Bergmann
  0 siblings, 2 replies; 4+ messages in thread
From: Tomi Valkeinen @ 2022-09-16  8:22 UTC (permalink / raw)
  To: dri-devel, linux-kernel, linux-omap
  Cc: Arnd Bergmann, Linus Walleij, Tomi Valkeinen, kernel test robot

dsi_dump_dsi_irqs(), a function used for debugfs prints, has a large
struct in its frame, which can result in:

drivers/gpu/drm/omapdrm/dss/dsi.c:1126:1: warning: the frame size of 1060 bytes is larger than 1024 bytes [-Wframe-larger-than=]

As the performance of the function is of no concern, let's allocate the
struct with kmalloc instead.

Compile-tested only.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reported-by: kernel test robot <lkp@intel.com>
---
 drivers/gpu/drm/omapdrm/dss/dsi.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dsi.c b/drivers/gpu/drm/omapdrm/dss/dsi.c
index a6845856cbce..4c1084eb0175 100644
--- a/drivers/gpu/drm/omapdrm/dss/dsi.c
+++ b/drivers/gpu/drm/omapdrm/dss/dsi.c
@@ -1039,22 +1039,26 @@ static int dsi_dump_dsi_irqs(struct seq_file *s, void *p)
 {
 	struct dsi_data *dsi = s->private;
 	unsigned long flags;
-	struct dsi_irq_stats stats;
+	struct dsi_irq_stats *stats;
+
+	stats = kmalloc(sizeof(*stats), GFP_KERNEL);
+	if (!stats)
+		return -ENOMEM;
 
 	spin_lock_irqsave(&dsi->irq_stats_lock, flags);
 
-	stats = dsi->irq_stats;
+	*stats = dsi->irq_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);
@@ -1078,10 +1082,10 @@ static int dsi_dump_dsi_irqs(struct seq_file *s, void *p)
 
 #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);
@@ -1097,7 +1101,7 @@ static int dsi_dump_dsi_irqs(struct seq_file *s, void *p)
 
 #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);
@@ -1122,6 +1126,8 @@ static int dsi_dump_dsi_irqs(struct seq_file *s, void *p)
 	PIS(ULPSACTIVENOT_ALL1);
 #undef PIS
 
+	kfree(stats);
+
 	return 0;
 }
 #endif
-- 
2.34.1


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

* [PATCH 2/2] drm/omap: Fix kernel docs
  2022-09-16  8:22 [PATCH 1/2] drm/omap: dsi: Fix excessive stack usage Tomi Valkeinen
@ 2022-09-16  8:22 ` Tomi Valkeinen
  2022-12-16 18:16   ` Laurent Pinchart
  2022-09-16  8:23 ` [PATCH 1/2] drm/omap: dsi: Fix excessive stack usage Arnd Bergmann
  1 sibling, 1 reply; 4+ messages in thread
From: Tomi Valkeinen @ 2022-09-16  8:22 UTC (permalink / raw)
  To: dri-devel, linux-kernel, linux-omap
  Cc: Arnd Bergmann, Linus Walleij, Tomi Valkeinen

Fix doc related warnings seen with W=1: the function names have changed
but the docs have not been changed accordingly.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 drivers/gpu/drm/omapdrm/omap_gem.c | 2 +-
 drivers/gpu/drm/omapdrm/omap_irq.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c
index cf571796fd26..d6b4934fa0fd 100644
--- a/drivers/gpu/drm/omapdrm/omap_gem.c
+++ b/drivers/gpu/drm/omapdrm/omap_gem.c
@@ -605,7 +605,7 @@ int omap_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
 }
 
 /**
- * omap_gem_dumb_map	-	buffer mapping for dumb interface
+ * omap_gem_dumb_map_offset - create an offset for a dumb buffer
  * @file: our drm client file
  * @dev: drm device
  * @handle: GEM handle to the object (from dumb_create)
diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c b/drivers/gpu/drm/omapdrm/omap_irq.c
index 4aca14dab927..a6f0bbc879d2 100644
--- a/drivers/gpu/drm/omapdrm/omap_irq.c
+++ b/drivers/gpu/drm/omapdrm/omap_irq.c
@@ -99,7 +99,7 @@ int omap_irq_enable_framedone(struct drm_crtc *crtc, bool enable)
 }
 
 /**
- * enable_vblank - enable vblank interrupt events
+ * omap_irq_enable_vblank - enable vblank interrupt events
  * @crtc: DRM CRTC
  *
  * Enable vblank interrupts for @crtc.  If the device doesn't have
@@ -129,7 +129,7 @@ int omap_irq_enable_vblank(struct drm_crtc *crtc)
 }
 
 /**
- * disable_vblank - disable vblank interrupt events
+ * omap_irq_disable_vblank - disable vblank interrupt events
  * @crtc: DRM CRTC
  *
  * Disable vblank interrupts for @crtc.  If the device doesn't have
-- 
2.34.1


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

* Re: [PATCH 1/2] drm/omap: dsi: Fix excessive stack usage
  2022-09-16  8:22 [PATCH 1/2] drm/omap: dsi: Fix excessive stack usage Tomi Valkeinen
  2022-09-16  8:22 ` [PATCH 2/2] drm/omap: Fix kernel docs Tomi Valkeinen
@ 2022-09-16  8:23 ` Arnd Bergmann
  1 sibling, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2022-09-16  8:23 UTC (permalink / raw)
  To: Tomi Valkeinen, dri-devel, linux-kernel, Linux-OMAP
  Cc: Linus Walleij, kernel test robot

On Fri, Sep 16, 2022, at 10:22 AM, Tomi Valkeinen wrote:
> dsi_dump_dsi_irqs(), a function used for debugfs prints, has a large
> struct in its frame, which can result in:
>
> drivers/gpu/drm/omapdrm/dss/dsi.c:1126:1: warning: the frame size of 
> 1060 bytes is larger than 1024 bytes [-Wframe-larger-than=]
>
> As the performance of the function is of no concern, let's allocate the
> struct with kmalloc instead.
>
> Compile-tested only.
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
> Reported-by: kernel test robot <lkp@intel.com>

Looks good to me,

Reviewed-by: Arnd Bergmann <arnd@arndb.de>

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

* Re: [PATCH 2/2] drm/omap: Fix kernel docs
  2022-09-16  8:22 ` [PATCH 2/2] drm/omap: Fix kernel docs Tomi Valkeinen
@ 2022-12-16 18:16   ` Laurent Pinchart
  0 siblings, 0 replies; 4+ messages in thread
From: Laurent Pinchart @ 2022-12-16 18:16 UTC (permalink / raw)
  To: Tomi Valkeinen; +Cc: dri-devel, linux-kernel, linux-omap, Arnd Bergmann

Hi Tomi,

Thank you for the patch.

On Fri, Sep 16, 2022 at 11:22:06AM +0300, Tomi Valkeinen wrote:
> Fix doc related warnings seen with W=1: the function names have changed
> but the docs have not been changed accordingly.
> 
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  drivers/gpu/drm/omapdrm/omap_gem.c | 2 +-
>  drivers/gpu/drm/omapdrm/omap_irq.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c
> index cf571796fd26..d6b4934fa0fd 100644
> --- a/drivers/gpu/drm/omapdrm/omap_gem.c
> +++ b/drivers/gpu/drm/omapdrm/omap_gem.c
> @@ -605,7 +605,7 @@ int omap_gem_dumb_create(struct drm_file *file, struct drm_device *dev,
>  }
>  
>  /**
> - * omap_gem_dumb_map	-	buffer mapping for dumb interface
> + * omap_gem_dumb_map_offset - create an offset for a dumb buffer
>   * @file: our drm client file
>   * @dev: drm device
>   * @handle: GEM handle to the object (from dumb_create)
> diff --git a/drivers/gpu/drm/omapdrm/omap_irq.c b/drivers/gpu/drm/omapdrm/omap_irq.c
> index 4aca14dab927..a6f0bbc879d2 100644
> --- a/drivers/gpu/drm/omapdrm/omap_irq.c
> +++ b/drivers/gpu/drm/omapdrm/omap_irq.c
> @@ -99,7 +99,7 @@ int omap_irq_enable_framedone(struct drm_crtc *crtc, bool enable)
>  }
>  
>  /**
> - * enable_vblank - enable vblank interrupt events
> + * omap_irq_enable_vblank - enable vblank interrupt events
>   * @crtc: DRM CRTC
>   *
>   * Enable vblank interrupts for @crtc.  If the device doesn't have
> @@ -129,7 +129,7 @@ int omap_irq_enable_vblank(struct drm_crtc *crtc)
>  }
>  
>  /**
> - * disable_vblank - disable vblank interrupt events
> + * omap_irq_disable_vblank - disable vblank interrupt events
>   * @crtc: DRM CRTC
>   *
>   * Disable vblank interrupts for @crtc.  If the device doesn't have

-- 
Regards,

Laurent Pinchart

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

end of thread, other threads:[~2022-12-16 18:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-16  8:22 [PATCH 1/2] drm/omap: dsi: Fix excessive stack usage Tomi Valkeinen
2022-09-16  8:22 ` [PATCH 2/2] drm/omap: Fix kernel docs Tomi Valkeinen
2022-12-16 18:16   ` Laurent Pinchart
2022-09-16  8:23 ` [PATCH 1/2] drm/omap: dsi: Fix excessive stack usage Arnd Bergmann

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®