Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1417945pxb; Fri, 24 Sep 2021 04:12:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyl0bUncS6PRj/wh1MLrHaMB1umq4SHBMEMfE1dHu5oBGZCtioIv9Btyza7bDbw6p38LLkQ X-Received: by 2002:a5e:9810:: with SMTP id s16mr8544366ioj.171.1632481948812; Fri, 24 Sep 2021 04:12:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632481948; cv=none; d=google.com; s=arc-20160816; b=FYdIf17ASvIv0+qBsAPiY6JD1VBFwv2paKcMQtYK4CvMXHtbPwEPFu4LISohbxZeWI V39eETQ27MmacLjRDwH+u2AqC0/6DML9JBuCjIwSXSqah8GgrfaGSwaRyhWxtrkHnm7m Sl38D0XEUwSnRBXdXiWnHyIFai2c8/LE0gCWjoA8rSo/5Fr5T/Fp7OPHPeNGNba2el6w KbIaF5jpjW3gNUdRc14JLa8eaczhGVKSkICOwIyTAd7aNb2KdP9fbqn57ZET7jx1PWum mEg8SnE+RgDGx45Hk8UlVDp2d9ErQ5lZxXWfrYeqhcaO7/6eu7yR6n1O1BqgtJ26yDoe uDmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=KRYfypNkuIY9emLZqiqldN/0eSszJL/L7hkS9k8gfkA=; b=DbTmLIhINDZ3LrSh6HJzVCa/8AuOU9dlK2oWg4Xa6GxIwqbznx/uIKxzlbpq8qrcOn S4tSiGR7bBxiEbTEt89vFOF3UfWwxHCnUpIxBWFp5HqZCtxS6PRZWw9kcgPzdyeEDxox hD3o4apX/bm4VxygID2Fi1BL3vDWA53pM6PDF2IRK82WvgXTHgA+QZZwPmAHVnalBn7Z WBBwC7SOKlW6JfsLtLcKRdgIKRrjKeMlq1+dNUuvn/P+GtolYmrTk54Cz09MbN2hLOmP Hq2QNHrWAbsArL4hzntOdfBfnhDVZMR3ZagMc092nCHIsXZbQfy/Q1q74OwrHZtKXXh7 lvkA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d39si9154561jaa.115.2021.09.24.04.12.17; Fri, 24 Sep 2021 04:12:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245219AbhIXJhT (ORCPT + 99 others); Fri, 24 Sep 2021 05:37:19 -0400 Received: from mail-wr1-f54.google.com ([209.85.221.54]:37793 "EHLO mail-wr1-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237056AbhIXJhS (ORCPT ); Fri, 24 Sep 2021 05:37:18 -0400 Received: by mail-wr1-f54.google.com with SMTP id t8so25513133wrq.4; Fri, 24 Sep 2021 02:35:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=KRYfypNkuIY9emLZqiqldN/0eSszJL/L7hkS9k8gfkA=; b=m5D0Vh0cSXUgya5uLyJUhldGjVydqzfU3oy3qz7rf+XJnpR7JiA9dEWUESA6BXNVJE 2UpENO7SBZnyDHF8+W+I2i2iiZxzhrw5c+tEjSZri+gk5i52myIffmCc6KSGCPxiXn4u v+WF0H4BYk8lAPNgCfnyPP1NdI5iJXLgdueS3MVNX89OANwge56ixJiLvXRQGw9I5Yxj nw+dOfBRPR19Gn0fMZ/HuU9c1QT1RYRumJxoXMgvizzBpeTg11d0jGQpiVfcr/Yckr6t 0gYmCqc0jqcF0LXyug1beOzx9dpIzjtbK4Erlp0eeEKQIdqivRrfCZZc4O7vt7ezKvLR oNQA== X-Gm-Message-State: AOAM530IzVGQ3xjtA6qr4xPQsPQJlqI4oZswI4r8Qh1ABSd3M1SNRPri +EbCIyRkM2IW5KXqTZbgA28= X-Received: by 2002:a1c:4b15:: with SMTP id y21mr1002172wma.183.1632476144529; Fri, 24 Sep 2021 02:35:44 -0700 (PDT) Received: from liuwe-devbox-debian-v2 ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id j21sm7505008wrd.48.2021.09.24.02.35.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Sep 2021 02:35:44 -0700 (PDT) Date: Fri, 24 Sep 2021 09:35:42 +0000 From: Wei Liu To: longli@linuxonhyperv.com Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, Long Li , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , Lorenzo Pieralisi , Rob Herring , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Bjorn Helgaas , Michael Kelley Subject: Re: [Patch v2] PCI: hv: Fix sleep while in non-sleep context when removing child devices from the bus Message-ID: <20210924093542.dac76ugni4cqtsum@liuwe-devbox-debian-v2> References: <1630365207-20616-1-git-send-email-longli@linuxonhyperv.com> <20210831131607.vsjvmr43eei4dsie@liuwe-devbox-debian-v2> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210831131607.vsjvmr43eei4dsie@liuwe-devbox-debian-v2> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 31, 2021 at 01:16:07PM +0000, Wei Liu wrote: > On Mon, Aug 30, 2021 at 04:13:27PM -0700, longli@linuxonhyperv.com wrote: > > From: Long Li > > > > In hv_pci_bus_exit, the code is holding a spinlock while calling > > pci_destroy_slot(), which takes a mutex. > > > > This is not safe for spinlock. Fix this by moving the children to be > > deleted to a list on the stack, and removing them after spinlock is > > released. > > > > Fixes: 94d22763207a ("PCI: hv: Fix a race condition when removing the device") > > > > Cc: "K. Y. Srinivasan" > > Cc: Haiyang Zhang > > Cc: Stephen Hemminger > > Cc: Wei Liu > > Cc: Dexuan Cui > > Cc: Lorenzo Pieralisi > > Cc: Rob Herring > > Cc: "Krzysztof WilczyƄski" > > Cc: Bjorn Helgaas > > Cc: Michael Kelley > > Reported-by: Dan Carpenter > > Link: https://lore.kernel.org/linux-hyperv/20210823152130.GA21501@kili/ > > Signed-off-by: Long Li > > Reviewed-by: Wei Liu Applied to hyperv-fixes.