[v2,08/11] gpiolib: emit a debug message when adding events to a full kfifo
diff mbox series

Message ID 20191204155912.17590-9-brgl@bgdev.pl
State New
Headers show
Series
  • gpiolib: add an ioctl() for monitoring line status changes
Related show

Commit Message

Bartosz Golaszewski Dec. 4, 2019, 3:59 p.m. UTC
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Currently if the line-event kfifo is full, we just silently drop any new
events. Add a ratelimited debug message so that we at least have some
trace in the kernel log of event overflow.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/gpio/gpiolib.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Andy Shevchenko Dec. 4, 2019, 10:28 p.m. UTC | #1
On Wed, Dec 4, 2019 at 6:04 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>
> Currently if the line-event kfifo is full, we just silently drop any new
> events. Add a ratelimited debug message so that we at least have some
> trace in the kernel log of event overflow.
>

Hmm... I don't like prints in IRQ context (even threaded).
Can we rather switch to trace points at some point?

> @@ -975,6 +975,9 @@ static irqreturn_t lineevent_irq_thread(int irq, void *p)
>         ret = kfifo_in_spinlocked(&le->events, &ge, 1, &le->wait.lock);
>         if (ret)
>                 wake_up_poll(&le->wait, EPOLLIN);
> +       else
> +               pr_debug_ratelimited(
> +                       "%s: event FIFO is full - event dropped\n", __func__);
>
>         return IRQ_HANDLED;
Bartosz Golaszewski Dec. 19, 2019, 4:22 p.m. UTC | #2
śr., 4 gru 2019 o 23:28 Andy Shevchenko <andy.shevchenko@gmail.com> napisał(a):
>
> On Wed, Dec 4, 2019 at 6:04 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> >
> > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> >
> > Currently if the line-event kfifo is full, we just silently drop any new
> > events. Add a ratelimited debug message so that we at least have some
> > trace in the kernel log of event overflow.
> >
>
> Hmm... I don't like prints in IRQ context (even threaded).
> Can we rather switch to trace points at some point?
>

This is something that will be very rare and unlikely - I don't see
how trace points will help here with all the boiler-plate.

Bart

Patch
diff mbox series

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 43f90eca6d45..c89d297da270 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -975,6 +975,9 @@  static irqreturn_t lineevent_irq_thread(int irq, void *p)
 	ret = kfifo_in_spinlocked(&le->events, &ge, 1, &le->wait.lock);
 	if (ret)
 		wake_up_poll(&le->wait, EPOLLIN);
+	else
+		pr_debug_ratelimited(
+			"%s: event FIFO is full - event dropped\n", __func__);
 
 	return IRQ_HANDLED;
 }