DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Xueming(Steven) Li" <xuemingl@nvidia.com>
To: "chenbo.xia@intel.com" <chenbo.xia@intel.com>,
	"andrew.rybchenko@oktetlabs.ru" <andrew.rybchenko@oktetlabs.ru>
Cc: "maxime.coquelin@redhat.com" <maxime.coquelin@redhat.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] net/virtio: wait device ready in device reset
Date: Wed, 15 Sep 2021 09:23:32 +0000	[thread overview]
Message-ID: <a4a0511550cbbce021424510a30db58f73a1657c.camel@nvidia.com> (raw)
In-Reply-To: <MN2PR11MB406307BB4DC5BF93D1CE6D5A9CC79@MN2PR11MB4063.namprd11.prod.outlook.com>

On Thu, 2021-08-26 at 07:15 +0000, Xia, Chenbo wrote:
> Hi Adrew & Xueming,
> 
> > -----Original Message-----
> > From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> > Sent: Tuesday, August 24, 2021 11:41 PM
> > To: Xueming(Steven) Li <xuemingl@nvidia.com>
> > Cc: dev@dpdk.org; Maxime Coquelin <maxime.coquelin@redhat.com>; Xia, Chenbo
> > <chenbo.xia@intel.com>
> > Subject: Re: [dpdk-dev] [PATCH] net/virtio: wait device ready in device reset
> > 
> > On 8/23/21 4:54 PM, Xueming(Steven) Li wrote:
> > > 
> > > 
> > > > -----Original Message-----
> > > > From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
> > > > Sent: Monday, August 23, 2021 5:57 PM
> > > > To: Xueming(Steven) Li <xuemingl@nvidia.com>
> > > > Cc: dev@dpdk.org; Maxime Coquelin <maxime.coquelin@redhat.com>; Chenbo Xia
> > <chenbo.xia@intel.com>
> > > > Subject: Re: [dpdk-dev] [PATCH] net/virtio: wait device ready in device
> > reset
> > > > 
> > > > On 8/23/21 9:39 AM, Xueming Li wrote:
> > > > > According to virtio spec, the device MUST reset when 0 is written to
> > > > > device_status, and present a 0 in device_status once that is done.
> > > > > 
> > > > > This patch adds the missing part of waiting status 0 in reset function.
> > > > > 
> > > > > Signed-off-by: Xueming Li <xuemingl@nvidia.com>
> > > > > ---
> > > > >  drivers/net/virtio/virtio.c | 7 +++++--
> > > > >  1 file changed, 5 insertions(+), 2 deletions(-)
> > > > > 
> > > > > diff --git a/drivers/net/virtio/virtio.c b/drivers/net/virtio/virtio.c
> > > > > index 7e1e77797f..f003f612d6 100644
> > > > > --- a/drivers/net/virtio/virtio.c
> > > > > +++ b/drivers/net/virtio/virtio.c
> > > > > @@ -3,6 +3,8 @@
> > > > >   * Copyright(c) 2020 Red Hat, Inc.
> > > > >   */
> > > > > 
> > > > > +#include <unistd.h>
> > > > > +
> > > > >  #include "virtio.h"
> > > > > 
> > > > >  uint64_t
> > > > > @@ -39,8 +41,9 @@ void
> > > > >  virtio_reset(struct virtio_hw *hw)
> > > > >  {
> > > > >  	VIRTIO_OPS(hw)->set_status(hw, VIRTIO_CONFIG_STATUS_RESET);
> > > > > -	/* flush status write */
> > > > > -	VIRTIO_OPS(hw)->get_status(hw);
> > > > > +	/* Flush status write and wait device ready. */
> > > > > +	while (VIRTIO_OPS(hw)->get_status(hw) != VIRTIO_CONFIG_STATUS_RESET)
> > > > > +		usleep(1000L);
> > > > 
> > > > Don't we need a protection against forever loop here?
> > > 
> > > Good question, ideally we need, kernel driver function vp_reset() seems to
> > have same issue.
> > 
> > Yes, I've seen it.
> > 
> > > How about leaving an error message before return?
> > 
> > @Maxime, @Chenbo, what do you think?
> 
> I would vote for waiting for some time before return rather than forever loop
> and error message is needed.
> 
> My understanding is for kernel, it's fine to sleep forever as kernel could schedule
> it but for DPDK, it will lead to main lcore unable to do other things but sleep
> forever. Meanwhile, users will see the app stuck but don't know what's wrong here.
> 
> Thanks,
> Chenbo
> 

Hi all, thanks for you sugestion, new version posted:
https://mails.dpdk.org/archives/dev/2021-September/219866.html

>  


  reply	other threads:[~2021-09-15  9:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-23  6:39 Xueming Li
2021-08-23  9:56 ` Andrew Rybchenko
2021-08-23 13:54   ` Xueming(Steven) Li
2021-08-24 15:40     ` Andrew Rybchenko
2021-08-26  7:15       ` Xia, Chenbo
2021-09-15  9:23         ` Xueming(Steven) Li [this message]
2021-09-15  9:21 ` [dpdk-dev] [PATCH v1] net/virtio: wait device ready during reset Xueming Li
2021-09-15  9:27   ` Andrew Rybchenko
2021-09-15 10:14     ` Xueming(Steven) Li
2021-09-15 10:12 ` [dpdk-dev] [PATCH v2] " Xueming Li
2021-09-15 10:30   ` Andrew Rybchenko
2021-09-15 11:44   ` Xia, Chenbo
2021-09-28 15:31   ` Maxime Coquelin

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=a4a0511550cbbce021424510a30db58f73a1657c.camel@nvidia.com \
    --to=xuemingl@nvidia.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.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).