DPDK patches and discussions
 help / color / mirror / Atom feed
From: Gaetan Rivet <grive@u256.net>
To: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] eal: fix to set the rte_device ptr's device args before hotplug
Date: Tue, 4 Feb 2020 10:49:10 +0100	[thread overview]
Message-ID: <ac2efbfe-9a06-3e35-c20e-32f61216fc6a@u256.net> (raw)
In-Reply-To: <20200204091548.2861-1-somnath.kotur@broadcom.com>

On 04/02/2020 10:15, Somnath Kotur wrote:
> As per the comments in this code section, "since there is a matching device,
> it is now its responsibility to manage the devargs we've just inserted."
> But the matching device ptr's devargs is still uninitialized or not pointing
> to the newest dev_args that were passed as a parameter to local_dev_probe().
> This is needed particularly in the case when *probe is called again* on an
> already probed device(the parent device for the representor) as part of adding
> a representor port to an OVS switch(OVS-DPDK) like so:
> ovs-vsctl add-port ovsbr0 vfrep1 -- set Interface vfrep1 type=dpdk \
> options:dpdk-devargs=0000:06:02.0,representor=[1]
> 
> Fixes: 7e8b26650146 ("eal: fix hotplug add / remove")
> 
> Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
> ---
>   lib/librte_eal/common/eal_common_dev.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
> index 9e4f09d..311eef5 100644
> --- a/lib/librte_eal/common/eal_common_dev.c
> +++ b/lib/librte_eal/common/eal_common_dev.c
> @@ -171,6 +171,7 @@ static int cmp_dev_name(const struct rte_device *dev, const void *_name)
>   	 * those devargs shouldn't be removed manually anymore.
>   	 */
>   
> +	dev->devargs = da;
>   	ret = dev->bus->plug(dev);
>   	if (ret > 0)
>   		ret = -ENOTSUP;
> 

Hello Somnath,

On a surface level, the fix does not seem correct.
The comment

    "Since there is a matching device, it is now its responsibility
     to manage the devargs we've just inserted. From this point,
     those devargs should'nt be removed manually anymore."

means that the err_devarg label is not correct, on further error in the
function, returning the error code and cleaning up the device is sufficient.

Setting the devargs for a device is the responsibility of the bus scan function.
In the PCI bus for example, this is done in pci_name_set(), called once a device name is fully qualified
after scanning the system and thus being able to match a devargs to the device name.

Can you please give more information about the device bus, and maybe trace the path taken
by the line "ret = da->bus->scan();" a few lines above your edit? If your dev->devargs is not set
afterward, it seems the bug would be there.

It could be the bus that is not properly implemented, the devargs name not fully qualified, a special path taken by a vdev (I'm not sure what the ovsbr0 device is for example), or a specific representor pluging function, difficult to pinpoint exactly right now.

  reply	other threads:[~2020-02-04  9:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-04  9:15 Somnath Kotur
2020-02-04  9:49 ` Gaetan Rivet [this message]
2020-02-05  8:52   ` Somnath Kotur
2020-02-05  9:17     ` Gaetan Rivet
2020-02-06  4:06       ` Somnath Kotur
2020-02-07  5:52         ` Somnath Kotur
2020-02-10 14:34           ` Gaetan Rivet
2020-02-10 15:00             ` Gaetan Rivet
2020-02-11  4:33             ` Somnath Kotur
2020-02-11  8:38               ` Gaetan Rivet
2020-02-14  6:46                 ` Somnath Kotur

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=ac2efbfe-9a06-3e35-c20e-32f61216fc6a@u256.net \
    --to=grive@u256.net \
    --cc=dev@dpdk.org \
    /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).