From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0049.outbound.protection.outlook.com [104.47.38.49]) by dpdk.org (Postfix) with ESMTP id 2E49E23A for ; Thu, 12 Oct 2017 07:27:13 +0200 (CEST) Received: from BLUPR0301CA0031.namprd03.prod.outlook.com (10.162.113.169) by CY4PR03MB2693.namprd03.prod.outlook.com (10.173.43.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Thu, 12 Oct 2017 05:27:12 +0000 Received: from BL2FFO11FD026.protection.gbl (2a01:111:f400:7c09::153) by BLUPR0301CA0031.outlook.office365.com (2a01:111:e400:5259::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.77.21 via Frontend Transport; Thu, 12 Oct 2017 05:27:12 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD026.mail.protection.outlook.com (10.173.161.105) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.77.10 via Frontend Transport; Thu, 12 Oct 2017 05:27:11 +0000 Received: from [10.232.14.39] ([10.232.14.39]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v9C5R8SA001062; Wed, 11 Oct 2017 22:27:08 -0700 To: Aaron Conole CC: Don Provan , Jan Blunck , Thomas Monjalon , dev , Hemant Agrawal References: <20170812102220.27773-1-shreyansh.jain@nxp.com> <2075457.Vvey9mxHue@xps> <10403057.Ll0Xg1E4J1@xps> <83422f57-4c0e-5806-c741-ed5ce10891b0@nxp.com> <83a3c6c6-8d50-8106-7c7f-9b5c8263ce96@nxp.com> From: Shreyansh Jain Message-ID: Date: Thu, 12 Oct 2017 11:09:20 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-Matching-Connectors: 131522596320685075; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7966004)(336005)(39380400002)(346002)(376002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(377454003)(24454002)(8656003)(356003)(68736007)(106466001)(50986999)(561944003)(23676002)(305945005)(6916009)(104016004)(76176999)(86362001)(31696002)(93886005)(2950100002)(81166006)(53936002)(54356999)(65956001)(65806001)(6246003)(105606002)(4326008)(81156014)(47776003)(230700001)(50466002)(2906002)(8676002)(64126003)(33646002)(83506001)(189998001)(36756003)(31686004)(97736004)(85426001)(6666003)(58126008)(498600001)(316002)(8936002)(77096006)(5660300001)(54906003)(65826007)(229853002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR03MB2693; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD026; 1:WjOIaoR2q1niwk3z5ErFrA7r9ZfCOf9f1XhNoGnWoiy8iEeoc9a2yH+dQOr7AHNrHBPEtArkqN3mZLRoy3XUBYcIL0/PnafMY30cCaLrTg2b5FFRXpxICdm7v8uzH2qM X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0113192e-718e-4d62-ac13-08d51131e418 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017052603199)(201703131430075)(201703131517081); SRVR:CY4PR03MB2693; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2693; 3:PUVtYc9B4on77iKRLliRUPGt5dn5VTzHqE6vgMvY6gIiucNqKenG5EfQJIgszstr1nEdAWZo2CUOTCSWy81fRjJVtaJSnMYx5j3LekJZN8lDRYMduZFonszUpCcE/geHMLNXndo054qU0zmgGfD5hnBu+X7nXwon+NZWVDskvC3ZAmupxXFFoVTA9OCcIkceA8rEpb3M2O61bMsarUXs5pfbmLCZP4LZniFUFTdNWVogjhRBmN1Ssz6A4TtTwp+qTKfnFBdv86Pna7N3Eoebg7s117TaOA6/Ab6GkRU5Vk4qlEvW16SA0ftVMtrFFQvngpvUGUs9M6MG02LRmU8qTcT1+2+675jBFpYLpDfs220=; 25:SAlmAXjCwvUywNhqS11FN0gRBTksx4kspftN2/GT9SAkgLDyGYoZGK3ZE3or1Z3312HhiJ6T88pL05nZFeFnqqgzMZMdBcXopd6DIU8uOcfdWavSUQQenHYhFaNxS1WpkooV0g33kD3OzNY8XDr+xjNPKjhK2kQ+rCjHOLu4hVdCAwNZojBJkQbIX+VKNGhVAfwWbxBhKRgxPuD7iY+9/6txguTXV6sppX7VtagZKdAvgyHbEOFjISRm+WiOSKviBZzlGVSFsORcasV1fDA30UQq0i4kyk7Iwto9TAvLgXPqc4cwHWT/XVtUJhIS9mq1zPVY2zOKA8cJVOytRF4HAA== X-MS-TrafficTypeDiagnostic: CY4PR03MB2693: X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2693; 31:Cs5rJJvdDLMP3Blb5ZFDm9yUbw4EFoUgvebvXaJJjIgtl0TujnQz5MsyK861PmXI5t9ifTPgg2Tj5/YWNdb2fv5oAfrjN1IAtvCfmOyYY30hPnq4um8QSzZ0AOoZuzyfhVnI3iIOFTNE0lIc1sgePLvC3wRhKeCUx8RVSbqk1Ysot2STLLIfEUEsCef9v9WuANBbPoFXdar0nIE13lQPscQAlBO4zWgQr7VMdapja9A=; 4:IIAFHwoRtxGwpTfWT89mjNQNRm+YM9BEMWPKqvyPSb1L1F05p6jCiixDVqX9sL/Einw3v9xEp5orAaAxmRGexm27rWvS9oaf6Q2OaGuQw0AxExz3kGM8QhE4IAu8f43VgEK3kEarjgzswisxlYKo6CslJMsWkas1pPUalQh0gmT6X3SmmFG1rGFMlFCgcPhU8IjYmmvwgFCxR0ymIXUMmiYY0MSwBRA7NKHboWbMh7UYtFfxJ5/Qg82Msmj82o7cBLegU8i+w2e+kJ6Tzh7rKCBn75VeR9SP1lAS6+g5MN3N3WgJfWUHOOXItKLOY86uNclOv4+m5AoFnafHguwVpQ== X-Exchange-Antispam-Report-Test: UriScan:(20558992708506)(185117386973197); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(5005006)(8121501046)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(6055026)(6096035)(20161123565025)(20161123559100)(201703131430075)(201703131433075)(201703131441075)(201703131448075)(201703161259150)(20161123561025)(20161123563025)(20161123556025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR03MB2693; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR03MB2693; X-Forefront-PRVS: 04583CED1A X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtDWTRQUjAzTUIyNjkzOzIzOkYwbzdjNmNGU3pqUDAwd1VIYWIralIwUU5p?= =?utf-8?B?TnlreDBDMUpKOGkwZDNOemJ2UTJTWjk4eHdKQUlka1hNQnZLVTAxTmNpVWFL?= =?utf-8?B?bmdEZHBQb1B4dWFobHNSNzVoV0l0Yk9KaDVWT2swM3BKNGgrVGl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F3A1wH49XPXd6zk=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2693; 6:oGkbnOpN5sTbYxJFKNGA041Rje094qx7FCQ8yNNzXG4Gy2g+P58oCQ0dCy6KqU5mHET11fvfpv9yBtDR2NExuGM5oH+XzIEryLlo5XvUokOY/P9shNN4n8EeMM/f6ZmXpPfFejYaZ6DpGdzXyz38G47VvzefcwenV9s3qQHhScthbT3eTRPjIndt/PaW7fqv5x/fIPWbDUfJEa1FyFYgY6FIrpeF+PTMW/z1IknqIAzTZvQBT3DuY+p1zJeEpFmjnUvfOEvomSnvBNUnVrVsUjneIO12PvtvJCK2r8L7Aj8thyTDI5+GUmyFLn7WTfB2negaQBW4Ihdj9JyJbsryZQ==; 5:Pujl5/Ne3N+60Oyq5nCKN037c7cbrllBi/QlU9TCv2bLTeYOkXV4O0pFdmJACNKen33OzfI6maSsdqbLGDOtBYv8PtRzhUvPrh7oOfT1otwCvzSfOpc+RAhKic+cvFX5D0XPV+JwDVUhugCtHhc/xkGdBPwFuHDTqfShx5qt0VU=; 24:aRRZwEKBadjr7p2oOsdOOliPdJV7ZLmRYDzsz+0441TAZaIZ8bLayUvlnOklDKwudTH1otKjZOx7NMvBtrf68jefQbesOW7xM8UzM6ctWhQ=; 7:+E7I7q88TttjN29ocdm5XYHk42/sCnQNzHClBORvqgIgM63oVn58hel2G5epaqmHTMyuP73qixZKyWwXcofhiUg0sTVmT0tWRytAF4euWiNhbDu/PedfU2M7yFX92XLOdbqBZFIculhVoa5IcaJf5TLqSViGh88mCFYoGDT1aa4mdjhJA7h2+RoO7zIrcLiH7wiE7kjgMnEhue0JcJItCzqtH3M+Tyhrj7ctr0iDFP8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Oct 2017 05:27:11.8657 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR03MB2693 Subject: Re: [dpdk-dev] [PATCH] eal: bus scan and probe never fail 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: Thu, 12 Oct 2017 05:27:14 -0000 Hello Aaron, On Tuesday 10 October 2017 09:30 PM, Aaron Conole wrote: > Shreyansh Jain writes: > >> Hello Don, >> [snip] >>> >>> These practical problems confirm to me that the failure of a bus >>> scan is more of a strategic issue: when asking "which devices can >>> I use?", "none" is a perfectly valid answer that does not seem >>> like an error to me even when a failed bus scan is the reason for >>> that answer. >> >> I agree with this. >> >>> >>> From the application's point of view, the potential error here >>> is that the device it wants to use isn't available. I don't see that >>> either the init function or the probe function will have enough >>> information to understand that application-level problem, so >>> they should leave it to the application to detect it. >> >> I think I understand you comment but just want to cross check again: >> Scan or probe error should simply be ignored by EAL layer and let the >> application take stance when it detects that the device it was looking >> for is missing. Is my understanding correct? >> >> I am trying to come a conclusion so that this patch can either be >> modified or pushed as it is. If the above understanding is correct, I >> don't see any changes required in the patch. > > Does it make sense to introduce a way to query the results of the > various bus types for their status? That way we can give the relevant > information to the application if it wants, and make the bus scanning > code *always* succeed? This version shouldn't be an ABI breakage, > either (confirm?). > > half-baked below (not tested or suitable - just an example): > > --- > diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c > index a30a898..cd1ef1e 100644 > --- a/lib/librte_eal/common/eal_common_bus.c > +++ b/lib/librte_eal/common/eal_common_bus.c > @@ -38,9 +38,23 @@ > > #include "eal_private.h" > > +struct rte_bus_failure { > + struct rte_bus *bus; > + int err; > +}; > + > struct rte_bus_list rte_bus_list = > TAILQ_HEAD_INITIALIZER(rte_bus_list); > > +TAILQ_HEAD(rte_bus_scan_failure_list, rte_bus_failure); > +struct rte_bus_scan_failure_list rte_bus_scan_failure_list = > + TAILQ_HEAD_INITIALIZER(rte_bus_failure); > + > +TAILQ_HEAD(rte_bus_probe_failure_list, rte_bus_failure); > +struct rte_bus_probe_failure_list rte_bus_probe_failure_list = > + TAILQ_HEAD_INITIALIZER(rte_bus_failure); > + > + > void > rte_bus_register(struct rte_bus *bus) > { > @@ -64,6 +78,26 @@ rte_bus_unregister(struct rte_bus *bus) > RTE_LOG(DEBUG, EAL, "Unregistered [%s] bus.\n", bus->name); > } > > +static void > +rte_bus_append_failed_scan(struct rte_bus *bus, int ret) > +{ > + struct rte_bus_failure *f = malloc(sizeof(struct rte_bus_failure)); > + if (!f) abort(); > + f->bus = bus; > + f->ret = ret; > + TAILQ_INSERT_TAIL(&rte_bus_scan_failure_list, f, next); > +} > + > +static void > +rte_bus_append_failed_scan(struct rte_bus *bus, int ret) > +{ > + struct rte_bus_failure *f = malloc(sizeof(struct rte_bus_failure)); > + if (!f) abort(); > + f->bus = bus; > + f->ret = ret; > + TAILQ_INSERT_TAIL(&rte_bus_probe_failure_list, f, next); > +} > + > /* Scan all the buses for registered devices */ > int > rte_bus_scan(void) > @@ -76,13 +110,33 @@ rte_bus_scan(void) > if (ret) { > RTE_LOG(ERR, EAL, "Scan for (%s) bus failed.\n", > bus->name); > - return ret; > + rte_bus_append_failed_scan(bus, ret); > } > } > > return 0; > } > > +/* Seek through scan failures */ > +void > +rte_bus_scan_errors(rte_bus_error_callback cb) > +{ > + struct rte_bus_failure *f = NULL; > + TAILQ_FOREACH(f, &rte_bus_scan_failure_list, next) { > + cb(f->bus, f->ret); > + } > +} > + > +/* Seek through probe failures */ > +void > +rte_bus_probe_errors(rte_bus_error_callback cb) > +{ > + struct rte_bus_failure *f = NULL; > + TAILQ_FOREACH(f, &rte_bus_probe_failure_list, next) { > + cb(f->bus, f->ret); > + } > +} > + > /* Probe all devices of all buses */ > int > rte_bus_probe(void) > @@ -100,7 +154,7 @@ rte_bus_probe(void) > if (ret) { > RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n", > bus->name); > - return ret; > + rte_bus_append_failed_probe(bus, ret); > } > } > > @@ -109,7 +163,7 @@ rte_bus_probe(void) > if (ret) { > RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n", > vbus->name); > - return ret; > + rte_bus_append_failed_probe(bus, ret); > } > } > > diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h > index 6fb0834..daddb28 100644 > --- a/lib/librte_eal/common/include/rte_bus.h > +++ b/lib/librte_eal/common/include/rte_bus.h > @@ -231,6 +231,20 @@ void rte_bus_register(struct rte_bus *bus); > */ > void rte_bus_unregister(struct rte_bus *bus); > > +typedef void (*rte_bus_error_callback)(struct rte_bus *bus, int err); > + > +/** > + * Search through all buses, invoking cb for each bus which reports scan > + * error. > + */ > +void rte_bus_scan_errors(rte_bus_error_callback cb); > + > +/** > + * Search through all buses, invoking cb for each bus which reports scan > + * error. > + */ > +void rte_bus_probe_errors(rte_bus_error_callback cb); > + > /** > * Scan all the buses. > * > I am assuming that that aim of this is to have a way so that application can query whether its device of interest is there or not. But, I think this (creating a list of scan errrors) would be overkill. Even if we were to create a list of errors from scan/probe, how would that help an application? Is there some specific use-case that you are hinting at? Application should worry about devices rather than how they are being detected (scan/probe etc). Application can use API like rte_eth_dev_get_port_by_name to query its specific device of interest. If the scan has failed, this API would be sufficient for the application to take counter-measures. Isn't that enough from a DPDK application perspective to move from init to I/O? I am not discounting that there might be some higher use-cases where this list might come of us - but I can't think of one right now and I can't comment on this proposal in absence of that understanding - sorry.