Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752000AbdI1Qru (ORCPT ); Thu, 28 Sep 2017 12:47:50 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:49638 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751595AbdI1Qrs (ORCPT ); Thu, 28 Sep 2017 12:47:48 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 9BA9E60227 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=okaya@codeaurora.org Subject: Re: [PATCH 3/4] pci aer: fix deadlock in do_recovery To: Govindarajulu Varadarajan , benve@cisco.com, bhelgaas@google.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, jlbec@evilplan.org, hch@lst.de, mingo@redhat.com, peterz@infradead.org References: <20170927214220.41216-1-gvaradar@cisco.com> <20170927214220.41216-4-gvaradar@cisco.com> From: Sinan Kaya Message-ID: <2dc437fe-2ab4-23e3-44f3-f06feaf88d86@codeaurora.org> Date: Thu, 28 Sep 2017 12:47:45 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <20170927214220.41216-4-gvaradar@cisco.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 905 Lines: 27 On 9/27/2017 5:42 PM, Govindarajulu Varadarajan wrote: > CPU0 CPU1 > --------------------------------------------------------------------- > __driver_attach() > device_lock(&dev->mutex) <--- device mutex lock here > driver_probe_device() > pci_enable_sriov() > pci_iov_add_virtfn() > pci_device_add() > aer_isr() <--- pci aer error > do_recovery() > broadcast_error_message() > pci_walk_bus() > down_read(&pci_bus_sem) <--- rd sem How about releasing the device_lock here on CPU0? or in other words keep device_lock as short as possible? > down_write(&pci_bus_sem) <-- stuck on wr sem > report_error_detected() > device_lock(&dev->mutex)<--- DEAD LOCK -- Sinan Kaya Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.