From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A6589A0540; Mon, 14 Nov 2022 11:20:17 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4772940150; Mon, 14 Nov 2022 11:20:17 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id C06854014F for ; Mon, 14 Nov 2022 11:20:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1668421215; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qEs3Xe9o9CWpdIQ2YIAjtCPnRU2bAEJw7Lu4bzJFAuc=; b=aMIEnlU9uYH5Qf7dMhKBGbJ+itr+bkYf+IICPlClVpF7rDNItBB95BM2h8j/4guZLbsh0T NaR3FgOYFwpQBs9PuNeq/xGrmtK2PuFF2m1ZoklNwd7tY/kw+TbV612nusgkUm20LIe9Oq D/bXzZWLggEmF2cxaHxUU+dNk6ScCjQ= Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-166-3xTwHX_aOoiQkub0rhSDyA-1; Mon, 14 Nov 2022 05:20:13 -0500 X-MC-Unique: 3xTwHX_aOoiQkub0rhSDyA-1 Received: by mail-pl1-f199.google.com with SMTP id c7-20020a170903234700b0018729febd96so8669083plh.19 for ; Mon, 14 Nov 2022 02:20:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=qEs3Xe9o9CWpdIQ2YIAjtCPnRU2bAEJw7Lu4bzJFAuc=; b=RIumf+bHoO5d3xeRx5XIyrD1YueVK6uhoX7i8SeNZ1AE9RCddSD2ufYEAswewuGrv3 D5JFJR1RCOkB0hs/+IqkSsTs2gt4fo2d5IYFBVoxir+McgvyGFyAOghEnTiURBi4hX8J 7k9sAkWLFGUZw4DckWA4uYhJoSBbPb0bs9EFXjY2dFP2mSIBmVXzQ02t+M3tlEB3Ouby 77WDZ703fid/jigWYYobTRguD9FTMACJ72VMI/Gm2hL8SZv0OVSY70MYM2/b1NWbLhUm eT6GvI4d3548LmgE8KvGx2RURK0AazmVTa2XYNU+PZkir8sCsjUmeGy+nat+Y34nDoqM ycUg== X-Gm-Message-State: ANoB5pnWlp0s/X+kYEft1mrbsTLsAoLiIY+jSgCqCirDoYrZvLdsRP0K YK1PINcGkhS3gHq7JVnnyxCzNM9PnnuQCVr6JCpxHNrZUuf0ufJZiSyVDnvb64OOhIg4XgOGtO2 gESIyPbyclY7hPqW4wws= X-Received: by 2002:a17:90a:53a6:b0:212:bf31:d00 with SMTP id y35-20020a17090a53a600b00212bf310d00mr12971185pjh.33.1668421212942; Mon, 14 Nov 2022 02:20:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf4d44f5DXlBeQ6R3pxSBqk7ETS4VTa+Y1OwbdXvpqiUA/aumAY1ieLtEJIy/7KKRNKyCjc81xKjRa+1EslrCO0= X-Received: by 2002:a17:90a:53a6:b0:212:bf31:d00 with SMTP id y35-20020a17090a53a600b00212bf310d00mr12971165pjh.33.1668421212684; Mon, 14 Nov 2022 02:20:12 -0800 (PST) MIME-Version: 1.0 References: <20221109145356.779649-1-bingz@nvidia.com> In-Reply-To: <20221109145356.779649-1-bingz@nvidia.com> From: David Marchand Date: Mon, 14 Nov 2022 11:20:00 +0100 Message-ID: Subject: Re: [PATCH v2] bus/auxiliary: prevent device from being probed again To: Bing Zhao Cc: parav@nvidia.com, xuemingl@nvidia.com, andrew.rybchenko@oktetlabs.ru, thomas@monjalon.net, dev@dpdk.org, matan@nvidia.com, rasland@nvidia.com, stable@dpdk.org, Gregory Etelson X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Wed, Nov 9, 2022 at 3:54 PM Bing Zhao wrote: > > The device on auxiliary bus doesn't support being probed again > without being removed firstly. The PMD will detect and return error > for this unsupported operation. Some of the resources would be > cleared wrongly. When quitting, there will be unexpected error like > crash. > > To prevent this, the device driver will be checked before probing a > device. > > Fixes: 1afce3086cf4 ("bus/auxiliary: introduce auxiliary bus") > CC: stable@dpdk.org > > Signed-off-by: Bing Zhao > Reviewed-by: Gregory Etelson > Reviewed-by: Matan Azrad > --- > v2: fix typo > --- > drivers/bus/auxiliary/auxiliary_common.c | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/drivers/bus/auxiliary/auxiliary_common.c b/drivers/bus/auxiliary/auxiliary_common.c > index 6bb1fe7c96..8bc9f20f1b 100644 > --- a/drivers/bus/auxiliary/auxiliary_common.c > +++ b/drivers/bus/auxiliary/auxiliary_common.c > @@ -89,6 +89,7 @@ rte_auxiliary_probe_one_driver(struct rte_auxiliary_driver *drv, > { > enum rte_iova_mode iova_mode; > int ret; > + bool already_probed; > > if (drv == NULL || dev == NULL) > return -EINVAL; > @@ -116,6 +117,13 @@ rte_auxiliary_probe_one_driver(struct rte_auxiliary_driver *drv, > return -EINVAL; > } > > + already_probed = rte_dev_is_probed(&dev->device); > + if (already_probed) { No need for this variable, I removed it when applying. For consistency with other bus code, I also moved this check before the IOVA validation. > + RTE_LOG(DEBUG, EAL, "Device %s is already probed on auxiliary bus\n", > + dev->device.name); > + return -EEXIST; > + } > + > /* Allocate interrupt instance */ > dev->intr_handle = > rte_intr_instance_alloc(RTE_INTR_INSTANCE_F_PRIVATE); > -- > 2.21.0 > Applied, thanks. -- David Marchand