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 C5D1043212; Fri, 27 Oct 2023 09:18:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 16DB840649; Fri, 27 Oct 2023 09:18:11 +0200 (CEST) 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 A74A94029A for ; Fri, 27 Oct 2023 09:18:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698391089; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AV+WQhv82rOsxj+AmOe43B/Nd22aRj7Be3NiY+ipJNI=; b=W5pPVDDTzj+eK1G+ORi32j5UmKvReiPAwjfl+sxiGF2lPd9PoH7v9W+HZmPCyd+mPBw+4t LRu8HXV65/C+M+t3FbnCqNiDZdbV/btiCBeZOY9aDh5/yIRpC9DPvw9PDTpPRVjcq+jiWm dQ5kqj9OoRL8e+K0d7oCuoQsI55Lgpw= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-626-320uZtuQOAeZmxK8scqJ8A-1; Fri, 27 Oct 2023 03:18:07 -0400 X-MC-Unique: 320uZtuQOAeZmxK8scqJ8A-1 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2c520e0a9a7so19232411fa.3 for ; Fri, 27 Oct 2023 00:18:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698391086; x=1698995886; h=content-transfer-encoding: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=AV+WQhv82rOsxj+AmOe43B/Nd22aRj7Be3NiY+ipJNI=; b=VSgu5JRoxvnqK2Wiui9hCnYUAMe8LQNWR4yTsnC3OQSwfMBBXvh6djMvNs3PCvuIyn C5z0zM0MExArEFilQXpXQvXykxB/pYZDuwd1gfnmlLypE0eZfPSCjOSCl/oJLcpnUVbT iLK24SV3C60tgUvPoGfeL+HhYtHyC9jE7XKgtNbOCFaa0/c6DcclUlMdeC2Rjk6zlkaP Ydwt+myPFL6SJ0XA+vgy8pVVmRWB/LwEydOsSMN/a6I76Ohmh/3eFY3xIrditDx/3W1y vZ3/b5c5EeEbrZSK7O6UlfT0BLRgbsuYsdvIYFlJKrL6t6Lucq4DH37Re/WGVBKx7kFW RBbg== X-Gm-Message-State: AOJu0YwE101KxQY+kls/3lvNLep7z8wgW7V3978W6nSQq4wfaqS+4SIr yKrIIuDxtqymDT/gAkxNCj7/QZ5FXMfmzG8bvwp+f+QQuAuVMQXmIGnm9j+ibP8PK1dZGMVUQi/ i2Q4AW7eYiYojdd3bSU0= X-Received: by 2002:a2e:9416:0:b0:2c5:1989:ce1c with SMTP id i22-20020a2e9416000000b002c51989ce1cmr1142345ljh.26.1698391086159; Fri, 27 Oct 2023 00:18:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEQSQgjQSSG2sgr7i9CAJ+j6QtxqfestNzYinXgBzPspF6OoihMnZ6b/V6ImDg1Qu3nnjj0v8cgEXWerfMYNfc= X-Received: by 2002:a2e:9416:0:b0:2c5:1989:ce1c with SMTP id i22-20020a2e9416000000b002c51989ce1cmr1142326ljh.26.1698391085704; Fri, 27 Oct 2023 00:18:05 -0700 (PDT) MIME-Version: 1.0 References: <20231026095112.3053582-1-mingjinx.ye@intel.com> In-Reply-To: <20231026095112.3053582-1-mingjinx.ye@intel.com> From: David Marchand Date: Fri, 27 Oct 2023 09:17:54 +0200 Message-ID: Subject: Re: [PATCH] net/iavf: fix crash on closing representor ports To: Mingjin Ye , Jiale Song Cc: dev@dpdk.org, qiming.yang@intel.com, yidingx.zhou@intel.com, stable@dpdk.org, Qi Zhang X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 On Thu, Oct 26, 2023 at 12:01=E2=80=AFPM Mingjin Ye = wrote: > Afaics, the patch title is wrong, this is a net/ice fix. > Since the representor port needs to access the resources of the > associated DCF when it is closed. Therefore, the correct close > port operation is to close all the representor ports first, and > then close the associated DCF port. > > If the DCF port is closed before the representor port on pmd exit. > This will result in accessing freed resources and eventually a > core dump will occur. > > This patch fixes this issue by notifying all presentor ports > that DCF is not accessible when the DCF port is closed. > And when the presentor port is closed, it determines if the DCF > resources are accessible. If it can't be accessed, it will > report an error and return. > > Fixes: 5674465a32c8 ("net/ice: add DCF VLAN handling") > Fixes: 295968d17407 ("ethdev: add namespace") This Fixes: tag above is very likely wrong: this 295968d17407 commit only prefixed ethdev macros and functions with the right namespace. Please remove. > Fixes: da9cdcd1f372 ("net/ice: fix crash on representor port closing") > Cc: stable@dpdk.org > I got pinged by Song Jiale about a ice DCF crash. Is this the same issue? If so, if a bugzilla was opened, it must be referenced here. And please confirm the issue is fixed. > Signed-off-by: Mingjin Ye > --- > drivers/net/ice/ice_dcf_ethdev.h | 1 + > drivers/net/ice/ice_dcf_vf_representor.c | 12 +++++++----- > 2 files changed, 8 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/ice/ice_dcf_ethdev.h b/drivers/net/ice/ice_dcf_e= thdev.h > index 4baaec4b8b..d94ef10244 100644 > --- a/drivers/net/ice/ice_dcf_ethdev.h > +++ b/drivers/net/ice/ice_dcf_ethdev.h > @@ -60,6 +60,7 @@ struct ice_dcf_vf_repr { > struct rte_ether_addr mac_addr; > uint16_t switch_domain_id; > uint16_t vf_id; > + bool dcf_valid; > > struct ice_dcf_vlan outer_vlan_info; /* DCF always handle outer V= LAN */ > }; > diff --git a/drivers/net/ice/ice_dcf_vf_representor.c b/drivers/net/ice/i= ce_dcf_vf_representor.c > index b9fcfc80ad..b4a94427df 100644 > --- a/drivers/net/ice/ice_dcf_vf_representor.c > +++ b/drivers/net/ice/ice_dcf_vf_representor.c > @@ -45,6 +45,8 @@ ice_dcf_vf_repr_dev_start(struct rte_eth_dev *dev) > static int > ice_dcf_vf_repr_dev_stop(struct rte_eth_dev *dev) > { > + struct ice_dcf_vf_repr *repr =3D dev->data->dev_private; Newline missing. > + repr->dcf_valid =3D false; > dev->data->dev_link.link_status =3D RTE_ETH_LINK_DOWN; > > return 0; > @@ -111,14 +113,13 @@ ice_dcf_vf_repr_link_update(__rte_unused struct rte= _eth_dev *ethdev, > static __rte_always_inline struct ice_dcf_hw * > ice_dcf_vf_repr_hw(struct ice_dcf_vf_repr *repr) > { > - struct ice_dcf_adapter *dcf_adapter =3D > - repr->dcf_eth_dev->data->dev_private; > - > - if (!dcf_adapter) { > + struct ice_dcf_adapter *dcf_adapter; Newline missing. > + if (!repr->dcf_valid) { > PMD_DRV_LOG(ERR, "DCF for VF representor has been release= d\n"); > return NULL; > } > - > +dcf_adapter =3D Indent is wrong. > + repr->dcf_eth_dev->data->dev_private; And no need for extra newline. > return &dcf_adapter->real_hw; > } > > @@ -414,6 +415,7 @@ ice_dcf_vf_repr_init(struct rte_eth_dev *vf_rep_eth_d= ev, void *init_param) > repr->dcf_eth_dev =3D param->dcf_eth_dev; > repr->switch_domain_id =3D param->switch_domain_id; > repr->vf_id =3D param->vf_id; > + repr->dcf_valid =3D true; > repr->outer_vlan_info.port_vlan_ena =3D false; > repr->outer_vlan_info.stripping_ena =3D false; > repr->outer_vlan_info.tpid =3D RTE_ETHER_TYPE_VLAN; > -- > 2.25.1 > Thanks. --=20 David Marchand