Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1715590ybx; Thu, 7 Nov 2019 16:13:45 -0800 (PST) X-Google-Smtp-Source: APXvYqy/QI0aj9RIZGopKlmclOYang0pk5Taoz+lWAxeZEoEVOvYaYsEMrV+VsoSteOV1SMcOown X-Received: by 2002:a17:906:73d4:: with SMTP id n20mr6000575ejl.45.1573172025103; Thu, 07 Nov 2019 16:13:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573172025; cv=none; d=google.com; s=arc-20160816; b=gS9HxwelKxp0jczqAFbV5Heb96vcy2+Odw8I64k4xhj0Y85m4dyKxS4Y75hK2ENDlW ehqzgmayNQvth27KxPB95Fyh6TTHgPLMcItCGsMFVsE8VF6YKOvR5sjsep+f2taiClsI cEVtELu31moa4RwqFlOpmkFKBsDtML2P2WAbLlLV0fAsPQZDbO0yKvT8MQLu7xV5n1SS ciAmO+kQso3D0uvpoqK34BtuiOyXIX06Pq9bp9a3YfeoZwbe6nxPWm8zsznkhfq91Xnv mRzc42POEXOix8NFzKTT0iEJZGBt6malgLrTttuAaKN8My37HAagiQD532CBeMjf/MJf kRTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=DuIKMBjZiHJ4AHYjIkdQlwGe3T84gmnUx/T3s8zt6YQ=; b=ut0TEHqKD87A5gGZGdJYHWElvGsetk2LOpGK9kpmXTSS1/cbHRxlM5pKNJcVQ2SyRh A6P6Ptld5ShBLYAdAcbLv73zfQl5w29l6M9tObvIAKhWcszQquI2gPcBPph2ydRuMj0W eFQ1/WyNxNYt7Q9NvbdstIorvUVXWwjOz8fNATiiDvIErYWl/zi5ZThzXzkixdR5ShLZ QDnRh4lmqYS6R8g/iPFCWgocHIQ4nDDC7cITMry4DLEqq6uQlkmMZMBIFuZ0ydkn0PC2 FeaqA6Gpl7WJ/YQpQ+UonNIqYF6mT43GJ1uTD4IfFC03oPYjBAG0hOeEsosNcxoHLKc0 hjsA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q17si2624862ejm.165.2019.11.07.16.13.20; Thu, 07 Nov 2019 16:13:45 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727366AbfKHAMu (ORCPT + 99 others); Thu, 7 Nov 2019 19:12:50 -0500 Received: from shards.monkeyblade.net ([23.128.96.9]:50494 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725906AbfKHAMu (ORCPT ); Thu, 7 Nov 2019 19:12:50 -0500 Received: from localhost (unknown [IPv6:2601:601:9f00:1e2::d71]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id BA39015385162; Thu, 7 Nov 2019 16:12:49 -0800 (PST) Date: Thu, 07 Nov 2019 16:12:49 -0800 (PST) Message-Id: <20191107.161249.384380300231076347.davem@davemloft.net> To: salil.mehta@huawei.com Cc: maz@kernel.org, edumazet@google.com, yisen.zhuang@huawei.com, lipeng321@huawei.com, mehta.salil@opnsrc.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linuxarm@huawei.com Subject: Re: [PATCH V2 net] net: hns: Fix the stray netpoll locks causing deadlock in NAPI path From: David Miller In-Reply-To: <20191107170953.7672-1-salil.mehta@huawei.com> References: <20191107170953.7672-1-salil.mehta@huawei.com> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Thu, 07 Nov 2019 16:12:50 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Salil Mehta Date: Thu, 7 Nov 2019 17:09:53 +0000 > This patch fixes the problem of the spin locks, originally > meant for the netpoll path of hns driver, causing deadlock in > the normal NAPI poll path. The issue happened due to the presence > of the stray leftover spin lock code related to the netpoll, > whose support was earlier removed from the HNS[1], got activated > due to enabling of NET_POLL_CONTROLLER switch. > > Earlier background: > The netpoll handling code originally had this bug(as identified > by Marc Zyngier[2]) of wrong spin lock API being used which did > not disable the interrupts and hence could cause locking issues. > i.e. if the lock were first acquired in context to thread like > 'ip' util and this lock if ever got later acquired again in > context to the interrupt context like TX/RX (Interrupts could > always pre-empt the lock holding task and acquire the lock again) > and hence could cause deadlock. > > Proposed Solution: > 1. If the netpoll was enabled in the HNS driver, which is not > right now, we could have simply used spin_[un]lock_irqsave() > 2. But as netpoll is disabled, therefore, it is best to get rid > of the existing locks and stray code for now. This should > solve the problem reported by Marc. > > [1] https://git.kernel.org/torvalds/c/4bd2c03be7 > [2] https://patchwork.ozlabs.org/patch/1189139/ > > Fixes: 4bd2c03be707 ("net: hns: remove ndo_poll_controller") > Reported-by: Marc Zyngier > Acked-by: Marc Zyngier > Tested-by: Marc Zyngier > Signed-off-by: Salil Mehta Applied and queued up for -stable, thanks.