From patchwork Tue Jul 6 08:56:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 95338 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0F5EDA0C47; Tue, 6 Jul 2021 10:57:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E9CF741246; Tue, 6 Jul 2021 10:57:00 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id 6131541247 for ; Tue, 6 Jul 2021 10:56:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625561818; 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; bh=p1RfpXonHxj5WzBZ462hdsEOqi91v+YVIxenry0IoJU=; b=TZhqMGNb3k9iisUILyUFJ+DiX7aQZKawRMcXqUiUgaakIQmKMvVRVQvf7YSu3VsHs7mBza J180chscIxrNnCmnr233hV2v3I5Kak6UZvUg4GWwEO/Jm0K2nCJmjM+EQMzDSksaLncndq ygW4jll5JXDJS6j+e2pjQB/1AZ558+E= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-243-0ahyyHeSOFKG704DbcJBig-1; Tue, 06 Jul 2021 04:56:55 -0400 X-MC-Unique: 0ahyyHeSOFKG704DbcJBig-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CBDEC687; Tue, 6 Jul 2021 08:56:53 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.192.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id EBAF05D9D5; Tue, 6 Jul 2021 08:56:50 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: haiyue.wang@intel.com, stable@dpdk.org, Qiming Yang , Qi Zhang , Paul M Stillwell Jr Date: Tue, 6 Jul 2021 10:56:43 +0200 Message-Id: <20210706085643.5088-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [dpdk-dev] [PATCH] net/ice: fix memzone leak when firmware is missing 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 Sender: "dev" Caught by our QE. When the firmware is missing, memzones were not released. $ dpdk-testpmd -c 0x1f -a 0:0:0.0 -- -i ... testpmd> dump_memzone ... Zone 6: name:, len:0x15040, virt:0x1661b24c0, socket_id:0, flags:0 physical segments used: addr: 0x140000000 iova: 0x140000000 len: 0x40000000 pagesz: 0x40000000 testpmd> port attach 0000:5e:00.0 Attaching a new port... EAL: Using IOMMU type 1 (Type 1) EAL: Probe PCI driver: net_ice (8086:159b) device: 0000:5e:00.0 (socket 0) ice_load_pkg(): failed to open file: /lib/firmware/intel/ice/ddp/ice.pkg ice_dev_init(): Failed to load the DDP package,Use safe-mode-support=1 to enter Safe Mode EAL: Releasing PCI mapped resource for 0000:5e:00.0 EAL: Calling pci_unmap_resource for 0000:5e:00.0 at 0x2200000000 EAL: Calling pci_unmap_resource for 0000:5e:00.0 at 0x2202000000 EAL: Driver cannot attach the device (0000:5e:00.0) EAL: Failed to attach device on primary process testpmd: Failed to attach port 0000:5e:00.0 testpmd> dump_memzone ... Zone 139: name:, len:0x1000, virt:0x1660ed800, socket_id:0, flags:0 physical segments used: addr: 0x140000000 iova: 0x140000000 len: 0x40000000 pagesz: 0x40000000 With 20 tries attaching a net/ice port, we would end up with: EAL: Probe PCI driver: net_ice (8086:159b) device: 0000:5e:00.0 (socket 0) EAL: memzone_reserve_aligned_thread_unsafe(): Number of requested memzone segments exceeds RTE_MAX_MEMZONE ice_dev_init(): Failed to initialize HW Fixes: a4c8c48fe3f4 ("net/ice: load OS default package") Cc: stable@dpdk.org Signed-off-by: David Marchand --- drivers/net/ice/ice_ethdev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 09e38590e5..f85c7cc8da 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -2085,7 +2085,7 @@ ice_dev_init(struct rte_eth_dev *dev) if (ad->devargs.safe_mode_support == 0) { PMD_INIT_LOG(ERR, "Failed to load the DDP package," "Use safe-mode-support=1 to enter Safe Mode"); - return ret; + goto err_init_fw; } PMD_INIT_LOG(WARNING, "Failed to load the DDP package," @@ -2175,6 +2175,8 @@ ice_dev_init(struct rte_eth_dev *dev) rte_free(dev->data->mac_addrs); dev->data->mac_addrs = NULL; err_init_mac: + ice_free_hw_tbls(hw); +err_init_fw: ice_sched_cleanup_all(hw); rte_free(hw->port_info); ice_shutdown_all_ctrlq(hw);