From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 2CE05A0542
	for <public@inbox.dpdk.org>; Wed, 16 Nov 2022 22:52:14 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 20364410D3;
	Wed, 16 Nov 2022 22:52:14 +0100 (CET)
Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com
 [209.85.208.173])
 by mails.dpdk.org (Postfix) with ESMTP id 9FDBA40DFB;
 Wed, 16 Nov 2022 22:52:11 +0100 (CET)
Received: by mail-lj1-f173.google.com with SMTP id a15so172923ljb.7;
 Wed, 16 Nov 2022 13:52:11 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=cc:to:subject:message-id:date:from:in-reply-to:references
 :mime-version:from:to:cc:subject:date:message-id:reply-to;
 bh=fPO0CEBHuD3/KzKGv1eDNgheueO6B/mXQiBygEMWOSk=;
 b=NHXJrjH8ncbMY0bH/JxN+3YRKpyVtTXB9U4igZiXILFYGKD2EwzDknRKkLtArekOYC
 UzHi4DJv5a6cShL/rrOKrgvGUvlZlyUkBug9gc+YmDyjrGViSL+e0+9T/tNBEz/kTiCI
 2YDIiTuNktRJjM15b27k4oicdHhCobku0eT2CleBLpvWX5W4JecHv5+dyhwXDD5h7cQY
 cD956KzNj+ojmEJPvlZNoHkQfC40MniDEJqfKHhb2it8s1DrWDQMYIRpcJ5T/isH+Y2C
 PNQ4OyfohLRTVV0EEKh/6SvFPJWPe/L0frGz9LJg2NApnkI5+FjtkpkFzWzBqA8SjU+M
 2jqA==
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=fPO0CEBHuD3/KzKGv1eDNgheueO6B/mXQiBygEMWOSk=;
 b=wiH4k02gN0cNASGnidcq09w3TrhcUX01EmymYQVvBXmiQfDFUEl7zDAbd15e8k3QZQ
 g13QQuN/IVB8clqiDdSQH6KQmk1hATLYpU/ufD9mXKc35+WmMuscGQQVavCl+iR2oVvn
 m0iGO6Kf5FEg3C93+CwGDf3crL92PqSb5hiYO818KntmDpOXIV5f9/xSdSEn3cuZZg/R
 eg6iAlvh8jADE4q3v8Xq3cANHRAY3i/CC71RXJkn7xTwD7FheG19k1J17GUQ04NXjzad
 iMNySdxOeAJftE9Ms6hIbiA0rVGSe1H157T0Gowh5b2SegcZ3H7SqBIjRXcuJ4V2I4Bz
 E2hw==
X-Gm-Message-State: ANoB5pn3c7PUdpzhJ5N+txM0UKNMx1YS5Audn0Ao5rX5sIPVMOw1osyF
 y7npIuwF4DlMlgTu0gbZe39BkzRjVeGGkwrziRI=
X-Google-Smtp-Source: AA0mqf7Xj8orf1SdQGVIlIil7qXxtBg0GmTO9UJgJg5/DboGc1jIIiSJdR/lh+zOvI6Vchak1B9jXk2+7aSnsTdG9BE=
X-Received: by 2002:a2e:b8c3:0:b0:277:2e91:e9d6 with SMTP id
 s3-20020a2eb8c3000000b002772e91e9d6mr71618ljp.372.1668635530908; Wed, 16 Nov
 2022 13:52:10 -0800 (PST)
MIME-Version: 1.0
References: <20221110163410.12734-1-lucp.at.work@gmail.com>
 <d212a2d469404e3091099e2ad901eafe@huawei.com>
In-Reply-To: <d212a2d469404e3091099e2ad901eafe@huawei.com>
From: Luc Pelletier <lucp.at.work@gmail.com>
Date: Wed, 16 Nov 2022 16:51:59 -0500
Message-ID: <CAFeRdtC_qfkfJc0DVpfZm8k-BcjTR-SfBd102dtqQZAr4voa4Q@mail.gmail.com>
Subject: Re: [PATCH] failsafe: fix segfault on hotplug event
To: Konstantin Ananyev <konstantin.ananyev@huawei.com>
Cc: "grive@u256.net" <grive@u256.net>, "dev@dpdk.org" <dev@dpdk.org>,
 "stable@dpdk.org" <stable@dpdk.org>, hyonkim@cisco.com, johndale@cisco.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 <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org

Hi Konstantin,

> It is not recommended way to update rte_eth_fp_ops[] contents directly.
> There are eth_dev_fp_ops_setup()/ eth_dev_fp_ops_reset() that supposed
> to be used for that.

Good to know. I see another fix that was made in a different PMD that
does exactly the same thing:

https://github.com/DPDK/dpdk/commit/bcd68b68415172815e55fc67cf3947c0433baf74

CC'ing the authors for awareness.

> About the fix itself - while it might help till some extent,
> I think it will not remove the problem completely.
> There still remain a race-condition between rte_eth_rx_burst() and failsafe_eth_rmv_event_callback().
> Right now DPDK doesn't support switching PMD fast-ops functions (or updating rxq/txq data)
> on the fly.

Thanks for the information. This is very helpful.

Are you saying that the previous code also had that same race
condition? It was only updating the rte_eth_dev structure, but I
assume the problem would have been the same since rte_eth_rx_burst()
in DPDK versions <=20 use the function pointers in rte_eth_dev, not
rte_eth_fp_ops.

Can you think of a possible solution to this problem? I'm happy to
provide a patch to properly fix the problem. Having your guidance
would be extremely helpful.

Thanks!