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 6F381A0543; Tue, 4 Oct 2022 17:28:53 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1C4E140DDC; Tue, 4 Oct 2022 17:28:53 +0200 (CEST) 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 481D040A79 for ; Tue, 4 Oct 2022 17:28:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664897330; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=b2McIusG3W6eHVajGJ7cl0hT0Pycs4c4tHU4oA62F5k=; b=PvlLQDn/YOHSWtz0hY2ajAPW+TNFI2aA8Beppg7EcQba9iOX5c9i5U6GjFO6Jlqp72x17J NgQ+FkzZXG43IjVwBIjT4y6UGgJfadex9VIxabZkWIQ28+Q0SfbrFF/EaPRwM0FSDaiHFE ln0BSEj9LaJhexpZJLsB1WQfmvIySlw= Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-636-MJP7GjkTPZ2Op9C34PCAxQ-1; Tue, 04 Oct 2022 11:28:49 -0400 X-MC-Unique: MJP7GjkTPZ2Op9C34PCAxQ-1 Received: by mail-pj1-f71.google.com with SMTP id pc10-20020a17090b3b8a00b00202be8d81d2so13158373pjb.1 for ; Tue, 04 Oct 2022 08:28:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date; bh=b2McIusG3W6eHVajGJ7cl0hT0Pycs4c4tHU4oA62F5k=; b=taUcagy253RRpVPGBh+er/j1curG03VZawoizQOAuAjWsQdRMs3R67/7b2uTygGkle bdM1JEE+hLik5hi6/63S901MCO25Ahud9tWvCPPLUXVsqdf8Axi2ZTxHeNi4Tj/uqKNl cY3bOrU/XJ/N+es27Zm7wxtlZ/jqKo0c8lvjhV4jRWEuiXN2tBItc4Ata9r63d6DSfur 2k4y0mYwlb/fxDU7Yh+EWUROgFpXJNzfO5l4Xm2UHp8bE0KcrhDrXn9A/KaKFWvNXZ0G 3MX7TQ91c/AxC2NNuwZ4Hk+thEsdoTjMQhXTov/aPb7X4JUKv8goA9b4OxiGcMjZ7hAs JYxQ== X-Gm-Message-State: ACrzQf26X9WXlfZFCBSV9J9S6FSzu7O8jFJcOIsd0wvz0vtSvALb/HcB /H1XQJdPZr6ojVwjsWBkMeO95+BcTzCd9kXNDyW64eQwYh8Ou/x+eMnokf4raxZUGhlzVirH8g4 07OPprxvSRYLUbe6K/cg= X-Received: by 2002:a17:903:2302:b0:178:286c:86a8 with SMTP id d2-20020a170903230200b00178286c86a8mr26329982plh.172.1664897328393; Tue, 04 Oct 2022 08:28:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM63416lDexYQqq8R3ExwLrpitcK/+McbGs3Ma8w15mQi6FOu1ssibd5S1bUyiRbj8Bdm5NevtYIrZDGf08/CYM= X-Received: by 2002:a17:903:2302:b0:178:286c:86a8 with SMTP id d2-20020a170903230200b00178286c86a8mr26329965plh.172.1664897328079; Tue, 04 Oct 2022 08:28:48 -0700 (PDT) MIME-Version: 1.0 References: <20220419161438.1837860-1-kevin.laatz@intel.com> <20221004131128.919267-1-kevin.laatz@intel.com> In-Reply-To: <20221004131128.919267-1-kevin.laatz@intel.com> From: David Marchand Date: Tue, 4 Oct 2022 17:28:36 +0200 Message-ID: Subject: Re: [PATCH v8] eal: add bus cleanup to eal cleanup To: Kevin Laatz Cc: dev@dpdk.org, bruce.richardson@intel.com, mb@smartsharesystems.com, lizh@nvidia.com, matan@nvidia.com, stephen@networkplumber.org, lihuisong@huawei.com, Jerin Jacob Kollanukkaran , Sunil Kumar Kori X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 Tue, Oct 4, 2022 at 3:08 PM Kevin Laatz wrote: > > During EAL init, all buses are probed and the devices found are > initialized. On eal_cleanup(), the inverse does not happen, meaning any > allocated memory and other configuration will not be cleaned up > appropriately on exit. > > Currently, in order for device cleanup to take place, applications must > call the driver-relevant functions to ensure proper cleanup is done befor= e > the application exits. Since initialization occurs for all devices on the > bus, not just the devices used by an application, it requires a) > application awareness of all bus devices that could have been probed on t= he > system, and b) code duplication across applications to ensure cleanup is > performed. An example of this is rte_eth_dev_close() which is commonly us= ed > across the example applications. > > This patch proposes adding bus cleanup to the eal_cleanup() to make EAL's > init/exit more symmetrical, ensuring all bus devices are cleaned up > appropriately without the application needing to be aware of all bus type= s > that may have been probed during initialization. > > Contained in this patch are the changes required to perform cleanup for > devices on the PCI bus and VDEV bus during eal_cleanup(). There would be = an > ask for bus maintainers to add the relevant cleanup for their buses since > they have the domain expertise. > > Signed-off-by: Kevin Laatz > Acked-by: Morten Br=C3=B8rup > Reviewed-by: Bruce Richardson > Thanks for the rebase. Most of it lgtm, just one question/comment. [snip] > diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c > index a1bb5363b1..b9a7792c19 100644 > --- a/lib/eal/freebsd/eal.c > +++ b/lib/eal/freebsd/eal.c > @@ -896,6 +896,7 @@ rte_eal_cleanup(void) > rte_mp_channel_cleanup(); > rte_trace_save(); > eal_trace_fini(); > + eal_bus_cleanup(); > /* after this point, any DPDK pointers will become dangling */ > rte_eal_memory_detach(); > rte_eal_alarm_cleanup(); Do you have a reason to put the bus cleanup after the traces are stored and the trace subsystem is uninitialised? With the current location for eal_bus_cleanup(), it means that this function (and any code it calls) is not traceable. To be fair, I don't think we have any trace points in this code at the moment, but we might have in the future. --=20 David Marchand