From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 3762D1B4D1 for ; Fri, 23 Nov 2018 19:30:45 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Nov 2018 10:30:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,270,1539673200"; d="scan'208";a="108777170" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga004.fm.intel.com with ESMTP; 23 Nov 2018 10:30:45 -0800 Received: from fmsmsx113.amr.corp.intel.com (10.18.116.7) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 23 Nov 2018 10:30:44 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX113.amr.corp.intel.com (10.18.116.7) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 23 Nov 2018 10:30:44 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.161]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.199]) with mapi id 14.03.0415.000; Sat, 24 Nov 2018 02:30:42 +0800 From: "Zhang, Qi Z" To: "Stojaczyk, Dariusz" , "dev@dpdk.org" CC: "thomas@monjalon.net" Thread-Topic: [PATCH] dev: don't fail the hotplug request if device is attached in secondary Thread-Index: AQHUgz00tVIPkl2ZlE+09XAxAHRbjKVdq3Qw Date: Fri, 23 Nov 2018 18:30:41 +0000 Message-ID: <039ED4275CED7440929022BC67E70611532EA1B2@SHSMSX103.ccr.corp.intel.com> References: <20181123145824.95786-1-dariusz.stojaczyk@intel.com> In-Reply-To: <20181123145824.95786-1-dariusz.stojaczyk@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNjY1OTMyZWMtYzI2YS00MWVhLTllOGQtMDgwNzY1ZDExM2I0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiQkx6cHJza2pjYitPTWtoVGdGXC90dE55ZHpObkRhYnBCcVRkZEw3MGljU1QwMWhjcWNmcXh1TG93Z1Q0Q0ZSa0IifQ== x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] dev: don't fail the hotplug request if device is attached in secondary X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Nov 2018 18:30:46 -0000 > -----Original Message----- > From: Stojaczyk, Dariusz > Sent: Friday, November 23, 2018 6:58 AM > To: dev@dpdk.org > Cc: thomas@monjalon.net; Stojaczyk, Dariusz = ; > Zhang, Qi Z > Subject: [PATCH] dev: don't fail the hotplug request if device is attache= d in > secondary >=20 > Consider the following scenario: >=20 > 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 >=20 > This patch makes the primary process reply with rc=3D0 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, s= o now > this behavior is even more consistent. Looking by the code, this seems to= be the > originally intended behavior. >=20 > Fixes: ac9e4a17370f ("eal: support attach/detach shared device from > secondary") > Cc: qi.z.zhang@intel.com >=20 > Signed-off-by: Darek Stojaczyk Acked-by: Qi Zhang > --- > lib/librte_eal/common/hotplug_mp.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) >=20 > 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 =3D > (struct eal_dev_mp_req *)mp_reply.msgs[i].param; > if (resp->result !=3D 0) { > - req->result =3D resp->result; > if (req->t =3D=3D EAL_DEV_REQ_TYPE_ATTACH && > - req->result !=3D -EEXIST) > - break; > + resp->result =3D=3D -EEXIST) > + continue; > if (req->t =3D=3D EAL_DEV_REQ_TYPE_DETACH && > - req->result !=3D -ENOENT) > - break; > + resp->result =3D=3D -ENOENT) > + continue; > + req->result =3D resp->result;=09 > } > } >=20 > -- > 2.17.1