Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp206352imu; Wed, 7 Nov 2018 15:44:59 -0800 (PST) X-Google-Smtp-Source: AJdET5c4kHYVdB8GYkiHjCo/9ey5YwD2nymQuEzB87wvjcnD2ChIkgodIgwY+G6M2sE5St0IwNPd X-Received: by 2002:a17:902:4683:: with SMTP id p3-v6mr2355049pld.215.1541634299355; Wed, 07 Nov 2018 15:44:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541634299; cv=none; d=google.com; s=arc-20160816; b=NJPCTAASCORkxVqq5+zkYVIIdzvOXNLQSzqDc6xgoeSIH/jeymO0VLtCZiIh/cs+Yu kJ+CPsb0nekiDku0mHzW60fXrwelUwv+xu4wkRzwZJZLTq6tWS2+6ftd4gpWPS983h5E Dp5Dneix9a/XehP52BP/2ncud2KDxKpOU+RaXFknoc3J8cR52jBhQSsOdF9AwLmgu3hB 6RSKf2zCRUIoJKa12FtlIrc3EX+z3363O40KO3I+/Pw2e/ZPYossW/isO5AhQDp1sEbI M90y+wbbOLidmG6ywG7HSTVSpLKLN2iAFBoz2mj4XeoVobtz0EkMnR2LQr8kW69If9iU GpBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=qtT9yzn9H7p5563WZFxhEa0p2AjgH73WRHR8aAokm8U=; b=vQ6VCBbNX6uNWRIbP5H1MVB7tFYNy9A8WwLc3irmIKCe28c6B/L2qYBzzsdXAmx7UU ZZ1+S6CBhgiDRemnNkpXcPzTmV99NQPdmSkeWWljHZ+IWU223101uXTomSs9SH4ybi6V JFgFxAkoKAZsiT+XyJ6qLzyYSaxPLsPYzs4FZHnWnGZOjYuU1Wh1VdMgN25+TPPADV57 O9GUh6E98CMxr+m+XEFWHwreG6KNrgOsBDMRRh6D7yT30iwVH8GJfW3fsewoAm4cuKl+ HZMUJ2cUzsDVq9DLA4ExYhGtpAQZ03MaxENdWtQXP8Y+9+UgZP3HoE2n+5T04iyC62Yv E+Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SDVlyMS5; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m126-v6si2507266pfc.265.2018.11.07.15.44.43; Wed, 07 Nov 2018 15:44:59 -0800 (PST) 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=@kernel.org header.s=default header.b=SDVlyMS5; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728004AbeKHJPm (ORCPT + 99 others); Thu, 8 Nov 2018 04:15:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:50678 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727260AbeKHJPm (ORCPT ); Thu, 8 Nov 2018 04:15:42 -0500 Received: from localhost (unknown [69.71.4.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5746C20882; Wed, 7 Nov 2018 23:42:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541634179; bh=Z8YQ3I2qLt+41BXs33mAuHv0KaiQsmjD2qPWvfRS8tQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=SDVlyMS5KczWmAeUglJGxVaDMRfs2U9Sg06uVAwgd4GYC8KyKIutEIXntxq5m69XT VI1Ma8+Le4aCz8n6aPM1a0Y6nPJ++HZE1PgGJJS9NU2KS/rpYPA6+Up7uPeVNe1QsW IkafT7+N8qKrbrUU2yWbxNLXcrMkQbAWeDE9Xm4U= Date: Wed, 7 Nov 2018 17:42:57 -0600 From: Bjorn Helgaas To: Alexandru Gagniuc Cc: linux-pci@vger.kernel.org, keith.busch@intel.com, alex_gagniuc@dellteam.com, austin_bolen@dell.com, shyam_iyer@dell.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] PCI/MSI: Don't touch MSI bits when the PCI device is disconnected Message-ID: <20181107234257.GC41183@google.com> References: <20180918221501.13112-1-mr.nuke.me@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180918221501.13112-1-mr.nuke.me@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 18, 2018 at 05:15:00PM -0500, Alexandru Gagniuc wrote: > When a PCI device is gone, we don't want to send IO to it if we can > avoid it. We expose functionality via the irq_chip structure. As > users of that structure may not know about the underlying PCI device, > it's our responsibility to guard against removed devices. > > .irq_write_msi_msg() is already guarded inside __pci_write_msi_msg(). > .irq_mask/unmask() are not. Guard them for completeness. > > For example, surprise removal of a PCIe device triggers teardown. This > touches the irq_chips ops some point to disable the interrupts. I/O > generated here can crash the system on firmware-first machines. > Not triggering the IO in the first place greatly reduces the > possibility of the problem occurring. > > Signed-off-by: Alexandru Gagniuc Applied to pci/misc for v4.21, thanks! > --- > drivers/pci/msi.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c > index f2ef896464b3..f31058fd2260 100644 > --- a/drivers/pci/msi.c > +++ b/drivers/pci/msi.c > @@ -227,6 +227,9 @@ static void msi_set_mask_bit(struct irq_data *data, u32 flag) > { > struct msi_desc *desc = irq_data_get_msi_desc(data); > > + if (pci_dev_is_disconnected(msi_desc_to_pci_dev(desc))) > + return; > + > if (desc->msi_attrib.is_msix) { > msix_mask_irq(desc, flag); > readl(desc->mask_base); /* Flush write to device */ > -- > 2.17.1 >