DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: Mingjin Ye <mingjinx.ye@intel.com>, Jiale Song <songx.jiale@intel.com>
Cc: dev@dpdk.org, qiming.yang@intel.com, yidingx.zhou@intel.com,
	 stable@dpdk.org, Qi Zhang <qi.z.zhang@intel.com>
Subject: Re: [PATCH] net/iavf: fix crash on closing representor ports
Date: Fri, 27 Oct 2023 09:17:54 +0200	[thread overview]
Message-ID: <CAJFAV8ytZ=6mC1QEfD8YRVDpLxJwzGAET4q4W=FiECTX=yq6cQ@mail.gmail.com> (raw)
In-Reply-To: <20231026095112.3053582-1-mingjinx.ye@intel.com>

On Thu, Oct 26, 2023 at 12:01 PM Mingjin Ye <mingjinx.ye@intel.com> 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 <mingjinx.ye@intel.com>
> ---
>  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_ethdev.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 VLAN */
>  };
> diff --git a/drivers/net/ice/ice_dcf_vf_representor.c b/drivers/net/ice/ice_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 = dev->data->dev_private;

Newline missing.

> +       repr->dcf_valid = false;
>         dev->data->dev_link.link_status = 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 =
> -                       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 released\n");
>                 return NULL;
>         }
> -
> +dcf_adapter =

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_dev, void *init_param)
>         repr->dcf_eth_dev = param->dcf_eth_dev;
>         repr->switch_domain_id = param->switch_domain_id;
>         repr->vf_id = param->vf_id;
> +       repr->dcf_valid = true;
>         repr->outer_vlan_info.port_vlan_ena = false;
>         repr->outer_vlan_info.stripping_ena = false;
>         repr->outer_vlan_info.tpid = RTE_ETHER_TYPE_VLAN;
> --
> 2.25.1
>

Thanks.


-- 
David Marchand


  reply	other threads:[~2023-10-27  7:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-26  9:51 Mingjin Ye
2023-10-27  7:17 ` David Marchand [this message]
2023-10-30  2:35 ` [PATCH v2] " Mingjin Ye
2023-10-30  8:44 ` [PATCH v2] net/ice: " Mingjin Ye
2023-11-01  1:11   ` Zhang, Qi Z
2023-11-01 10:13   ` [PATCH v3] " Mingjin Ye
2023-11-01 10:48     ` Zhang, Qi Z
2023-11-02  2:38       ` Ye, MingjinX
2023-11-02  3:59         ` Zhang, Qi Z
2023-11-02 10:11     ` [PATCH v4] " Mingjin Ye
2023-11-06  1:23       ` Zhang, Qi Z
2023-11-06 10:00       ` [PATCH v5] " Mingjin Ye
2023-11-06 12:05         ` Zhang, Qi Z
2023-11-07 10:12         ` [PATCH v6] " Mingjin Ye
2023-11-07 12:18           ` Zhang, Qi Z
2023-11-08 11:39           ` [PATCH v7] " Mingjin Ye
2023-11-09  0:26             ` Zhang, Qi Z

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJFAV8ytZ=6mC1QEfD8YRVDpLxJwzGAET4q4W=FiECTX=yq6cQ@mail.gmail.com' \
    --to=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=mingjinx.ye@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=songx.jiale@intel.com \
    --cc=stable@dpdk.org \
    --cc=yidingx.zhou@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).