DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] dev: don't fail the hotplug request if device is attached in secondary
@ 2018-11-23 14:58 Darek Stojaczyk
  2018-11-23 18:30 ` Zhang, Qi Z
  0 siblings, 1 reply; 3+ messages in thread
From: Darek Stojaczyk @ 2018-11-23 14:58 UTC (permalink / raw)
  To: dev; +Cc: thomas, Darek Stojaczyk, qi.z.zhang

Consider the following scenario:

 1) primary process (A) starts, probes the bus
 2) a secondary process (B) starts, probes the bus
 3) yet another secondary process (C) starts
 4) (C) registers the pci driver and hotplugs the device
    * an IPC attach req is sent to the primary (A)
      * (A) ignores the -EEXIST from process-local probe
      * (A) propagates the request to all secondary processes
        * (B) responds with -EEXIST
      * (A) replies to the original request with the -EEXIST
        return code
    * the -EEXIST is returned back to the user, although the
      device was successfully attached both locally and in
      all other processes

This patch makes the primary process reply with rc=0 even if
there was another secondary process with the device already
attached. The primary process already didn't reply with -EEXIST
when the device was attached locally, so now this behavior is
even more consistent. Looking by the code, this seems to be the
originally intended behavior.

Fixes: ac9e4a17370f ("eal: support attach/detach shared device from secondary")
Cc: qi.z.zhang@intel.com

Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
---
 lib/librte_eal/common/hotplug_mp.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/librte_eal/common/hotplug_mp.c b/lib/librte_eal/common/hotplug_mp.c
index 7c9fcc46c..c0115d5f6 100644
--- a/lib/librte_eal/common/hotplug_mp.c
+++ b/lib/librte_eal/common/hotplug_mp.c
@@ -391,13 +391,13 @@ int eal_dev_hotplug_request_to_secondary(struct eal_dev_mp_req *req)
 		struct eal_dev_mp_req *resp =
 			(struct eal_dev_mp_req *)mp_reply.msgs[i].param;
 		if (resp->result != 0) {
-			req->result = resp->result;
 			if (req->t == EAL_DEV_REQ_TYPE_ATTACH &&
-				req->result != -EEXIST)
-				break;
+				resp->result == -EEXIST)
+				continue;
 			if (req->t == EAL_DEV_REQ_TYPE_DETACH &&
-				req->result != -ENOENT)
-				break;
+				resp->result == -ENOENT)
+				continue;
+			req->result = resp->result;
 		}
 	}
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] dev: don't fail the hotplug request if device is attached in secondary
  2018-11-23 14:58 [dpdk-dev] [PATCH] dev: don't fail the hotplug request if device is attached in secondary Darek Stojaczyk
@ 2018-11-23 18:30 ` Zhang, Qi Z
  2018-11-25 12:28   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang, Qi Z @ 2018-11-23 18:30 UTC (permalink / raw)
  To: Stojaczyk, Dariusz, dev; +Cc: thomas



> -----Original Message-----
> From: Stojaczyk, Dariusz
> Sent: Friday, November 23, 2018 6:58 AM
> To: dev@dpdk.org
> Cc: thomas@monjalon.net; Stojaczyk, Dariusz <dariusz.stojaczyk@intel.com>;
> Zhang, Qi Z <qi.z.zhang@intel.com>
> Subject: [PATCH] dev: don't fail the hotplug request if device is attached in
> secondary
> 
> Consider the following scenario:
> 
>  1) primary process (A) starts, probes the bus
>  2) a secondary process (B) starts, probes the bus
>  3) yet another secondary process (C) starts
>  4) (C) registers the pci driver and hotplugs the device
>     * an IPC attach req is sent to the primary (A)
>       * (A) ignores the -EEXIST from process-local probe
>       * (A) propagates the request to all secondary processes
>         * (B) responds with -EEXIST
>       * (A) replies to the original request with the -EEXIST
>         return code
>     * the -EEXIST is returned back to the user, although the
>       device was successfully attached both locally and in
>       all other processes
> 
> This patch makes the primary process reply with rc=0 even if there was another
> secondary process with the device already attached. The primary process
> already didn't reply with -EEXIST when the device was attached locally, so now
> this behavior is even more consistent. Looking by the code, this seems to be the
> originally intended behavior.
> 
> Fixes: ac9e4a17370f ("eal: support attach/detach shared device from
> secondary")
> Cc: qi.z.zhang@intel.com
> 
> Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

> ---
>  lib/librte_eal/common/hotplug_mp.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/librte_eal/common/hotplug_mp.c
> b/lib/librte_eal/common/hotplug_mp.c
> index 7c9fcc46c..c0115d5f6 100644
> --- a/lib/librte_eal/common/hotplug_mp.c
> +++ b/lib/librte_eal/common/hotplug_mp.c
> @@ -391,13 +391,13 @@ int eal_dev_hotplug_request_to_secondary(struct
> eal_dev_mp_req *req)
>  		struct eal_dev_mp_req *resp =
>  			(struct eal_dev_mp_req *)mp_reply.msgs[i].param;
>  		if (resp->result != 0) {
> -			req->result = resp->result;
>  			if (req->t == EAL_DEV_REQ_TYPE_ATTACH &&
> -				req->result != -EEXIST)
> -				break;
> +				resp->result == -EEXIST)
> +				continue;
>  			if (req->t == EAL_DEV_REQ_TYPE_DETACH &&
> -				req->result != -ENOENT)
> -				break;
> +				resp->result == -ENOENT)
> +				continue;
> +			req->result = resp->result;	
>  		}
>  	}
> 
> --
> 2.17.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] dev: don't fail the hotplug request if device is attached in secondary
  2018-11-23 18:30 ` Zhang, Qi Z
@ 2018-11-25 12:28   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2018-11-25 12:28 UTC (permalink / raw)
  To: Stojaczyk, Dariusz; +Cc: dev, Zhang, Qi Z

> > Consider the following scenario:
> > 
> >  1) primary process (A) starts, probes the bus
> >  2) a secondary process (B) starts, probes the bus
> >  3) yet another secondary process (C) starts
> >  4) (C) registers the pci driver and hotplugs the device
> >     * an IPC attach req is sent to the primary (A)
> >       * (A) ignores the -EEXIST from process-local probe
> >       * (A) propagates the request to all secondary processes
> >         * (B) responds with -EEXIST
> >       * (A) replies to the original request with the -EEXIST
> >         return code
> >     * the -EEXIST is returned back to the user, although the
> >       device was successfully attached both locally and in
> >       all other processes
> > 
> > This patch makes the primary process reply with rc=0 even if there was another
> > secondary process with the device already attached. The primary process
> > already didn't reply with -EEXIST when the device was attached locally, so now
> > this behavior is even more consistent. Looking by the code, this seems to be the
> > originally intended behavior.
> > 
> > Fixes: ac9e4a17370f ("eal: support attach/detach shared device from
> > secondary")
> > Cc: qi.z.zhang@intel.com
> > 
> > Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
> 
> Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-25 12:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-23 14:58 [dpdk-dev] [PATCH] dev: don't fail the hotplug request if device is attached in secondary Darek Stojaczyk
2018-11-23 18:30 ` Zhang, Qi Z
2018-11-25 12:28   ` Thomas Monjalon

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).