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 19D38A034C for ; Tue, 20 Dec 2022 16:02:21 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 150AE40395; Tue, 20 Dec 2022 16:02:21 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 2BA4F40143 for ; Tue, 20 Dec 2022 16:02:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671548539; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=q0+HVbbr0WXcCP/k268pFcLfvejP9DM5atMC2eYljCk=; b=WYUrihyZkTS2pAF5I39Dtl7sLHiooHTD39qqZS8cYCPve/bMQT7cRHEKA1gmKDoJ6ld7aD TLcOODXe40bNrEycOGilv3oi3WY0Pdvv6Eb7aSu1m4jBMynPPpEp/RXTqbYj9vpc4Txgn6 nwyREb9SQLrjNrlf5u153dqKww+BjMI= Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-70-apUs7LMQOyqmfO4F4CQ1YQ-1; Tue, 20 Dec 2022 10:02:18 -0500 X-MC-Unique: apUs7LMQOyqmfO4F4CQ1YQ-1 Received: by mail-pj1-f72.google.com with SMTP id pa16-20020a17090b265000b0020a71040b4cso5325085pjb.6 for ; Tue, 20 Dec 2022 07:02:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=q0+HVbbr0WXcCP/k268pFcLfvejP9DM5atMC2eYljCk=; b=Jh/vtiUC1XeBx55xdxDqDs52HtWcY4DkcixDnQLDSvE+79JGaGbnu8Yt5WgmGomYfn 00DI+p6084iPlINEyhAFDgs9G1On5vxSpurOMZ8FlDA/q/3+mPkaMccvKmEvgFNnQK5X LYiNGUpOn+NF6juqlCbBq3hyZf/2QCAlgSomHxLByUMx9Bk682/1Ff70Ibs6eqmblifc 4qlkwcRiJR98IXzxjIqedcSP5SHXDDqc/QSzNp80IWqzcKAwKT0UGOXrao9Wzbo0fAdO 5EcV0VGYHQvh80sd0UZjZHwMZ4GZPRb7Mmn7MbFf+Qj4jXUKgPu/387ggAiWjt10NLPH 5Rzg== X-Gm-Message-State: AFqh2kqgw2w4VxzNvEIJI77s6bv3o+DF7kjKxpxNY2lRVrkLQmRJbdpx uuMvNeeYJYMINmX7le0fd9R0GBHlQpyZy7u6Rqno0VGl+YaaaE7ALvXfAJEeBOZJKbTu+MySXnN ZD8OsNYxAV/1Dv2Jwaw6bhoA= X-Received: by 2002:a63:4f48:0:b0:484:83e4:4ca1 with SMTP id p8-20020a634f48000000b0048483e44ca1mr672109pgl.178.1671548536951; Tue, 20 Dec 2022 07:02:16 -0800 (PST) X-Google-Smtp-Source: AMrXdXuae89XpQXKKLLO/Ifb3CX2N2RkD3U44bWRHyF5KHiDGkFp/g0anOYEtg4SW42kJNF6/v5bnvaogpkymYDIHA4= X-Received: by 2002:a63:4f48:0:b0:484:83e4:4ca1 with SMTP id p8-20020a634f48000000b0048483e44ca1mr672102pgl.178.1671548536630; Tue, 20 Dec 2022 07:02:16 -0800 (PST) MIME-Version: 1.0 References: <20221219232332.190466-1-mkp@redhat.com> In-Reply-To: <20221219232332.190466-1-mkp@redhat.com> From: David Marchand Date: Tue, 20 Dec 2022 16:02:05 +0100 Message-ID: Subject: Re: [PATCH] net/iavf: add lock for vf commands To: Mike Pattrick Cc: dev@dpdk.org, yidingx.zhou@intel.com, ktraynor@redhat.com, stable@dpdk.org, Qi Zhang , Ferruh Yigit , Thomas Monjalon X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hello Mike, On Tue, Dec 20, 2022 at 12:24 AM Mike Pattrick wrote: > > iavf admin queue commands aren't thread-safe. Bugs surrounding this > issue can manifest in a variety of ways but frequently pend_cmd is > over written. Simultaneously executing commands can result in a > misconfigured device or DPDK sleeping in a thread for 2 second. > > Despite this limitation, vf commands may be executed from both > iavf_dev_alarm_handler() in a control thread and the applications main > thread. This is trivial to simulate in the testpmd application by > creating a bond of vf's in active backup mode, and then turning the > bond off and then on again repeatedly. > > Previously [1] was proposed as a potential solution, but this commit > has been reverted. I propose adding locks until a more complete > solution is available. - Hum, this commit is still in the main branch, and I did reproduce the issue with a E810 nic. [1] is not enough for the race on pend_cmd (probably some alarm is still racing with the control thread). So I think a fix is needed regardless of [1] fate. - Your patch does make the race disappear, but then, about using a lock on pend_cmd, I wonder what the point to set it atomically is. - The same issue probably affects the recently copy/pasted^Wintroduced driver idpf. > > [1] commit cb5c1b91f76f ("net/iavf: add thread for event callbacks") > > Fixes: 48de41ca11f0 ("net/avf: enable link status update") > Fixes: 84108425054a ("net/iavf: support asynchronous virtual channel message") > Cc: stable@dpdk.org > > Signed-off-by: Mike Pattrick > --- [snip] Doing a git grep -nC 1 iavf_execute_vf_cmd, I see some unprotected calls. This is probably a rebase issue if you tested on 21.11. -- David Marchand