Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2026882imm; Thu, 24 May 2018 04:45:22 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrbpDN+xnJvHVWOs7RIFxnYBFSmQxfVkdaI9JuEECz9VLLpJKHofVvtucsC2hnhwWLhErXd X-Received: by 2002:a63:3f45:: with SMTP id m66-v6mr5678380pga.340.1527162322940; Thu, 24 May 2018 04:45:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527162322; cv=none; d=google.com; s=arc-20160816; b=YsCk+B9b1q+OVKjEXFy1/RkA236KP91Nfqkd1jqB/aHX8rrB9lgVmohbmvZlt6sQOU iF3QepM8LlS2/QWkrvdh/9XtX0AWsnRCIQbvemKYNhJlyXJmhskJ1m1QZ7J1Mzj4ZrXF B29G0aEfvnuy666/NcyrDdLEByNyLoU5SvWkZ+iYaGhmbVeCmRB/xutg8mTQenRMQHTf cVObOOL4kYRctalso7tMQLShP8KFUh9HDICjaQqWqX/Ri1f2sjyazMJ3XiRzQGqRdChD exubdpTOfxVv5Hzd0U1X31lQOHseHTxzgav5fqNB/hbKMv5WqXyFHqMpoxs7zt7aF+Ht K30w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=OVvDXnS9kqoxXWcyYQIfQcyDuQFYihWmEOmxQP6Qm5Y=; b=iO8hw+OFx8OZX4R9vTRbQhqejUx9GI34vfVpKKcNVFOx0xeNEQhUBYqe2a0pphvFGL sRIiCJJO3z5FfqY6iwyUCr6uS2xUB0OfArSKhvavm0anvVPnaaSkmuLBSCyOQfTFgz6h +mdqn+JXWDJVyETGfw3o49PBiUlqVRbr93goX1TSQNzhJdi/KL33I7Hf9n1YQtIm+OA0 OuSFjdyKW3UY4qJAloV1y3udwBrZtkcAVXvdZWtob/356jsOIZuJcWhgmBGdvsyORmkB nC5ifYedeLzRj6AKacNa2Unu8eRDCW9X7o7jqWb5unKlqV8b189J90uzFdyZFppqUaTF uFfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Y3pGExXE; dkim=pass header.i=@codeaurora.org header.s=default header.b=bV1TWSky; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s9-v6si21520922pfk.46.2018.05.24.04.45.08; Thu, 24 May 2018 04:45:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=Y3pGExXE; dkim=pass header.i=@codeaurora.org header.s=default header.b=bV1TWSky; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S969230AbeEXLnU (ORCPT + 99 others); Thu, 24 May 2018 07:43:20 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:39348 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S969169AbeEXLnL (ORCPT ); Thu, 24 May 2018 07:43:11 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 3B9B460C4F; 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= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 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 Cc: linux-pci@vger.kernel.org, timur@codeaurora.org, ryan@finnie.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, stable@vger.kernel.org, Bjorn Helgaas , "Rafael J. Wysocki" , Greg Kroah-Hartman , Thomas Gleixner , Kate Stewart , Frederick Lawler , Dongdong Liu , Mika Westerberg , open list , Don Brace , esc.storagedev@microsemi.com, linux-scsi@vger.kernel.org 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-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); } -- 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.