From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jamal Hadi Salim Subject: Re: [PATCH net-next] net: sched: act_ife: disable bh when taking ife_mod_lock Date: Mon, 13 Aug 2018 13:23:37 -0400 Message-ID: <2d95cda0-22e2-0f4f-3dc3-e7a1df4b68ee@mojatatu.com> References: <1534180811-10416-1-git-send-email-vladbu@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Cc: davem@davemloft.net, xiyou.wangcong@gmail.com, jiri@resnulli.us To: Vlad Buslov , netdev@vger.kernel.org Return-path: Received: from mail-it0-f67.google.com ([209.85.214.67]:39234 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730137AbeHMUGr (ORCPT ); Mon, 13 Aug 2018 16:06:47 -0400 Received: by mail-it0-f67.google.com with SMTP id g141-v6so15218352ita.4 for ; Mon, 13 Aug 2018 10:23:39 -0700 (PDT) In-Reply-To: <1534180811-10416-1-git-send-email-vladbu@mellanox.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 2018-08-13 1:20 p.m., Vlad Buslov wrote: > Lockdep reports deadlock for following locking scenario in ife action: > > Task one: > 1) Executes ife action update. > 2) Takes tcfa_lock. > 3) Waits on ife_mod_lock which is already taken by task two. > > Task two: > > 1) Executes any path that obtains ife_mod_lock without disabling bh (any > path that takes ife_mod_lock while holding tcfa_lock has bh disabled) like > loading a meta module, or creating new action. > 2) Takes ife_mod_lock. > 3) Task is preempted by rate estimator timer. > 4) Timer callback waits on tcfa_lock which is taken by task one. > > In described case tasks deadlock because they take same two locks in > different order. To prevent potential deadlock reported by lockdep, always > disable bh when obtaining ife_mod_lock. > Looks like your recent changes on net-next exposed this. Acked-by: Jamal Hadi Salim cheers, jamal