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 6C31FA034C; 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 3324940A7F; 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.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 361AA40395 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-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-425-qiPwAkxIMqak3-1d0vTfug-1; Tue, 20 Dec 2022 10:02:18 -0500 X-MC-Unique: qiPwAkxIMqak3-1d0vTfug-1 Received: by mail-pg1-f197.google.com with SMTP id x79-20020a633152000000b004785d1cf6bbso7282031pgx.6 for ; Tue, 20 Dec 2022 07:02:17 -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=4PSOsPs6p2Quz2lwZTESqCPD4nV20F1j5bQe9xXT/L+FysnQ0TqFEEtCmryC3UH4jA phId60RBTT4qPyxurYPfMkMb6rffie/0XKRb+EMCWF0Qh4pr0wmtJ1ffS2BgGdkXclnb iZkPZ6zzlaM/FORbTbSJ2jCRo3d6bxNBCe0qltsRp/eQHHQxdzWh9hiWVD/g7PY0JjFH YUCdYbfjAAuG8sWIMjLSzx78LnuOeroOGF/yH6Se3E4ahrEvqieTdj3FPnaYNRqm72Qr 7cyFAUu8OP+2K6mAswJFPJNe/NklDPuDBjxz4d3NoFje13C1+lJqIIRw9PTysHmYmdkd no5g== X-Gm-Message-State: AFqh2kqeC+o0VhV0KT/8wjaIxofFmsrYiO67us7XhEVccQOvkYyot9Mp DFWr0xKcwVLd5aUzGbHftxk2utEzvYsLXGB7jWTvaQyDOzmj2lcrvhjpKVTki440+jSiSHA/uIQ +HEiLa8oARhDSW39dLc8= X-Received: by 2002:a63:4f48:0:b0:484:83e4:4ca1 with SMTP id p8-20020a634f48000000b0048483e44ca1mr672105pgl.178.1671548536934; 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: 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 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