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 7960AA0543; Tue, 4 Oct 2022 17:36:46 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5C7D040DDC; Tue, 4 Oct 2022 17:36:46 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 3F64640A79 for ; Tue, 4 Oct 2022 17:36:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664897804; x=1696433804; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=cSSeplrdPotxsFY1baIH4vaRMPtcOXoOFGxw4UauK7k=; b=UgHeEQ/AHyNdZcEUbdDfxOFD0MOYy2SJoNGp7mrG5nqJkyhhstDdRbfD ASWjvPtWfjkpTFj64TerJWpI8yqSffHwEN0EfTlApYbsXROGQ6krVXcXj xXrSYnQrkrMtVehJZSlXWSMs5QE5J+mr1SFCWGJyJiB08a/i7LoHmhs5p SM5WRcbYL4a09AmSmoRfQ67TzN2z7WtVjqpGcV9kdrGyWNb7i9NkuM2tz 9T08nXNzoxcPBp21Fj/Iuos9Yyhky7gIwutR0Prqn+3NyyeFZu4uEpAEz oM9VAVS2oCvVNxwVJiutx37flWhc8rP8hq/Mu1ZkbkSZ2KDJD1dJqEm3C w==; X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="301662470" X-IronPort-AV: E=Sophos;i="5.95,158,1661842800"; d="scan'208";a="301662470" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Oct 2022 08:36:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10490"; a="657167286" X-IronPort-AV: E=Sophos;i="5.95,158,1661842800"; d="scan'208";a="657167286" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga001.jf.intel.com with ESMTP; 04 Oct 2022 08:36:42 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 4 Oct 2022 08:36:42 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Tue, 4 Oct 2022 08:36:42 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.100) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Tue, 4 Oct 2022 08:36:41 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GsaCFR4MCTYJhFrrSCkQ8RtcTNltJ7ucMPouqTJeDFXZjopbHtSWWcZX6VlT2PVHw/wXEbEfOeProPXHSTn7eeaZF39hBwgHN7WLDb5T2TmmJrgr4C5PhKhNBGdnc/NrzHLYQVb5h8U4qGyh6QITzESkg4fnUADlnUur7dGNxOvjZfRwhcrIb/MDv6ZfoKRhSzAM6WRazrIL4psjq13F3ypOScLuig0r0Mv2m1CWgKPP0CcQ1flBa2ywcqOyOCd5Lq2V5RHLIVEZVEg0voqq/EB5vEQEowfuGTgko/T/nfeFSGD/2+2o6UWaIjJnK4kkhqZKXes/7cQOGvtAC70rSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vW1jxYjzDCv9hcEcms6IFGQBDZ7bVAhOfzZV6VTzXlE=; b=GFHCLifmvfNLTOCAKwIriFpidKQHau9rVpdpFtbd8P5ll0vTiva/KqGbwABleucTIy+ljEZwjrUD0GfxroKvGr6+5l5HFbYN0Nxe92LI9jZuKrhAAPaEbmlhJDRq+Zqu1IbA391j7m7RcAeLRjsZ5YStMmQYY/KFG8c2x13CxudjNYOsYsEJv4gpabnAG72uvtXrk/eAcNqWSnpbptxoqOdI+MnPLX0LkDVLNQyniAqXfQgaG/njFEi1xUpraXOwJmuYawz80RxktmrySlDHaiLSerwKwD4rcrDALjDNzrl/vQHpiXDw/jKNRBkBnJKQqiFP/B0sFUwYDZnF0pzr5w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MW4PR11MB5872.namprd11.prod.outlook.com (2603:10b6:303:169::14) by IA0PR11MB7282.namprd11.prod.outlook.com (2603:10b6:208:43a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.26; Tue, 4 Oct 2022 15:36:40 +0000 Received: from MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::c17d:f1c9:e958:b5e]) by MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::c17d:f1c9:e958:b5e%8]) with mapi id 15.20.5676.028; Tue, 4 Oct 2022 15:36:40 +0000 Message-ID: Date: Tue, 4 Oct 2022 16:36:33 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.3.1 Subject: Re: [PATCH v8] eal: add bus cleanup to eal cleanup To: David Marchand CC: , , , , , , , Jerin Jacob Kollanukkaran , "Sunil Kumar Kori" References: <20220419161438.1837860-1-kevin.laatz@intel.com> <20221004131128.919267-1-kevin.laatz@intel.com> Content-Language: en-US From: Kevin Laatz In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: LO4P265CA0026.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2ae::23) To MW4PR11MB5872.namprd11.prod.outlook.com (2603:10b6:303:169::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW4PR11MB5872:EE_|IA0PR11MB7282:EE_ X-MS-Office365-Filtering-Correlation-Id: 29be99ad-0f50-47c7-0083-08daa61e3b12 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SkV1kQhz1rGferOeboQPi30QNLiiWzFpnxLzblbr/xvxawmOPS5Xm4Olzs93IqmEgn4auuersS+gzkNfCY1GQTSAcJYSuI1ge/eCj8NQYi3r/3gK6/FkpnVKQwwILkh+4ZyAA6D7ihWn+kZq3AQ5fuqhpl8VY7AnxKRaqs+8Ss1DRvUYioZ4qSLClAWTs5IbyefDT+Y9P21UQ5z0ZoDf5fHJnkbuFwtKV+f5JlTkGerte7E2GBliu6Vfq0TMDPlcr/b2DhpuB3euQs/LKPJ/iEG9CTyXddXbPl0RdS+fqW0eq+gN6/+Rh/s1Bs+8YNRubq/u2OpWoZD6TMQ6vdXr+w9nYPHuH11G5+468xVV2T9F67Q4nDEzQRIvlVNB/tEeZyVN9SG6V7sWQ662BCl1WLZ7gb9sg2Mx3dH1/Le/4NKMtBEi3XnbOfblCm7qZs0chYplTVduViVvPni/nRPYXyWLt+BrT+ujZPnD+k/14FKTJne4kMQYBVAEyXUYip3w9Mct4/Hi4ynhF8050pzbOZazz3A1k7IDgAG712cb04RNVKvetdvTv41wKelHhGTM5PEwCPnIwsuFpEwxhE/Hczkw8hicq4GmgL7dPudip8PJ4BFjVYzCGS3cyydiv2ag14x/JDU9T4dEqbsE+X800BLIQxXmbtxjk5Msfbb35JLZ24GxXuDbVvYvWj/jTqKmZ2Q3x03+s11NLUd+qjnKhE8g5UyxmOtYrpAzKmtGdpbsYXpwjwA0j2lTjdakNYlsdzxrvKZGNxbagPgOjFjQQUx5JGNFXcUkiO/U2n6+1/A= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW4PR11MB5872.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(396003)(376002)(366004)(136003)(346002)(39860400002)(451199015)(38100700002)(478600001)(6486002)(86362001)(54906003)(316002)(6916009)(31696002)(8676002)(44832011)(2616005)(26005)(66946007)(6512007)(31686004)(66476007)(82960400001)(4326008)(66556008)(36756003)(83380400001)(8936002)(2906002)(53546011)(186003)(41300700001)(66574015)(6506007)(5660300002)(6666004)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?bWNiN0RmNHc1bnRRL2JpK3FCTjBsd3FjdnBJWXJ0ZEFGSGdnTUVZN2Q0NGxy?= =?utf-8?B?b0g1Wnh4VmdUUnd0d013djFzMmo2OW5RUHhOOWRGWitvSnkrdjlPQWhjRmxZ?= =?utf-8?B?TFh1enZIQUx0ZGdkejVnTEp0Y3R3NFFyKytNWG1MUTNteklrMjA5cDlGSTZy?= =?utf-8?B?TGtPTWFUdXJLWllFNWdHbDdITDlKNFpwNTRLNXNPV2MyeCtpcUtmTm4yZE1n?= =?utf-8?B?RlJOdVU2TDc4U1h6VkZTMytjdG9MYTh1b1lQbmU1dE5XQVlxT0V6NitiU1Mr?= =?utf-8?B?eXUzUkh1OEFtTUJyc1Q0UEpJWjNmQWZ4NTY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73qk5mxnANYxA4N8Q?= X-MS-Exchange-CrossTenant-Network-Message-Id: 29be99ad-0f50-47c7-0083-08daa61e3b12 X-MS-Exchange-CrossTenant-AuthSource: MW4PR11MB5872.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2022 15:36:39.8798 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: vUi77utYX5tlHi2yrD4j/Vari4gZjay3p0oOMBLOce17/lw6m+h/jw8xEA2ihQH0uIKCo6dV7wFc34Ub2gPVaQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR11MB7282 X-OriginatorOrg: intel.com 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 04/10/2022 16:28, David Marchand wrote: > 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 before >> 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 the >> system, and b) code duplication across applications to ensure cleanup is >> performed. An example of this is rte_eth_dev_close() which is commonly used >> 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 types >> 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ørup >> 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. No reason for doing it after trace un-init. I'll move and resend. Thanks!