From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jose Abreu Subject: stmmac: Race in coalesce timer and NAPI Date: Fri, 21 Sep 2018 10:19:45 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: "netdev@vger.kernel.org" , Joao Pinto Return-path: Received: from us01smtprelay-2.synopsys.com ([198.182.47.9]:53442 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725898AbeIUPHs (ORCPT ); Fri, 21 Sep 2018 11:07:48 -0400 Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id 3287424E1EDD for ; Fri, 21 Sep 2018 02:19:51 -0700 (PDT) Received: from US01WEHTC3.internal.synopsys.com (us01wehtc3.internal.synopsys.com [10.15.84.232]) by mailhost.synopsys.com (Postfix) with ESMTP id 254455D2A for ; Fri, 21 Sep 2018 02:19:51 -0700 (PDT) Sender: netdev-owner@vger.kernel.org List-ID: Hello, I'm getting a race in stmmac coalesce timer and the napi_schedule() interrupt and I'm asking for advice. Currently, we are scheduling NAPI in coalesce timer but this leads to stmmac_tx_clean() deadlock because this function tries to acquire queue lock. I find that this is not expected because only one instance of NAPI should run at same time so I was wondering if it is possible that xmit() callback is causing the deadlock ? BTW, this is solved by: - Directly call stmmac_tx_clean() in timer function AND - Use netif_tx_trylock() in stmmac_tx_clean(). Then, if queue is already locked we re-arm coalesce timer or reschedule NAPI. This is easily reproducible in an ARM board with 8 core running at 100MHz each. Thanks and Best Regards, Jose Miguel Abreu