Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp4661428rwe; Tue, 30 Aug 2022 14:34:21 -0700 (PDT) X-Google-Smtp-Source: AA6agR45r+ZUXVnfCBMAhpcAd7dYCiLS1m7Ad9YBhLrCDMvo6IJFfsESTVjoNvmORfM7Alb03zAv X-Received: by 2002:a17:902:8f8a:b0:16f:975e:7c6e with SMTP id z10-20020a1709028f8a00b0016f975e7c6emr23228703plo.136.1661895261575; Tue, 30 Aug 2022 14:34:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1661895261; cv=pass; d=google.com; s=arc-20160816; b=T0gKN/WBDr56FAIxSx4mGdnIboqWBSbUwU7KZeYmoxvYcosv0OpWVAW2mPzbNVl6+/ YlSGyJPI1AHFY/sYSSoZR4Yj6L5DalKkpsRmIzUypmJCAS7YevJvPqoAwex0v4/nM35+ uykqIupGbiDCxay6olGi0eo5wvF2SmA7xOaGjHJLaaVDF/9pT0AegTy2/o9zmHdJwYDz KIigBK+mcJDRDkc4zsmsV9mIpVvfCCOCbe9wlTwLkWHuI/GLF2DZfqhuDbhmrW5WryrW z1hK/hMd/bpZbZgPubtURO5rZ3CteKUfcn6DhUMX15R6cuUo7KqJO+T+jlFQsZ5d8/GO 0kYA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :dlp-reaction:dlp-product:dlp-version:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=wMKRCKMMbFlifYaNWyK5ee1xcBjfWAVOXAHgv/LmcLw=; b=CBgFzmQwJR6+fx8v9Jl53pMc08qQ6bmMxgDTVDdYCUHyM8QDwVwuIjti0PJepWhM5r 8QFntrd2u8He7faaowqVRq3b3CxF0qNgkZBvyqzyXEe6HN/qND3PYLm++hPK+f1NXvQc fFQpneEWcFMnkxBHdWzOrBl3NW9VRc4h0gNHCdQyvwa/79wTqt/SQw+ZYJ/L/6rnyVZc NGFCrsNJCJd4maH1eXqg00dPme4QxiwVRNvl3/PdXFuUQsMBGTTwpWkR9s1ToB+jEw8A gu6SC069LhZ7PkXuXeTXBfHYYb9DzmA57+acHODXalmtX5+MxjnGORjRYw2dg5FGKYpK RFSw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cYqN3xA9; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s8-20020a056a0008c800b0052c82f9f61csi13399438pfu.239.2022.08.30.14.34.09; Tue, 30 Aug 2022 14:34:21 -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=@intel.com header.s=Intel header.b=cYqN3xA9; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230400AbiH3UuK (ORCPT + 99 others); Tue, 30 Aug 2022 16:50:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229629AbiH3UuG (ORCPT ); Tue, 30 Aug 2022 16:50:06 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5319116585; Tue, 30 Aug 2022 13:50:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661892605; x=1693428605; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=wg2Agm196/3dPHKJYqG4Si8O+l0vboBJE6EM73CHXXM=; b=cYqN3xA9Brmzme4gTOAt1Rf8hERJoP8YWL/NdepxfsODuskqYcHM8Ik1 YNcVAguGrbrlfTCr5gfXAD3MOSuOhkh2WS8ncIhYHMqYRra+jVysgWrpr 7+8AAiYin8A2SyMYA+do/0VQPTBhkjNITLN85z0fxovyX3+KyN1CUyXSy p/VAelyb3k5bWcf7IOV52IdWxdKN6d1YLzO77CYF+6sM1Fsw0cBUj2djA VZVrGyObPKrIZueaqSZW8WFmTMbaq0MCeaWKs66XAHpfBknZhsuCtqbP/ xyhEH7FcgrVfMRvcQZjieNHo9z9p3gqKarLnqyI4DZuptdhbscUugqNyr w==; X-IronPort-AV: E=McAfee;i="6500,9779,10455"; a="292874180" X-IronPort-AV: E=Sophos;i="5.93,276,1654585200"; d="scan'208";a="292874180" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Aug 2022 13:50:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,276,1654585200"; d="scan'208";a="588773256" Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by orsmga006.jf.intel.com with ESMTP; 30 Aug 2022 13:50:00 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 30 Aug 2022 13:49:59 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 30 Aug 2022 13:49:59 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx607.amr.corp.intel.com (10.18.126.87) 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, 30 Aug 2022 13:49:59 -0700 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (104.47.74.41) 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, 30 Aug 2022 13:49:58 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V4AztDSKQbu14BQu4K2WnZPgtSDOEevRZN6IbUtl/36NAW4IZqF+v64NcZxK/kycjoIXNtHcTqLD3XQcO/R1KZF5kEeA60Va1dkPSER9yoaV+hotJDyFaNnE0tTw2O1XAel39UznlwXjqar/epmRGrK1yA6Xe+owmaMNVV9CSZZSjZAsbf8NTeJMYLGiBhGzySBwhMSZw2+4oGfR4GmGPXpXM3KeuKK1sBhKmO1yVyTRMHIRjAeLQyNZdZmYPn5F9IqA0dhcwzn2I0JkYDVK9Iu9tfmy1GXXU+npVHoXMCFfnQEB8bLWWr0enJ3yjvAf0P4WcvtovASMTSoBadZv7g== 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=wMKRCKMMbFlifYaNWyK5ee1xcBjfWAVOXAHgv/LmcLw=; b=e9sbfGxlYZ06C+HQsizh5xFNiLavmF6VC/cpUgeKaa8AjioD1gX//3KkamkH0eLJXkrnGnBV0cprdX9cn9EjhZuM5g1V/aR0j6BtBbCY/zJmrktGyY94+3SPZXmQbeJkWXWp811yPntt68hHneXlDCSEcwjr572bRONB8b4Snk/Q1EfgOu86a9fnBHd4PZEHcbt8gFnCUtIDoytDS6R5LtaX2VP5u+17uRND/aSD0tgUhf0OzXnbzkljbPiKP2HHI4FV1N7/9E27X/XtDjB8DLJDGqWsMoqz6lspdk5vbnbdE9jqEUAC4yP1hRV2OydM55cH4kUVISmoLnEb3JJQTg== 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 Received: from DM6PR11MB3113.namprd11.prod.outlook.com (2603:10b6:5:69::19) by CY4PR11MB1608.namprd11.prod.outlook.com (2603:10b6:910:e::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5588.10; Tue, 30 Aug 2022 20:49:54 +0000 Received: from DM6PR11MB3113.namprd11.prod.outlook.com ([fe80::7100:8281:521b:ff31]) by DM6PR11MB3113.namprd11.prod.outlook.com ([fe80::7100:8281:521b:ff31%5]) with mapi id 15.20.5566.021; Tue, 30 Aug 2022 20:49:54 +0000 From: "Laba, SlawomirX" To: ivecera , "netdev@vger.kernel.org" CC: "Keller, Jacob E" , "Piotrowski, Patryk" , Vitaly Grinberg , "Brandeburg, Jesse" , "Nguyen, Anthony L" , "David S. Miller" , "Eric Dumazet" , Jakub Kicinski , Paolo Abeni , Jeff Kirsher , "moderated list:INTEL ETHERNET DRIVERS" , open list Subject: RE: [PATCH net v2] iavf: Detach device during reset task Thread-Topic: [PATCH net v2] iavf: Detach device during reset task Thread-Index: AQHYvEjhCJvnRrVNjEyX8LmyQxwL263H6JFw Date: Tue, 30 Aug 2022 20:49:54 +0000 Message-ID: References: <20220830081627.1205872-1-ivecera@redhat.com> In-Reply-To: <20220830081627.1205872-1-ivecera@redhat.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.6.500.17 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 7c53c1a2-df10-4fc4-fa8d-08da8ac93111 x-ms-traffictypediagnostic: CY4PR11MB1608:EE_ x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: pLX95oYJL28cWt1o0MxqIjFW5mJlkn0Kupulsjm2co0zr2kKMmNua+uTMDlzI6lE11DalMyDgIdcgbqQybz1fvGFA3/EIypQeR5Ycpsc7UmcGnsU4Mvy25G2n2yi5Qn01kXiH0PvQV8HjBmul7sDFOPgwzEbFBDctkrJlxxvwUOO778tZGTUJLK5m0pYpWX5aNbWzKVh7AfzmTayG+NPaDEeqsssn44shs1lf5VPZgpOgWcj678TTlqw2ppMjIOY2vkVM4ioqOGCl6idvgoarr3kJ5UIeiTpdw00OIQ0lYRECPAbNW9P1zUZ35JEvGLfMrY1Lrd170eyMl/zkpTGQgcTB1Emy7aguSCMIHkIMfl4/uvsCe7COcBdOzn7vA9Wgz6zEykvhZpjX3NrI84gRivxRqr/YygV7+6MlgaaFzWuK7URJgzS+jCiO58QhMbmTrDG0KOc8FXUGm5bjawOL6G75zv0aDVbE4OqfiBK+21RuxUohbPpaNB3d0QykJoaf6WhgSe8RuVRnFwybAWsdZW70qAsRwH7BtvWiTfVywOX2qgHh2fnNDEJEe+C90i0J22w0Wjoo2YVtRD8mboLQr3s+CbRcibbbZSQLdMLYcxyu5iFHP8msZtPHwv5//Bnxo1DUGh8sgdaKR4MLoPCD7X2VtUdWfIygallq8bFWz6tqe8XexSvn/Xyx0B06NndpRF/4FKr/gsVAcF+tR9g6MMYe+oPOEWHhxBvZ4jvclhh1nFHnIqhMjpTNcVHKr5CYPOOmnFHTjPd6Nx3iA6dKGGRzK4HWpfeJF/Cm9qoLHM= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR11MB3113.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(376002)(39860400002)(366004)(136003)(346002)(396003)(66446008)(76116006)(66556008)(478600001)(4326008)(966005)(66476007)(66946007)(316002)(110136005)(54906003)(8676002)(71200400001)(55016003)(2906002)(64756008)(5660300002)(52536014)(8936002)(38070700005)(82960400001)(122000001)(38100700002)(86362001)(33656002)(53546011)(6506007)(9686003)(7696005)(26005)(186003)(41300700001)(83380400001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Z5YR1I1Ve6bFDYYEkptn0BgHbIhpqj81znq0/yHqo81BywcLMdy6YFkjGi/D?= =?us-ascii?Q?JzCqnnZi1cqp6q7+fOaVHrKH/9qgXOIhtWwNYcSQiC3mWKEK/UulO8ilfL9D?= =?us-ascii?Q?kKml7MjUcyNbrukHFUTYFt7FAa8T5t5LrGXcgzp/pYqpMOjKm+b8Z7cdEbQE?= =?us-ascii?Q?aBDcvDK9kqF9ZrsLej9rBhDak3NYvEVSrwvvaqtroD49Y0nrQv5r0dK5+Onf?= =?us-ascii?Q?FYTl/nWSNjk4ZLeN/cVc889aRfn5+55kPNyp9LfgQDsEaik//rlISVkvy71P?= =?us-ascii?Q?LfdB9C4/kcRpivVa136hHoqJe5/A4UBqm543uDnKZyxHDsLXhKl9H95eUgv2?= =?us-ascii?Q?wWvVfvANOkROqMW1mEyyd84yi3qdfBbY+Ix8TglDQ7xlZr5ZSnUd8StuhBf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T9he1IGWr+PetTbhw7EBhNmKeoKBy?= =?us-ascii?Q?7oGmbb/3E9mx3A97BD3wWVdMhs8gLtcG3BnOF2hJVwjHnBiboqqcv4ri5bvX?= =?us-ascii?Q?PsUcyBYgKtY2me6yR7DTeBdnxtE3RG92xKCe3H36VC6I1NeKdB0fSt5xWbay?= =?us-ascii?Q?Rl3SuMv2TeNmja8FQBsbxoXQ9FVhr+ZrOGObO9ekzlzg78HnOX4RMmCaLPHC?= =?us-ascii?Q?K/bVoxA/u4UuTH4lhFftd3aPDHph3kHK2vfAA0VKlmXM8vSgMD9esyEvnm0T?= =?us-ascii?Q?pl0cKUqTc6kpQFYa4lTW3W4/HSG71UTNtDk2yiQv?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB3113.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7c53c1a2-df10-4fc4-fa8d-08da8ac93111 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Aug 2022 20:49:54.2042 (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: /kIBcHNJFJMRikp8I3Ir358KQkfCgVmGaNdOGqhhX67z+j9+SvSxdH4Egn7x19VNITIc7HQDOVu2C53kLgn2FO5n2Jul4EViWJUYVtq4CWI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR11MB1608 X-OriginatorOrg: intel.com X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 > -----Original Message----- > From: Ivan Vecera > Sent: Tuesday, August 30, 2022 10:16 AM > Subject: [PATCH net v2] iavf: Detach device during reset task >=20 > iavf_reset_task() takes crit_lock at the beginning and holds it during wh= ole call. > The function subsequently calls > iavf_init_interrupt_scheme() that grabs RTNL. Problem occurs when userspa= ce > initiates during the reset task any ndo callback that runs under RTNL lik= e > iavf_open() because some of that functions tries to take crit_lock. This = leads to > classic A-B B-A deadlock scenario. >=20 > To resolve this situation the device should be detached in > iavf_reset_task() prior taking crit_lock to avoid subsequent ndos running= under > RTNL and reattach the device at the end. >=20 > Fixes: 62fe2a865e6d ("i40evf: add missing rtnl_lock() around > i40evf_set_interrupt_capability") > Cc: Jacob Keller > Cc: Patryk Piotrowski > Cc: SlawomirX Laba > Tested-by: Vitaly Grinberg > Signed-off-by: Ivan Vecera > > @@ -2884,7 +2889,7 @@ static void iavf_reset_task(struct work_struct *wor= k) > if (adapter->state !=3D __IAVF_REMOVE) > queue_work(iavf_wq, &adapter->reset_task); >=20 > - return; > + goto reset_finish; > } >=20 > while (!mutex_trylock(&adapter->client_lock)) Ivan, what do you think about this flow [1]? Shouldn't it also goto reset_f= inish label? if (i =3D=3D IAVF_RESET_WAIT_COMPLETE_COUNT) { dev_err(&adapter->pdev->dev, "Reset never finished (%x)\n", reg_val); iavf_disable_vf(adapter); mutex_unlock(&adapter->client_lock); mutex_unlock(&adapter->crit_lock); return; /* Do not attempt to reinit. It's dead, Jim. */ } I am concerned that if the reset never finishes and iavf goes into disabled= state, and then for example if driver reload operation is performed, bad t= hings can happen. [1] https://elixir.bootlin.com/linux/v6.0-rc3/source/drivers/net/ethernet/i= ntel/iavf/iavf_main.c#L2939