Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6230396rwd; Mon, 19 Jun 2023 04:29:43 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ50UNqJiAbvkRqIWGie73AdV80TTW7CQuNtHNYMI9jN+fUACKUe/1Z0qWttzF/j7SEwtMe6 X-Received: by 2002:a05:6a21:118c:b0:119:5af7:7cd2 with SMTP id oj12-20020a056a21118c00b001195af77cd2mr463948pzb.24.1687174183520; Mon, 19 Jun 2023 04:29:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687174183; cv=none; d=google.com; s=arc-20160816; b=pqRC2nRaXtpRb1ZTgGAV/+/FgjUuKa4yA3WEF5xjCR/rqUyTGsDuDkRMHy40UlAAZZ wT18gv32GUaQ14ahqgATP2JiiysCYCaIfiSeaEddhAEwDxDF5nh/W8LDaXOyh0xTJAsI Sowo/vHdNVCj6T3WE+tRNDhj4/C94Fe7EywRZvB6Wvtr4c5hMl6iffvmm7QsFLerWywV 6vRaxaBsPAjTpZ30mmmlYqsXxJmTczafFGPO2uTnWBhJfs9+28BdAkpA3ukJLLYdV1kb HGO9EDoAQH5HXSwetIqiB7tgnkO1HqTfv37qtJ6r7LxaSDxCLGD4L6RJIShqlHR2RP+V TOJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ACfdLduvpo39aBxZ+VT/qUTVLmOjSOUrCckJRvc8dEA=; b=HhtRrPOBRwZzqAO4d9/ZQ6ekHE4bSOXmoMg3FDOmi3AJpavMU4jUN+HQ47RaWSyZqv G214KuB2ufjmCGXHcgNMo7j30b+HQJ+N5PujeDosUVyyr3NnCDDuSj6FyTDe4KIE1DLc Vr+cPRfMbPBko2MXk6JYe2O7jTUUpRBgj4UkJJBMmfCjxhrHYchKn1g+naTZ4l2OoOEa 8ByJ/E3FesGZ5LVcI6t//YrYn72+tNG5WEvlb3dMpzsEanVqLxceVom9/vWqw1jsAM1D CUk1yxWYRsODY6bjlVnVryhM5HAv91k8x23K5irBN2hSb9vTo2VsWqNwsUeFmGrJ34Db D91Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eEfmVCM3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f5-20020aa79d85000000b0066666af4f74si10923560pfq.72.2023.06.19.04.29.29; Mon, 19 Jun 2023 04:29:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=eEfmVCM3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232462AbjFSLAW (ORCPT + 99 others); Mon, 19 Jun 2023 07:00:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232558AbjFSLAE (ORCPT ); Mon, 19 Jun 2023 07:00:04 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9B9B19B4 for ; Mon, 19 Jun 2023 03:58:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687172305; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ACfdLduvpo39aBxZ+VT/qUTVLmOjSOUrCckJRvc8dEA=; b=eEfmVCM3DCQR+p7cXHHFrJYh38yeFopWdW59P5RqkCoqhodS1QPOuC6Dn4KrDUvTrQp+LI TwqBkupQ9Epp5VAst4ASlPvr9FYqBEDDFGIDyzs/2OpezbJeZitR3jOVpJc3ja10hRxUiZ kMJ6tk0Kirgn6zZuAZY3zmjAbL42Gho= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-96-CXW5x-a_OUCulziiNLLqJw-1; Mon, 19 Jun 2023 06:58:20 -0400 X-MC-Unique: CXW5x-a_OUCulziiNLLqJw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AA91D101A52C; Mon, 19 Jun 2023 10:58:19 +0000 (UTC) Received: from swamp.redhat.com (unknown [10.45.224.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E076C1603B; Mon, 19 Jun 2023 10:58:17 +0000 (UTC) From: Petr Oros To: netdev@vger.kernel.org Cc: jesse.brandeburg@intel.com, anthony.l.nguyen@intel.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, michal.swiatkowski@linux.intel.com, jacob.e.keller@intel.com, intel-wired-lan@lists.osuosl.org, linux-kernel@vger.kernel.org, pmenzel@molgen.mpg.de Subject: [PATCH net v2] ice: Unregister netdev and devlink_port only once Date: Mon, 19 Jun 2023 12:58:13 +0200 Message-ID: <20230619105813.369912-1-poros@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since commit 6624e780a577fc ("ice: split ice_vsi_setup into smaller functions") ice_vsi_release does things twice. There is unregister netdev which is unregistered in ice_deinit_eth also. It also unregisters the devlink_port twice which is also unregistered in ice_deinit_eth(). This double deregistration is hidden because devl_port_unregister ignores the return value of xa_erase. [ 68.642167] Call Trace: [ 68.650385] ice_devlink_destroy_pf_port+0xe/0x20 [ice] [ 68.655656] ice_vsi_release+0x445/0x690 [ice] [ 68.660147] ice_deinit+0x99/0x280 [ice] [ 68.664117] ice_remove+0x1b6/0x5c0 [ice] [ 171.103841] Call Trace: [ 171.109607] ice_devlink_destroy_pf_port+0xf/0x20 [ice] [ 171.114841] ice_remove+0x158/0x270 [ice] [ 171.118854] pci_device_remove+0x3b/0xc0 [ 171.122779] device_release_driver_internal+0xc7/0x170 [ 171.127912] driver_detach+0x54/0x8c [ 171.131491] bus_remove_driver+0x77/0xd1 [ 171.135406] pci_unregister_driver+0x2d/0xb0 [ 171.139670] ice_module_exit+0xc/0x55f [ice] Fixes: 6624e780a577 ("ice: split ice_vsi_setup into smaller functions") Signed-off-by: Petr Oros --- v2: reword subject v1: https://lore.kernel.org/netdev/20230619084948.360128-1-poros@redhat.com/ --- drivers/net/ethernet/intel/ice/ice_lib.c | 27 ------------------------ 1 file changed, 27 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_lib.c b/drivers/net/ethernet/intel/ice/ice_lib.c index 11ae0e41f518a1..284a1f0bfdb545 100644 --- a/drivers/net/ethernet/intel/ice/ice_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_lib.c @@ -3272,39 +3272,12 @@ int ice_vsi_release(struct ice_vsi *vsi) return -ENODEV; pf = vsi->back; - /* do not unregister while driver is in the reset recovery pending - * state. Since reset/rebuild happens through PF service task workqueue, - * it's not a good idea to unregister netdev that is associated to the - * PF that is running the work queue items currently. This is done to - * avoid check_flush_dependency() warning on this wq - */ - if (vsi->netdev && !ice_is_reset_in_progress(pf->state) && - (test_bit(ICE_VSI_NETDEV_REGISTERED, vsi->state))) { - unregister_netdev(vsi->netdev); - clear_bit(ICE_VSI_NETDEV_REGISTERED, vsi->state); - } - - if (vsi->type == ICE_VSI_PF) - ice_devlink_destroy_pf_port(pf); - if (test_bit(ICE_FLAG_RSS_ENA, pf->flags)) ice_rss_clean(vsi); ice_vsi_close(vsi); ice_vsi_decfg(vsi); - if (vsi->netdev) { - if (test_bit(ICE_VSI_NETDEV_REGISTERED, vsi->state)) { - unregister_netdev(vsi->netdev); - clear_bit(ICE_VSI_NETDEV_REGISTERED, vsi->state); - } - if (test_bit(ICE_VSI_NETDEV_ALLOCD, vsi->state)) { - free_netdev(vsi->netdev); - vsi->netdev = NULL; - clear_bit(ICE_VSI_NETDEV_ALLOCD, vsi->state); - } - } - /* retain SW VSI data structure since it is needed to unregister and * free VSI netdev when PF is not in reset recovery pending state,\ * for ex: during rmmod. -- 2.41.0