lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <m3wml9mra2.fsf@gmail.com>
Date: Thu, 25 Jul 2024 16:21:09 +0100
From: Rui Miguel Silva <rmfrfs@...il.com>
To: Matthias Fend <matthias.fend@...end.at>, Laurent Pinchart
 <laurent.pinchart@...asonboard.com>, Martin Kepplinger
 <martink@...teo.de>, Purism Kernel Team <kernel@...i.sm>, Mauro Carvalho
 Chehab <mchehab@...nel.org>, Shawn Guo <shawnguo@...nel.org>, Sascha Hauer
 <s.hauer@...gutronix.de>, Pengutronix Kernel Team <kernel@...gutronix.de>,
 Fabio Estevam <festevam@...il.com>
Cc: linux-media@...r.kernel.org, imx@...ts.linux.dev,
 linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] media: imx-mipi-csis: avoid logging while holding spinlock

Hey Matthias,
Many thanks for the patch.

Matthias Fend <matthias.fend@...end.at> writes:

> Refactor mipi_csis_log_counters() to prevent calling dev_info() while
> IRQs are disabled. This reduces crucial IRQs off time to a bare minimum.
>
> Signed-off-by: Matthias Fend <matthias.fend@...end.at>

LGTM

Reviewed-by: Rui Miguel Silva <rmfrfs@...il.com>

Cheers,
   Rui


> ---
>  drivers/media/platform/nxp/imx-mipi-csis.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/media/platform/nxp/imx-mipi-csis.c b/drivers/media/platform/nxp/imx-mipi-csis.c
> index f49b06978f14..0c34d316ed29 100644
> --- a/drivers/media/platform/nxp/imx-mipi-csis.c
> +++ b/drivers/media/platform/nxp/imx-mipi-csis.c
> @@ -857,18 +857,21 @@ static void mipi_csis_log_counters(struct mipi_csis_device *csis, bool non_error
>  {
>  	unsigned int num_events = non_errors ? MIPI_CSIS_NUM_EVENTS
>  				: MIPI_CSIS_NUM_EVENTS - 8;
> +	unsigned int counters[MIPI_CSIS_NUM_EVENTS];
>  	unsigned long flags;
>  	unsigned int i;
>  
>  	spin_lock_irqsave(&csis->slock, flags);
> +	for (i = 0; i < num_events; ++i)
> +		counters[i] =  csis->events[i].counter;
> +	spin_unlock_irqrestore(&csis->slock, flags);
>  
>  	for (i = 0; i < num_events; ++i) {
> -		if (csis->events[i].counter > 0 || csis->debug.enable)
> +		if (counters[i] > 0 || csis->debug.enable)
>  			dev_info(csis->dev, "%s events: %d\n",
>  				 csis->events[i].name,
> -				 csis->events[i].counter);
> +				 counters[i]);
>  	}
> -	spin_unlock_irqrestore(&csis->slock, flags);
>  }
>  
>  static int mipi_csis_dump_regs(struct mipi_csis_device *csis)
> -- 
> 2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ