Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932647AbdC3JQv (ORCPT ); Thu, 30 Mar 2017 05:16:51 -0400 Received: from us01smtprelay-2.synopsys.com ([198.182.60.111]:52879 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932189AbdC3JQs (ORCPT ); Thu, 30 Mar 2017 05:16:48 -0400 From: Vlad Zakharov To: "edumazet@google.com" CC: "netdev@vger.kernel.org" , "eladkan@mellanox.com" , "davem@davemloft.net" , "noamca@mellanox.com" , "Vladislav.Zakharov@synopsys.com" , "linux-snps-arc@lists.infradead.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] ezchip: nps_enet: check if napi has been completed Thread-Topic: [PATCH] ezchip: nps_enet: check if napi has been completed Thread-Index: AQHSqHko+VaVU0bBv0K2ztX8s1Fz6aGsNNQAgAADMgCAAMIygA== Date: Thu, 30 Mar 2017 09:16:44 +0000 Message-ID: <1490865403.32756.21.camel@synopsys.com> References: <1490784106-14489-1-git-send-email-vzakhar@synopsys.com> <20170329.143014.2001816338079751776.davem@davemloft.net> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.121.8.100] Content-Type: text/plain; charset="utf-8" Content-ID: <1858E27A4351E340B253FD2659B35D65@internal.synopsys.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id v2U9HDSB009569 Content-Length: 1607 Lines: 36 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 wrote: > Signed-off-by: Vlad Zakharov > > > > > > 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