DPDK patches and discussions
 help / color / mirror / Atom feed
From: Alexander Skorichenko <askorichenko@netgate.com>
To: stephen@networkplumber.org
Cc: samandrew@microsoft.com, ferruh.yigit@amd.com,
	 andrew.rybchenko@oktetlabs.ru, longli@microsoft.com,
	 Wei Hu <weh@microsoft.com>,
	dev@dpdk.org, Matthew Smith <mgsmith@netgate.com>
Subject: Re: [PATCH] net/netvsc: fix mtu_set in netvsc devices
Date: Tue, 2 Jul 2024 10:49:15 +0200	[thread overview]
Message-ID: <CAGxBn5BZOO6fz=TG50pOaGwFLXYXa=d+GRxWb09M5RrvwsdG=w@mail.gmail.com> (raw)
In-Reply-To: <20240630084041.44e86a57@hermes.local>

[-- Attachment #1: Type: text/plain, Size: 2003 bytes --]

Hello,
The failure happens when running under VPP. In terms of dpdk calls the
following sequence of events occurs for a NetVSC device:

Durung device probing stage of VPP
   1. eth_hn_dev_init() memory for a single primary rx_queue is allocated
            dev->data->rx_queues[0] = 0, allocated, but not set yet
            no allocation happened for tx_queues[i] and non-primary
rx_queues[i]

During device setup stage of VPP from VPP's own generic dpdk_device_setup():
   2.  rte_eth_dev_set_mtu()
            currently it segfaults in hn_reinit() when trying to reach into
            dev->data->rx_queues[i], dev->data->tx_queues[i]
   3.  rte_eth_tx_queue_setup()
            dev->data->tx_queues[i] are being allocated and set
   4.  rte_eth_rx_queue_setup()
            dev->data->rx_queues[i] get allocated (i > 0) and set

So rx_queues[0] could be set in step 1, but rx_queues[i] and tx_queues[i]
are still NULL.
Allocating all the remaining rx/tx queues in step 1 would prevent the
crash, but then in steps 3-4 would go through releasing and allocating all
of the queues again.

Another comment regarding the uniform condition introduced in hn_reinit()
in the patch:
        if (dev->data->rx_queues[0] != NULL) ...
Because of the difference between rx/tx queues described above, it's
probably safer to extend the condition to check both rx and tx separately
        if (dev->data->rx_queues[0] != NULL && dev->data->tx_queues[0] !=
NULL)

- Alexander Skorichenko


On Sun, Jun 30, 2024 at 5:40 PM Stephen Hemminger <
stephen@networkplumber.org> wrote:

> On Fri, 28 Jun 2024 18:35:03 +0200
> Alexander Skorichenko <askorichenko@netgate.com> wrote:
>
> > Prevent segfault in hn_reinit() caused by changing the MTU for
> > an incompletely initialized device.
> >
> > Signed-off-by: Alexander Skorichenko <askorichenko@netgate.com>
>
> How do you get in that state?
> Maybe the init code should set up these pointers and avoid the problem.
>

[-- Attachment #2: Type: text/html, Size: 2656 bytes --]

  reply	other threads:[~2024-07-02  8:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-28 16:35 Alexander Skorichenko
2024-06-30 15:40 ` Stephen Hemminger
2024-07-02  8:49   ` Alexander Skorichenko [this message]
2024-07-03  0:35     ` Long Li
2024-07-03 10:13       ` Alexander Skorichenko
2024-07-03 22:50         ` [EXTERNAL] " Sam Andrew
2024-07-03 22:57           ` Long Li

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='CAGxBn5BZOO6fz=TG50pOaGwFLXYXa=d+GRxWb09M5RrvwsdG=w@mail.gmail.com' \
    --to=askorichenko@netgate.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=longli@microsoft.com \
    --cc=mgsmith@netgate.com \
    --cc=samandrew@microsoft.com \
    --cc=stephen@networkplumber.org \
    --cc=weh@microsoft.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).