From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id 5F4431B00B for ; Wed, 13 Dec 2017 22:55:58 +0100 (CET) Received: by mail-wm0-f66.google.com with SMTP id b199so7839643wme.1 for ; Wed, 13 Dec 2017 13:55:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=d3SbLx5fhSNNg2bsJp2xyD6QD0yXO6K7c8QPkXyJDKU=; b=jLHsn1ZoOyDh/I5nzo04WlQt0kUH5b25DgPK551iOU8Cqfwro/PETFKxB5ENbNM83B 7WlFfgC+VoiNr5x++BfTYHQS4HgZIXN9dgnbsBYKyTyLf14+whPtClH9R4tckzE6TCbJ TbILxnFkZanoJnszTb8IFdg3xOPdo/ISx0V5Nxi51en3V+V1OzH5E/62M69Yfkti4AyL 15GnMupcxAol6g1SN9rad6Er/usrDlTw4VvIOsTTCBaRH7u/G5v6gHXNAJNC2oMfkF+M 21PepRpaXjYVXD/YDgVCZDH6Nd+ii/7olHAcWtE58z3VP3wB76vOH5ctznT0HlPLQQj5 M11w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=d3SbLx5fhSNNg2bsJp2xyD6QD0yXO6K7c8QPkXyJDKU=; b=nV8AW6cXcbcQIlYmwyYHdj5TCX1FbZvrFN0Hg4NJR3VkweA+Z2AkMYWeEiEUjTqVGj I8ePQhjLbLG9ImhCcjEMqEgUUUlXbup1LxSpiFGo7FhYZXR+EQ2nNIfyi8ZtDoAplPsu FJPiffPRu7Ttl2Jk7k4LYAfZUZxCg4oX8/Tm78iZ18QSVOj8uF9l6C+HnkH/csvTJZkZ 2FnUgqySYJDdlieC6/xcjwcAUW9lbX8z0NrnKSg1ROu9cRm/BCd4Gjoz8fuNduw3JVQx EJlFWX2hpXMDjYv2IAd3rGSovCkQTpXQ9dxj+3HaB7c2bnUTVSfz9hyVFofU5m1cADds MiGw== X-Gm-Message-State: AKGB3mJ02F15fgb+jY8aelx3jREHOZ5ec84AtbUzztYjBrfnl+K8Knxv fdR8Cr3MbfK5cmWVYbMCLeIOBQZD X-Google-Smtp-Source: ACJfBotHhHcZOF0PKXxT+Lj6jwaJtlVKaCnCn/IJuPPMPQ4P+nyYbBzV1TsfTougUJRcRGbeu9dadg== X-Received: by 10.28.241.10 with SMTP id p10mr337107wmh.131.1513202157858; Wed, 13 Dec 2017 13:55:57 -0800 (PST) Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id n74sm19651392wmi.1.2017.12.13.13.55.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Dec 2017 13:55:57 -0800 (PST) Date: Wed, 13 Dec 2017 22:55:45 +0100 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Matan Azrad Cc: Adrien Mazarguil , Thomas Monjalon , "dev@dpdk.org" , "stable@dpdk.org" Message-ID: <20171213215545.kywwximn2g5xm5x5@bidouze.vm.6wind.com> References: <1509637324-13525-1-git-send-email-matan@mellanox.com> <1513175370-16583-1-git-send-email-matan@mellanox.com> <1513175370-16583-5-git-send-email-matan@mellanox.com> <20171213151641.g42zr7zupbsdgxsv@bidouze.vm.6wind.com> <20171213160916.e3rmxmhfhqz72wco@bidouze.vm.6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20171213160916.e3rmxmhfhqz72wco@bidouze.vm.6wind.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-stable] [PATCH v2 4/4] net/failsafe: fix removed device handling X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Dec 2017 21:55:58 -0000 Hi again Matan, On Wed, Dec 13, 2017 at 05:09:16PM +0100, Gaëtan Rivet wrote: > On Wed, Dec 13, 2017 at 03:48:46PM +0000, Matan Azrad wrote: > > Hi Gaetan > > Thanks for the review. > > Some comments.. > > > > > -----Original Message----- > > > From: Gaëtan Rivet [mailto:gaetan.rivet@6wind.com] > > > Sent: Wednesday, December 13, 2017 5:17 PM > > > To: Matan Azrad > > > Cc: Adrien Mazarguil ; Thomas Monjalon > > > ; dev@dpdk.org; stable@dpdk.org > > > Subject: Re: [PATCH v2 4/4] net/failsafe: fix removed device handling > > > > > > Hi Matan, > > > > > > On Wed, Dec 13, 2017 at 02:29:30PM +0000, Matan Azrad wrote: > > > > There is time between the physical removal of the device until > > > > sub-device PMDs get a RMV interrupt. At this time DPDK PMDs and > > > > applications still don't know about the removal and may call > > > > sub-device control operation which should return an error. > > > > > > > > In previous code this error is reported to the application contrary to > > > > fail-safe principle that the app should not be aware of device removal. > > > > > > > > Add an removal check in each relevant control command error flow and > > > > prevent an error report to application when the sub-device is removed. > > > > > > > > Fixes: a46f8d5 ("net/failsafe: add fail-safe PMD") > > > > Fixes: b737a1e ("net/failsafe: support flow API") > > > > Cc: stable@dpdk.org > > > > > > > > > > This patch is not a fix. > > > It relies on an eth_dev API evolution. Without this evolution, this patch is > > > meaningless and would break compilation if backported in stable branch. > > > > > > > It is a fix because the bug is finally solved by this patch. > > I agree that it cannot be backported itself, but maybe all the series should be backported. > > Other idea: > > Add new patch which documents the bug and backport it. > > Remove it in this patch and remove cc stable from it. > > What do you think? > > > > I think you could write a crude version that would not rely on the > ethdev evolution (checking sdev->remove only), which would be incomplete > but still better than nothing. > And why not in this patch document the issue. > Without any dependency outside failsafe, this could be backported. > > Then complete the fix with the API evolution if the new devops is > accepted. > > > > Please remove those tags. > > > > > > > Signed-off-by: Matan Azrad > > > > --- > > > > drivers/net/failsafe/failsafe_flow.c | 18 ++++++++++------- > > > > drivers/net/failsafe/failsafe_ops.c | 34 ++++++++++++++++++++++----- > > > ------ > > > > drivers/net/failsafe/failsafe_private.h | 10 ++++++++++ > > > > 3 files changed, 44 insertions(+), 18 deletions(-) > > > > > > < ... > > > > > > > > +/* > > > > + * Check if sub device was removed. > > > > + */ > > > > +static inline int > > > > +fs_is_removed(struct sub_device *sdev) { > > > > + if (sdev->remove == 1 || rte_eth_dev_is_removed(PORT_ID(sdev)) > > > != 0) > > > > + return 1; > > > > + return 0; > > > > +} > > > > > > Have you considered adding this check within the subdev iterator itself? > > > I think it would prevent you from having to add it to each return value > > > checks. > > > > > > It is still MT-unsafe anyway. > > > > > > > This fix doesn't come to solve the MT issue, It comes to solve the error report to application because of removal. > > Adding the check in subdev iterator doesn't make sense for this issue. > > > > Matan. > > If you add this check in the iterator itself, you would skip removed > devices before attempting operating upon them, right? > > Then it should probably help with your issue, unless you tested it and > verified that it didnt? > > Something like this: > > ---8<--- > > diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h > index d81cc3ca6..62ddc0689 100644 > --- a/drivers/net/failsafe/failsafe_private.h > +++ b/drivers/net/failsafe/failsafe_private.h > @@ -316,8 +316,12 @@ fs_find_next(struct rte_eth_dev *dev, > subs = PRIV(dev)->subs; > tail = PRIV(dev)->subs_tail; > while (sid < tail) { > + if (min_state > DEV_PROBED && > + fs_is_removed(&sub[sid])) > + goto next; > if (subs[sid].state >= min_state) > break; > +next: > sid++; > } > *sid_out = sid; > > --->8--- > > Only issue being that it is completely racy, but as this MT-unsafe property is > inescapable we might as well ignore it and go for KISS. > > If that's enough, I would prefer instead of having this additional check > added to all rte_eth operations. > Ok, actually you were right here to do it this way. The "is_removed" check needs to happen after the operation attempt to effectively mitigate the possible race. Checking before attempting the call will be much less effective. That being said, would it be cleaner to have eth_dev ops return -ENODEV directly, and check against it within fail-safe? -- Gaëtan Rivet 6WIND