From patchwork Thu May 24 11:43:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinan Kaya X-Patchwork-Id: 10424439 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 332196032A for ; Thu, 24 May 2018 11:43:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F074B28A38 for ; Thu, 24 May 2018 11:43:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E472E285A7; Thu, 24 May 2018 11:43:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C4675285A7 for ; Thu, 24 May 2018 11:43:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hCAyKjohIibyg9kPgfI3ZDRT4q6RmQA+/QbnmA6G2+A=; b=pWRxyF7joASGCO S+/cg2SX0zjTnBuTGPtZbh27RddnCtumObB08pKnqKsEXZQIyW2SaJGSrn5OnS+lGKWJxbjLddF+x BgT069kwAHSNL+6GqkpGS8h/qLHpmmvivIUDcLCKS4/r1zFRHc06XRelaKIgakc2qeXIN0mp7Q/0U sg4mwPYPJuW+HvSBnx2nwFeyjlHu9TO//o7d0EVcPgX2r5y5KeqFCeaYBaIdzPoU2/P7ZgUY914Ii B/Gdyax8ylT73LXubvQTLj5hJCqHGo5rvLg0uvDh064bPCk4Y/VdRNV+WEZYTQggP9Mt+ODr7vDwa fjFBkWTdwoDtfHrW8hTg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fLoeT-0002o2-9g; Thu, 24 May 2018 11:43:25 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fLoeP-0002j2-3L for linux-arm-kernel@lists.infradead.org; Thu, 24 May 2018 11:43:22 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 59F6A60D81; Thu, 24 May 2018 11:43:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1527162190; bh=PkMv1Qj+VInUDjwxDTBTVIY5H4uoS2V2QhQILMsPLyY=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=Y3pGExXENFeHj6Ts4TKucx7lXEnppwFVtc9G9QCHR4w6w9uCXl57lewRGxcoNEY8i ft95UOspecOlizCaoeV+ndcvJ8Cy6NuAheTy21KALcYdTZXIiPixToWhwbY/CAC+Vs 4++jO4GNwF7998GXbRzi9rYO0SWKL7M6cpxkkHIQ= Received: from [192.168.0.106] (cpe-174-109-247-98.nc.res.rr.com [174.109.247.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id EE70E601D4; Thu, 24 May 2018 11:43:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1527162189; bh=PkMv1Qj+VInUDjwxDTBTVIY5H4uoS2V2QhQILMsPLyY=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=bV1TWSky+EqHAZsP5qfen/RH0NcdRr0BoAnJiBpL0IcpBGvbRrRqGzfFVWxKWNo7Z dEkMOarjbWy/1T/U6xd2tOwGYkEo0WVGyE7QEiyjVcKwNNtyaU9OU4rb/ottIfmil+ cUZLly4fLlcjYLCn3a7udCXWwlARW+IF5jSE/vwU= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org EE70E601D4 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 V2] PCI/portdrv: do not disable device on reboot/shutdown To: Bjorn Helgaas References: <1527043490-17268-1-git-send-email-okaya@codeaurora.org> <20180523213249.GD150632@bhelgaas-glaptop.roam.corp.google.com> <61f70fd6-52fd-da07-ce73-303f95132131@codeaurora.org> From: Sinan Kaya Message-ID: <82656e20-e821-1944-3399-1667ceb27719@codeaurora.org> Date: Thu, 24 May 2018 07:43:05 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <61f70fd6-52fd-da07-ce73-303f95132131@codeaurora.org> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180524_044321_195263_BCD85F76 X-CRM114-Status: GOOD ( 16.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ryan@finnie.org, Kate Stewart , linux-scsi@vger.kernel.org, Frederick Lawler , Greg Kroah-Hartman , linux-pci@vger.kernel.org, timur@codeaurora.org, "Rafael J. Wysocki" , esc.storagedev@microsemi.com, open list , stable@vger.kernel.org, Dongdong Liu , linux-arm-msm@vger.kernel.org, Bjorn Helgaas , Thomas Gleixner , Don Brace , Mika Westerberg , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On 5/23/2018 6:57 PM, Sinan Kaya wrote: >> The crash seems to indicate that the hpsa device attempted a DMA after >> we cleared the Root Port's PCI_COMMAND_MASTER, which means >> hpsa_shutdown() didn't stop DMA from the device (it looks like *most* >> shutdown methods don't disable device DMA, so it's in good company). > All drivers are expected to shutdown DMA and interrupts in their shutdown() > routines. They can skip removing threads, data structures etc. but DMA and > interrupt disabling are required. This is the difference between shutdown() > and remove() callbacks. I found this note yesterday to see why we are not disabling the devices in the PCI core itself. pci_device_remove() /* * We would love to complain here if pci_dev->is_enabled is set, that * the driver should have called pci_disable_device(), but the * unfortunate fact is there are too many odd BIOS and bridge setups * that don't like drivers doing that all of the time. * Oh well, we can dream of sane hardware when we sleep, no matter how * horrible the crap we have to deal with is when we are awake... */ Ryan, can you discard the previous patch and test this one instead? remove() path in hpsa driver seems to call pci_disable_device() via hpsa_remove_one() hpsa_free_pci_init() but nothing on the shutdown path. diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 4ed3d26..3823f04 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -8651,6 +8651,7 @@ static void hpsa_shutdown(struct pci_dev *pdev) h->access.set_intr_mask(h, HPSA_INTR_OFF); hpsa_free_irqs(h); /* init_one 4 */ hpsa_disable_interrupt_mode(h); /* pci_init 2 */ + pci_disable_device(h->pdev); }