DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Dumitrescu, Cristian" <cristian.dumitrescu@intel.com>
To: "Singh, Aman Deep" <aman.deep.singh@intel.com>,
	Stephen Hemminger <stephen@networkplumber.org>
Cc: "Jangra, Yogesh" <yogesh.jangra@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	 "R, Kamalakannan" <kamalakannan.r@intel.com>,
	"Suresh Narayane, Harshad" <harshad.suresh.narayane@intel.com>
Subject: RE: [PATCH] app/testpmd: fix closing softnic port before ethdev ports
Date: Fri, 10 Mar 2023 13:45:30 +0000	[thread overview]
Message-ID: <CH0PR11MB572411EAB25A4C7F97576395EBBA9@CH0PR11MB5724.namprd11.prod.outlook.com> (raw)
In-Reply-To: <41d07191-7057-1c32-a57a-1f3d60848ed2@intel.com>



> -----Original Message-----
> From: Singh, Aman Deep <aman.deep.singh@intel.com>
> Sent: Friday, March 10, 2023 9:09 AM
> To: Stephen Hemminger <stephen@networkplumber.org>; Dumitrescu, Cristian
> <cristian.dumitrescu@intel.com>
> Cc: Jangra, Yogesh <yogesh.jangra@intel.com>; dev@dpdk.org; R,
> Kamalakannan <kamalakannan.r@intel.com>; Suresh Narayane, Harshad
> <harshad.suresh.narayane@intel.com>
> Subject: Re: [PATCH] app/testpmd: fix closing softnic port before ethdev ports
> 
> 
> On 3/10/2023 1:52 AM, Stephen Hemminger wrote:
> > On Thu, 9 Mar 2023 17:19:59 +0000
> > "Dumitrescu, Cristian" <cristian.dumitrescu@intel.com> wrote:
> >
> >>> -----Original Message-----
> >>> From: Stephen Hemminger <stephen@networkplumber.org>
> >>> Sent: Thursday, March 9, 2023 4:31 PM
> >>> To: Jangra, Yogesh <yogesh.jangra@intel.com>
> >>> Cc: dev@dpdk.org; Dumitrescu, Cristian <cristian.dumitrescu@intel.com>;
> R,
> >>> Kamalakannan <kamalakannan.r@intel.com>; Suresh Narayane, Harshad
> >>> <harshad.suresh.narayane@intel.com>
> >>> Subject: Re: [PATCH] app/testpmd: fix closing softnic port before ethdev
> ports
> >>>
> >>> On Thu,  9 Mar 2023 14:42:49 +0000
> >>> Yogesh Jangra <yogesh.jangra@intel.com> wrote:
> >>>
> >>>> +		/*
> >>>> +		 * SoftNIC runs on the sevice core, it uses the resources from
> >>>> +		 * the testpmd application. When we run quit command, the
> >>> testpmd
> >>>> +		 * application stops ethdev ports first, SoftNIC will try to
> >>>> +		 * access the port and sometimes that result in segmentation
> >>>> +		 * error. So first closing the SoftNIC port.
> >>>> +		 */
> >>>> +		RTE_ETH_FOREACH_DEV(pt_id) {
> >>>> +			if (!strcmp(ports[pt_id].dev_info.driver_name,
> >>> "net_softnic")) {
> >>>> +				stop_port(pt_id);
> >>>> +				close_port(pt_id);
> >>>> +			}
> >>>> +		}
> >>>> +
> >>> NAK
> >>> No driver specific hacks please.
> >>>
> >>> Instead fix the driver design or bug please.
> >> Hi Stephen,
> >>
> >> This is not a Soft NIC driver-specific hack, this is required for working around
> some of the ethdev drivers that don't implement the stop() API correctly and
> free up the device queues or some other internal resources on stop() instead of
> close().
> >>
> >> The Soft NIC is a meta-device that sits on top of other "physical" ethdev
> devices, so when the Soft NIC device continues to poll the queues of those
> physical devices after their queues have been freed, the Soft NIC will get a
> segfault. This fix is required to protect against this sort of incorrect driver
> behavior by simply stopping the Soft NIC devices first.
> >>
> >> We already have several driver specific branches in the test-pmd for e.g. LAG
> or virtual devices; IMO this small change falls in the same category and it should
> get accepted.
> >>
> >> Please let us know if this makes sense to you?
> >>
> >> Regards,
> >> Cristian
> > If the application has to do this then something is wrong with the architecture.
> >
> >
> > You aren't propagating state changes through in a safe manner.
> > Other applications will have same issue.
> >
> > If LAG or virtual devices have similar problems then a generic solution is
> needed.
> 
> At exit, there is call to stop_packet_forwarding(). Shouldn't that stop SoftNic
> from polling of the queues ?

Hi Aman,

Unfortunately not. Calling the stop_packet_forwarding() will not stop the core running the Soft NIC, as Soft NIC is running on a service core, and the service cores are not handled by this function.

Moreover, a Soft NIC device is not taking over the entire service core; the same service core can also run other services e.g. Soft NIC for device A, telemetry, stats, Soft NIC for device B, etc). Therefore, stopping the service core associated with a Soft NIC device will also incorrectly result in stopping all the other services running on the same service core.

Stopping the service for a Soft NIC device is done by the stop() function, which is exactly what we are trying to do with this short patch.

Regards,
Cristian


  reply	other threads:[~2023-03-10 13:45 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-09 14:42 Yogesh Jangra
2023-03-09 16:02 ` [PATCH v2] " Yogesh Jangra
2024-04-18 15:29   ` Ferruh Yigit
2023-03-09 16:31 ` [PATCH] " Stephen Hemminger
2023-03-09 17:19   ` Dumitrescu, Cristian
2023-03-09 19:09     ` Dumitrescu, Cristian
2023-03-09 20:22     ` Stephen Hemminger
2023-03-10  9:09       ` Singh, Aman Deep
2023-03-10 13:45         ` Dumitrescu, Cristian [this message]
2023-03-10 12:00     ` Ferruh Yigit
2023-03-10 13:47       ` David Marchand
2023-03-10 13:47       ` Dumitrescu, Cristian
2023-03-10 13:49         ` David Marchand
2023-03-10 14:36           ` Dumitrescu, Cristian
2023-03-10 14:39             ` David Marchand
2023-03-10 14:58             ` Thomas Monjalon
2023-03-10 13:58         ` Ferruh Yigit
2023-03-10 16:44           ` Stephen Hemminger
2023-03-17  7:11             ` Jangra, Yogesh
2023-03-09 19:08 ` Dumitrescu, Cristian

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=CH0PR11MB572411EAB25A4C7F97576395EBBA9@CH0PR11MB5724.namprd11.prod.outlook.com \
    --to=cristian.dumitrescu@intel.com \
    --cc=aman.deep.singh@intel.com \
    --cc=dev@dpdk.org \
    --cc=harshad.suresh.narayane@intel.com \
    --cc=kamalakannan.r@intel.com \
    --cc=stephen@networkplumber.org \
    --cc=yogesh.jangra@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).