All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matan Azrad <matan@mellanox.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>,
	Wenzhuo Lu <wenzhuo.lu@intel.com>,
	 Jingjing Wu <jingjing.wu@intel.com>,
	Bernard Iremonger <bernard.iremonger@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix hotplug
Date: Thu, 23 Jan 2020 16:00:35 +0000	[thread overview]
Message-ID: <AM0PR0502MB4019CF095015176DC92EA73ED20F0@AM0PR0502MB4019.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <20200123151509.3207419-1-ferruh.yigit@intel.com>


Hi

From: Ferruh Yigit
> The 'port_id_is_invalid()' check in the 'detach_port_device()' is breaking the
> hotplug support, since at that stage port will be closed and validity check
> always fail [1] and removing the device is not really completed.
> 
> But this cause the vfio request interrupt keep triggered continuously and
> makes the application unusable, since port is closed but device is not
> removed, the remove path keep generating error log:
> 
> EAL: can not get port by device 0000:00:05.0!
> EAL: can not get port by device 0000:00:05.0!
> EAL: can not get port by device 0000:00:05.0!
> EAL: can not get port by device 0000:00:05.0!
> EAL: can not get port by device 0000:00:05.0!
> EAL: can not get port by device 0000:00:05.0!
> 
> Fixed by removing 'port_id_is_invalid()' check from 'detach_port_device()',
> anyway it shouldn't be required. Without this check device remove works as
> expected.
> 
> Only "Invalid port_id=0" logs seen a few times, which is because the actual
> removal not done synchronously but an alarm set for it, until the alarm fired
> application may receive many interrupts, expect the first ones cause the
> error.
> So this patch also removes the logging from checking the invalid port in
> 'rmv_port_callback()' to reduce the noise.
> 
> [1]
> rmv_port_callback()
>   stop_port(port_id);
>   close_port(port_id);
>   detach_port_device(port_id);
> 
> Fixes: 43d0e304980a ("app/testpmd: fix invalid port detaching")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
>  app/test-pmd/testpmd.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index
> f9f4cd1d3..3323013bb 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -2641,9 +2641,6 @@ detach_port_device(portid_t port_id)
> 
>  	printf("Removing a device...\n");
> 
> -	if (port_id_is_invalid(port_id, ENABLED_WARN))
> -		return;
> -

I don't think this is the correct fix.

See the line below - you use the port structure, it makes sense to check its validity before.

>  	dev = rte_eth_devices[port_id].device;
>  	if (dev == NULL) {
>  		printf("Device already removed\n");
> @@ -2875,7 +2872,8 @@ rmv_port_callback(void *arg)
>  	int org_no_link_check = no_link_check;
>  	portid_t port_id = (intptr_t)arg;
> 
> -	RTE_ETH_VALID_PORTID_OR_RET(port_id);
> +	if (!rte_eth_dev_is_valid_port(port_id))
> +		return;
> 
>  	if (!test_done && port_is_forwarding(port_id)) {
>  		need_to_start = 1;

IMO the correct fix is to change this function to get pointer to rte_device instead of port ID and change the Testpmd command line to get the device instead of port ID.

Matan


  reply	other threads:[~2020-01-23 16:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-23 15:15 [dpdk-dev] [PATCH] app/testpmd: fix hotplug Ferruh Yigit
2020-01-23 16:00 ` Matan Azrad [this message]
2020-01-23 17:01 ` Iremonger, Bernard
2020-01-23 17:25   ` Ferruh Yigit
2020-01-23 17:34     ` Iremonger, Bernard
2020-01-23 17:46       ` Iremonger, Bernard
2020-01-23 18:25         ` Ferruh Yigit

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=AM0PR0502MB4019CF095015176DC92EA73ED20F0@AM0PR0502MB4019.eurprd05.prod.outlook.com \
    --to=matan@mellanox.com \
    --cc=bernard.iremonger@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jingjing.wu@intel.com \
    --cc=stable@dpdk.org \
    --cc=wenzhuo.lu@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.