From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f193.google.com (mail-wr0-f193.google.com [209.85.128.193]) by dpdk.org (Postfix) with ESMTP id 56AE4231E for ; Thu, 13 Jul 2017 21:44:27 +0200 (CEST) Received: by mail-wr0-f193.google.com with SMTP id y28so5578600wrd.2 for ; Thu, 13 Jul 2017 12:44:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=pxyFR7qarjmYfAUr9emVSTIH971UNKqT84Ctt+cseUE=; b=jdLrZV9j0oiAMqEEiIgVFfS+77oDF8bqViJMLkMcLk1/udsCsaZofX9rN0hnj27sd8 s0glRdParpGKwtpFz52CKLNHziMIsPX1r4Z6lHqFM4uR4BpQrPg8fuUHx+0i3fxlsA+O MpF3RGn1Q0ivGp4CidIgw/7+xAq1mY13jDB/6xtG4xl2GoXQPU3ZvT0X+Kl6y2/8DkiB Q/rEcLAOecLDJMozXKPPldYIsPjX8EORhNtlsrkukLPWJ2fR+b45+FvNQk4I/T2drPaL +qtINQjyCbsHMz3yoXJaLg35ihrwkSoJgQZ85eHw7oApPNiRUOYhu+GSg4x5KaS9cA9p M+VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=pxyFR7qarjmYfAUr9emVSTIH971UNKqT84Ctt+cseUE=; b=Xpxvw/ICWyPAjoyB1koptv5pIoZ3/i3BMLkwWkBuOJZ3AZUnzaXDpxTvD36MAFf4C/ zqvlAC7RrpHOoPG0PWjloq5c1oevq3L63izyrve6s5pBj1lttLJWAYqpAXJ3vKXdXk1q Q3msZx4o81Yl5ez4M5pBn6p4ZhD6yHLzDgcrAOXeN0A+oP3eoY/gsRdCOKImXkE1kkyi KUYS10xaMRKZAYYqdfjYUeXNHX8Wcda4jAVHjgS0BzT5sSb5qLtcLHGOEJw0TIxawYcE cwKX9IFGwYmuGj3VbmnyebXvWuITWBf1oxmCky1HyYWtI44iWWX5UboAOrkSyNt9o/RT jj3w== X-Gm-Message-State: AIVw113X/lAbps9IEhQue8W1dmYdGJMYzjQJwm4KS6ZcV0izA6dq/9S0 /+MawmVpWIb+NefaffiMCQXWVqp2wg== X-Received: by 10.223.178.9 with SMTP id u9mr992120wra.180.1499975066964; Thu, 13 Jul 2017 12:44:26 -0700 (PDT) MIME-Version: 1.0 Sender: jblunck@gmail.com Received: by 10.28.45.210 with HTTP; Thu, 13 Jul 2017 12:44:26 -0700 (PDT) In-Reply-To: <20170712172018.GD11154@bidouze.vm.6wind.com> References: <9885513c0b9107505bc8c61a40a1236533e9b7b4.1499814957.git.gaetan.rivet@6wind.com> <20170712172018.GD11154@bidouze.vm.6wind.com> From: Jan Blunck Date: Thu, 13 Jul 2017 15:44:26 -0400 X-Google-Sender-Auth: xQNZvV4WWOgvqdSoTyz6nO5XcQg Message-ID: To: =?UTF-8?Q?Ga=C3=ABtan_Rivet?= Cc: dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH v3 3/8] devargs: introduce insert function 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, 13 Jul 2017 19:44:27 -0000 On Wed, Jul 12, 2017 at 1:20 PM, Ga=C3=ABtan Rivet = wrote: > On Wed, Jul 12, 2017 at 04:20:48AM -0400, Jan Blunck wrote: >> On Tue, Jul 11, 2017 at 7:25 PM, Gaetan Rivet w= rote: >> > Some buses will operate either in whitelist or blacklist mode. >> > This mode is currently passed down by the rte_eal_devargs_add function >> > with the devtype argument. >> > >> > When inserting devices using the hotplug API, the implicit assumption = is >> > that this device is being whitelisted, meaning that it is explicitly >> > requested by the application to be used. This can conflict with the >> > initial bus configuration. >> >> Actually I don't think that this is correct. If I blacklist a device >> via devargs I don't want this to be probed in case my udev helper is >> calling hotplug add. >> > > This would be good for a udev handler yes. But should we expect this > behavior from all potential hotplug initiators? > > To put it another way: should this rule be enforced at the EAL level or > from those using it? And is it impossible to imagine a system that would > actually need to be able to update a device, changing it from > blacklisted to whitelisted on some specific condition? > > The fail-safe at least makes use of this ability. This is at the moment > the only hotplug user. > In tree .... I have hotplug functionality available for quite some time alr= eady. >> Maybe it is better to just update the args field in case the devargs >> instance is already found. >> >> > >> > While the rte_eal_devargs_add API is being deprecated soon, it cannot >> > be modified at the moment to accomodate this situation. >> > As such, this new experimental API offers a bare interface for inserti= ng >> > rte_devargs without directly manipulating the global rte_devargs list. >> > >> > This new function expects a fully-formed rte_devargs, previously parse= d >> > and allocated. >> > >> > It does not check whether the new rte_devargs is compatible with curre= nt >> > bus configuration, but will replace any eventual existing one for the = same >> > device, allowing the hotplug operation to proceed. i.e. a previously >> > blacklisted device can be redefined as being whitelisted. >> > >> > Signed-off-by: Gaetan Rivet >> > --- >> > lib/librte_eal/bsdapp/eal/rte_eal_version.map | 1 + >> > lib/librte_eal/common/eal_common_devargs.c | 12 ++++++++++++ >> > lib/librte_eal/common/include/rte_devargs.h | 13 +++++++++++++ >> > lib/librte_eal/linuxapp/eal/rte_eal_version.map | 1 + >> > 4 files changed, 27 insertions(+) >> > >> > diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librt= e_eal/bsdapp/eal/rte_eal_version.map >> > index 40cd523..8b24309 100644 >> > --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map >> > +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map >> > @@ -206,6 +206,7 @@ DPDK_17.08 { >> > EXPERIMENTAL { >> > global: >> > >> > + rte_eal_devargs_insert; >> > rte_eal_devargs_parse; >> > rte_eal_devargs_remove; >> > rte_eal_hotplug_add; >> > diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_e= al/common/eal_common_devargs.c >> > index bcdee13..ff6c2a8 100644 >> > --- a/lib/librte_eal/common/eal_common_devargs.c >> > +++ b/lib/librte_eal/common/eal_common_devargs.c >> > @@ -138,6 +138,18 @@ rte_eal_devargs_parse(const char *dev, struct rte= _devargs *da) >> > return 0; >> > } >> > >> > +int >> > +rte_eal_devargs_insert(struct rte_devargs *da) >> > +{ >> > + int ret; >> > + >> > + ret =3D rte_eal_devargs_remove(da->bus->name, da->name); >> > + if (ret < 0) >> > + return ret; >> > + TAILQ_INSERT_TAIL(&devargs_list, da, next); >> > + return 0; >> > +} >> > + >> > /* store a whitelist parameter for later parsing */ >> > int >> > rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str= ) >> > diff --git a/lib/librte_eal/common/include/rte_devargs.h b/lib/librte_= eal/common/include/rte_devargs.h >> > index 36453b6..7b63fa3 100644 >> > --- a/lib/librte_eal/common/include/rte_devargs.h >> > +++ b/lib/librte_eal/common/include/rte_devargs.h >> > @@ -139,6 +139,19 @@ rte_eal_devargs_parse(const char *dev, >> > struct rte_devargs *da); >> > >> > /** >> > + * Insert an rte_devargs in the global list. >> > + * >> > + * @param da >> > + * The devargs structure to insert. >> > + * >> > + * @return >> > + * - 0 on success >> > + * - Negative on error. >> > + */ >> > +int >> > +rte_eal_devargs_insert(struct rte_devargs *da); >> > + >> > +/** >> > * Add a device to the user device list >> > * >> > * For PCI devices, the format of arguments string is "PCI_ADDR" or >> > diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/lib= rte_eal/linuxapp/eal/rte_eal_version.map >> > index a8ee349..81f6af3 100644 >> > --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map >> > +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map >> > @@ -211,6 +211,7 @@ DPDK_17.08 { >> > EXPERIMENTAL { >> > global: >> > >> > + rte_eal_devargs_insert; >> > rte_eal_devargs_parse; >> > rte_eal_devargs_remove; >> > rte_eal_hotplug_add; >> > -- >> > 2.1.4 >> > > > -- > Ga=C4=97tan Rivet > 6WIND