diff mbox series

net: macb: can macb use __napi_schedule_irqoff() instead of __napi_schedule()

Message ID CAD56B7fYivPF33BhXWDPskYqNE5jRxd-sA=6+ushNXhyiCrwiQ@mail.gmail.com (mailing list archive)
State New, archived
Headers show
Series net: macb: can macb use __napi_schedule_irqoff() instead of __napi_schedule() | expand

Commit Message

Paul Thomas Jan. 11, 2021, 7:45 p.m. UTC
Hello, recently I was doing a lot of tracing/profiling to understand
an issue we were having. Anyway, during this I ran across
__napi_schedule_irqoff() where the comment in dev.c says "Variant of
__napi_schedule() assuming hard irqs are masked".

It looks like the queue_writel(queue, IDR, bp->rx_intr_mask); call
just before the __napi_schedule() call in macb_main.c is doing this
hard irq masking? So could it change to be like this?

-Paul

Comments

Heiner Kallweit Jan. 11, 2021, 9:35 p.m. UTC | #1
On 11.01.2021 20:45, Paul Thomas wrote:
> Hello, recently I was doing a lot of tracing/profiling to understand
> an issue we were having. Anyway, during this I ran across
> __napi_schedule_irqoff() where the comment in dev.c says "Variant of
> __napi_schedule() assuming hard irqs are masked".
> 
> It looks like the queue_writel(queue, IDR, bp->rx_intr_mask); call
> just before the __napi_schedule() call in macb_main.c is doing this
> hard irq masking? So could it change to be like this?
> 
It's unsafe under forced irq threading. There has been a number of
discussions about this topic in the past.

> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -1616,7 +1623,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
> 
>                         if (napi_schedule_prep(&queue->napi)) {
>                                 netdev_vdbg(bp->dev, "scheduling RX softirq\n");
> -                               __napi_schedule(&queue->napi);
> +                               __napi_schedule_irqoff(&queue->napi);
>                         }
>                 }
> 
> -Paul
>
Paul Thomas Jan. 11, 2021, 10:09 p.m. UTC | #2
On Mon, Jan 11, 2021 at 4:35 PM Heiner Kallweit <hkallweit1@gmail.com> wrote:
>
> On 11.01.2021 20:45, Paul Thomas wrote:
> > Hello, recently I was doing a lot of tracing/profiling to understand
> > an issue we were having. Anyway, during this I ran across
> > __napi_schedule_irqoff() where the comment in dev.c says "Variant of
> > __napi_schedule() assuming hard irqs are masked".
> >
> > It looks like the queue_writel(queue, IDR, bp->rx_intr_mask); call
> > just before the __napi_schedule() call in macb_main.c is doing this
> > hard irq masking? So could it change to be like this?
> >
> It's unsafe under forced irq threading. There has been a number of
> discussions about this topic in the past.
OK thanks, and our use case is forced irq threading under PREEMPT_RT

-Paul

> > --- a/drivers/net/ethernet/cadence/macb_main.c
> > +++ b/drivers/net/ethernet/cadence/macb_main.c
> > @@ -1616,7 +1623,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
> >
> >                         if (napi_schedule_prep(&queue->napi)) {
> >                                 netdev_vdbg(bp->dev, "scheduling RX softirq\n");
> > -                               __napi_schedule(&queue->napi);
> > +                               __napi_schedule_irqoff(&queue->napi);
> >                         }
> >                 }
> >
> > -Paul
> >
>
diff mbox series

Patch

--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -1616,7 +1623,7 @@  static irqreturn_t macb_interrupt(int irq, void *dev_id)

                        if (napi_schedule_prep(&queue->napi)) {
                                netdev_vdbg(bp->dev, "scheduling RX softirq\n");
-                               __napi_schedule(&queue->napi);
+                               __napi_schedule_irqoff(&queue->napi);
                        }
                }