From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: Re: [PATCH net] r8169: fix NAPI handling under high load Date: Tue, 16 Oct 2018 17:19:31 -0700 Message-ID: References: <8f84fe39-3d8d-396d-3b97-027e0a83f8cb@gmail.com> <20181016151708.3fff9bd9@xeon-e3> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: David Miller , Realtek linux nic maintainers , "netdev@vger.kernel.org" To: Stephen Hemminger , Heiner Kallweit Return-path: Received: from mail-pl1-f196.google.com ([209.85.214.196]:40881 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727171AbeJQIMb (ORCPT ); Wed, 17 Oct 2018 04:12:31 -0400 Received: by mail-pl1-f196.google.com with SMTP id 1-v6so11778282plv.7 for ; Tue, 16 Oct 2018 17:19:33 -0700 (PDT) In-Reply-To: <20181016151708.3fff9bd9@xeon-e3> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 10/16/2018 03:17 PM, Stephen Hemminger wrote: > On Tue, 16 Oct 2018 22:37:31 +0200 > Heiner Kallweit wrote: > >> rtl_rx() and rtl_tx() are called only if the respective bits are set >> in the interrupt status register. Under high load NAPI may not be >> able to process all data (work_done == budget) and it will schedule >> subsequent calls to the poll callback. >> rtl_ack_events() however resets the bits in the interrupt status >> register, therefore subsequent calls to rtl8169_poll() won't call >> rtl_rx() and rtl_tx() - chip interrupts are still disabled. >> >> Fix this by calling rtl_rx() and rtl_tx() independent of the bits >> set in the interrupt status register. Both functions will detect >> if there's nothing to do for them. >> >> This issue has been there more or less forever (at least it exists in >> 3.16 already), so I can't provide a "Fixes" tag. >> >> Signed-off-by: Heiner Kallweit > > Another issue is this: > > if (work_done < budget) { > napi_complete_done(napi, work_done); > > rtl_irq_enable(tp, enable_mask); > mmiowb(); > } > > return work_done; > } > > > The code needs to check return value of napi_complete_done. > > if (work_done < budget && > napi_complete_done(napi, work_done) { > rtl_irq_enable(tp, enable_mask); > mmiowb(); > } > > return work_done; > } > > Try that, it might fix the problem and your logic would > be unnecessary > Well, I do not believe this is related. Testing napi_complete_done() is not mandatory, it is only an optimization [1] and only for busy polling users. In short, by default, this should not matter, since busy-polling is not enabled by default. [1] busy polling users are spinning anyway, so it is not even clear if this is really an optimization, unless maybe the cost of irq enabling is really really high...