All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlad Zakharov <Vladislav.Zakharov@synopsys.com>
To: "edumazet@google.com" <edumazet@google.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"eladkan@mellanox.com" <eladkan@mellanox.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"noamca@mellanox.com" <noamca@mellanox.com>,
	"Vladislav.Zakharov@synopsys.com"
	<Vladislav.Zakharov@synopsys.com>,
	"linux-snps-arc@lists.infradead.org" 
	<linux-snps-arc@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ezchip: nps_enet: check if napi has been completed
Date: Thu, 30 Mar 2017 09:16:44 +0000	[thread overview]
Message-ID: <1490865403.32756.21.camel@synopsys.com> (raw)
In-Reply-To: <CANn89iJ1+7CrF=hJj-_pLWV+EDXxhUZGOL+3je6zjE8dJDcr=A@mail.gmail.com>

Hi Eric,

On Wed, 2017-03-29 at 14:41 -0700, Eric Dumazet wrote:
> On Wed, Mar 29, 2017 at 2:30 PM, David Miller <davem@davemloft.net> wrote:
> Signed-off-by: Vlad Zakharov <vzakhar@synopsys.com>
> > 
> > 
> > Applied.
> > 
> > Eric, if this is really required now, we have 148 broken drivers still.
> 
> Piece of cake :/
> 
> If we get more reports like that, we might implement a logic to
> prevent infinite loops.
> 
> It is not clear to me what exactly happened to this driver, since
> testing napi_complete_done() was not mandatory.

I am not sure what is happening with other drivers, but in case of ezchip nps_enet driver after the following commit:
39e6c8208d7b6fb9d2047850fb3327db567b564b

if we got into NAPI_STATE_MISSED state the following happened:
in nps_enet_poll func we were calling napi_complete_done() (which reset MISSED state but left SCHED state) and after
that without any checks were enabling interrupts.

Then we obviously were getting into nps_enet_irq_hanlder() if irq was pending (it is very possbile state). If we look
inside this function we will see that it disables interrupts only in case napi_sched_prep() returns true. In its turn
napi_sched_prep() returns true only in case it changes state from non-SCHED to SCHED. But in our case as SCHED had been
already set it set MISSED state and then returned false. So at that point we had already been trapped: after exiting irq
hanlder we were getting into nps_enet_irq_hanlder() again and again as we couldn't rescind pending irq signal and
disable corresponding irq. 

-- 
Best regards,
Vlad Zakharov <vzakhar@synopsys.com>

WARNING: multiple messages have this Message-ID (diff)
From: Vladislav.Zakharov@synopsys.com (Vlad Zakharov)
To: linux-snps-arc@lists.infradead.org
Subject: [PATCH] ezchip: nps_enet: check if napi has been completed
Date: Thu, 30 Mar 2017 09:16:44 +0000	[thread overview]
Message-ID: <1490865403.32756.21.camel@synopsys.com> (raw)
In-Reply-To: <CANn89iJ1+7CrF=hJj-_pLWV+EDXxhUZGOL+3je6zjE8dJDcr=A@mail.gmail.com>

Hi Eric,

On Wed, 2017-03-29@14:41 -0700, Eric Dumazet wrote:
> On Wed, Mar 29, 2017@2:30 PM, David Miller <davem@davemloft.net> wrote:
> Signed-off-by: Vlad Zakharov <vzakhar at synopsys.com>
> > 
> > 
> > Applied.
> > 
> > Eric, if this is really required now, we have 148 broken drivers still.
> 
> Piece of cake :/
> 
> If we get more reports like that, we might implement a logic to
> prevent infinite loops.
> 
> It is not clear to me what exactly happened to this driver, since
> testing napi_complete_done() was not mandatory.

I am not sure what is happening with other drivers, but in case of ezchip?nps_enet driver after the following commit:
39e6c8208d7b6fb9d2047850fb3327db567b564b

if we got into NAPI_STATE_MISSED state the following happened:
in nps_enet_poll func we were calling napi_complete_done() (which reset MISSED state but left SCHED state) and after
that without any checks were enabling interrupts.

Then we obviously were getting into nps_enet_irq_hanlder() if irq was pending (it is very possbile state). If we look
inside this function we will see that it disables interrupts only in case napi_sched_prep() returns true. In its turn
napi_sched_prep() returns true only in case it changes state from non-SCHED to SCHED. But in our case as SCHED had been
already set it set MISSED state and then returned false. So at that point we had already been trapped: after exiting irq
hanlder we were getting into nps_enet_irq_hanlder() again and again as we couldn't rescind pending irq signal and
disable corresponding irq.?

-- 
Best regards,
Vlad Zakharov <vzakhar at synopsys.com>

  reply	other threads:[~2017-03-30  9:16 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-29 10:41 [PATCH] ezchip: nps_enet: check if napi has been completed Vlad Zakharov
2017-03-29 10:41 ` Vlad Zakharov
2017-03-29 10:41 ` Vlad Zakharov
2017-03-29 14:52 ` Eric Dumazet
2017-03-29 14:52   ` Eric Dumazet
2017-03-29 21:30 ` David Miller
2017-03-29 21:30   ` David Miller
2017-03-29 21:30   ` David Miller
2017-03-29 21:41   ` Eric Dumazet
2017-03-29 21:41     ` Eric Dumazet
2017-03-29 21:41     ` Eric Dumazet
2017-03-30  9:16     ` Vlad Zakharov [this message]
2017-03-30  9:16       ` Vlad Zakharov
2017-03-30  9:16       ` Vlad Zakharov
2017-03-30 13:25       ` Eric Dumazet
2017-03-30 13:25         ` Eric Dumazet
2017-03-30 13:25         ` Eric Dumazet
2017-04-26 12:56   ` Vlad Zakharov
2017-04-26 12:56     ` Vlad Zakharov
2017-04-26 12:56     ` Vlad Zakharov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1490865403.32756.21.camel@synopsys.com \
    --to=vladislav.zakharov@synopsys.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=eladkan@mellanox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-snps-arc@lists.infradead.org \
    --cc=netdev@vger.kernel.org \
    --cc=noamca@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.