Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp4479464pxb; Tue, 31 Aug 2021 06:18:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwm2rnU6HyHAv0J78CyfdkpaLrS29QhAzGrR21ROSQiNHypAJqUH1KY5CTqZAgdmJXyfs3B X-Received: by 2002:a05:6e02:1ca6:: with SMTP id x6mr19454465ill.86.1630415924072; Tue, 31 Aug 2021 06:18:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630415924; cv=none; d=google.com; s=arc-20160816; b=SWLzjkx4a9Y+r/IHN60xYxgz0ZasSOylhcGdTud0fsmsAUVP5EncYJjuukNp2Jm1ZD D11ya+hZfjCFP257Qj8M7rADNKGjAHMc+a6FK+7BG827Vw2WU6XliEWtRTXFNZ2foOqO V8dq+f1/hm9fC8xKDAMgrIjx5o402M28VxXKAa3nPqI0OZzX9ofukM4gNvynHcZYrrqo EVwzPwfRMQu3++saGkxS/jJ1adZSl75Fzabd8EML2NJoVqpujH3EDTYT5BE2hSb8IjmZ c4bq3sPWFAmtWZV6ZIBgFCBDRt3t2AzRZ3DaKsRPvbF+uYf3Jb7hAA2Mv/oIkO6il3mZ TnyQ== 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=O04+J9gSxbpkBztP2ggNCNH2CejHjsWY1TH+VQQ2tR4=; b=tFN9b82Qz/LBmxF1dv8pDTjFW+PJXP/sc32d6zNSdFvuB9cWwd0msiNTFr3HCOMgGG 8z3cygUrqbCOZEfQtDNeRni3298YtPYNnhrrRqw17JHnOhn5pVdpANOWuYsdK/UxRzyk KKC5CSW/ZW2WmJ+BOrJOrw0UEpoUZiYLgY3l4HQdDYneLr2bYESC6sg80WxKTnXnkMyD /nDYjpQvao5s0mTk5gJmbZpEPEc07XvDjRYQ2gEnm8empiDEGWUqlKtkGBr6NpdAolCg TVm+eY4H9vHjlZUYQ80bzQUIl4dsU5JqW6ahoHNf5gs1FDRf1jHMPYvBYR83SazRR+AW rvIw== 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 a4si20284809ilt.54.2021.08.31.06.18.32; Tue, 31 Aug 2021 06:18:44 -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 S234864AbhHaNRH (ORCPT + 99 others); Tue, 31 Aug 2021 09:17:07 -0400 Received: from mail-wm1-f42.google.com ([209.85.128.42]:40564 "EHLO mail-wm1-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230175AbhHaNRF (ORCPT ); Tue, 31 Aug 2021 09:17:05 -0400 Received: by mail-wm1-f42.google.com with SMTP id x2-20020a1c7c02000000b002e6f1f69a1eso2061819wmc.5; Tue, 31 Aug 2021 06:16:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=O04+J9gSxbpkBztP2ggNCNH2CejHjsWY1TH+VQQ2tR4=; b=Z1QpaNb6lwYgwghFPERz6ASgsUyRcU5/9NACCK5mmoSJoqgBeMtg1h8SnlnNoLQZv4 RepI5FBDTKXeMnvf7CDxLls3bIfF3ZN0VmBEtfiOWAGxlBtlEyN8Rb8af74Mp1YahZsM wdnIKVUBz5XiPi5hLwv5b3kXu+urf814NVXzrr6FQ7HLlFKp5936abvsKBvGPfJUj2bo mmyKC1V7hJ9+ByBOzHRDLwzCfPMWHs54xLEYhRwTHLJE/HPGE0r/vhtU24GLP0BRsOBw kUcPUrXm3oMSIavHEmJHxX+NYqjwNTVpnxrta6ho4k3wBVVOJXY0OiDYEfSIAsugJYvk sCxw== X-Gm-Message-State: AOAM533ZYDFcYrm2qAg02aD2BiWYLrvGYvYUTotHwaUcgNi6kuY/DLY6 QDgnz7pp/uVLcT7awX/psMA= X-Received: by 2002:a7b:cc16:: with SMTP id f22mr4161917wmh.99.1630415769653; Tue, 31 Aug 2021 06:16:09 -0700 (PDT) Received: from liuwe-devbox-debian-v2 ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id c15sm2442150wmr.8.2021.08.31.06.16.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Aug 2021 06:16:09 -0700 (PDT) Date: Tue, 31 Aug 2021 13:16:07 +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: <20210831131607.vsjvmr43eei4dsie@liuwe-devbox-debian-v2> References: <1630365207-20616-1-git-send-email-longli@linuxonhyperv.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1630365207-20616-1-git-send-email-longli@linuxonhyperv.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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