From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7126EA0C46; Tue, 28 Sep 2021 10:11:56 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0478540E3C; Tue, 28 Sep 2021 10:11:56 +0200 (CEST) Received: from inbox.dpdk.org (inbox.dpdk.org [95.142.172.178]) by mails.dpdk.org (Postfix) with ESMTP id C499140DF6 for ; Tue, 28 Sep 2021 10:11:54 +0200 (CEST) Received: by inbox.dpdk.org (Postfix, from userid 33) id 87913A0C4C; Tue, 28 Sep 2021 10:11:54 +0200 (CEST) From: bugzilla@dpdk.org To: dev@dpdk.org Date: Tue, 28 Sep 2021 08:11:53 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: DPDK X-Bugzilla-Component: ethdev X-Bugzilla-Version: 21.08 X-Bugzilla-Keywords: X-Bugzilla-Severity: critical X-Bugzilla-Who: sahithi.singam@oracle.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: Normal X-Bugzilla-Assigned-To: dev@dpdk.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://bugs.dpdk.org/ Auto-Submitted: auto-generated X-Auto-Response-Suppress: All MIME-Version: 1.0 Subject: [dpdk-dev] [Bug 816] KNI deadlocks while processing mac address set request with linux kernel version >= v5.12 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" https://bugs.dpdk.org/show_bug.cgi?id=3D816 Bug ID: 816 Summary: KNI deadlocks while processing mac address set request with linux kernel version >=3D v5.12 Product: DPDK Version: 21.08 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: critical Priority: Normal Component: ethdev Assignee: dev@dpdk.org Reporter: sahithi.singam@oracle.com Target Milestone: --- Starting from linux kernel version 5.12, a new global semaphore(dev_addr_se= m) was introduced in dev_set_mac_address_user() function that should be acquir= ed and released along with rtnl_lock when a mac address set request was receiv= ed from userspace.=20 This introduced following locking sequence in linux kernel ,=20 1. As part of dev_ioctl(), take rtnl_lock first 2. Then call down_write(&dev_addr_sem) in dev_set_mac_address_user() 3. Finally call kni_net_set_mac which calls kni_net_process_request. 4. In kni_net_process_request we will release only rtnl_lock but not dev_addr_sem before we enqueue the request to req_q(i.e to userspace dpdk process) 5. After receiving a response or timeout , we will again try to hold rtnl_l= ock=20 Above sequence in KNI is resulting in deadlock as we are just releasing rtnl_lock without releasing semaphore while some other device could be wait= ing for dev_addr_sem while holding rtnl_lock.=20 For example, if user issues two mac address set requests immediately on two= kni interfaces intf1, intf2. Then 1.intf1 takes rtnl_lock 2.intf1 takes dev_addr_sem 3.intf2 waits for rtnl_lock 4.intf1 in KNI , releases rtnl_lock 5.intf2 takes rtnl_lock and waits for dev_addr_sem held by intf1 6.intf1 at the end of kni request handling code, will try to lock rtnl_lo= ck held by intf2. But intf2 will not release rtnl_lock as it was waiting for dev_addr_sem held by intf1. So at the end, intf1 will be holding dev_addr_sem and will be waiting for rtnl_lock. intf2 will be holding rtnl_lock and will be waiting for dev_addr= _sem resulting in the KERNEL deadlock. This issue started due to changes from=20 commitid:631217c761353aa5e4e548a20e570245ecbc8eda (kni: fix kernel deadlock with bifurcated device)=20 and with linux kernel version >=3D v5.12 --=20 You are receiving this mail because: You are the assignee for the bug.=