Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp701937imm; Wed, 29 Aug 2018 10:00:59 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZnBYqlg4xWr3pkh8l4sN3LRLw6fyH6m7g/1QOgtiqVr8smVC54FJXsvaEajtm6gnQZJmWT X-Received: by 2002:a63:5a65:: with SMTP id k37-v6mr6421163pgm.143.1535562059278; Wed, 29 Aug 2018 10:00:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535562059; cv=none; d=google.com; s=arc-20160816; b=iMBu4ZbVjw9YtVHf4Di+qsMAu2AGEyhdZl1fD6h/BrbYQWvkbmbs3Tgu3l8N5vAKvp EB60sNABeqqf4t9Pz/K5TKujAcRjHvaUNxs7mPJvEMtC7W2IAXenG8c+fPOCDuAr8qu1 /RwAZ1kQdit0OyY8CLgQEu+prxeQQURzcsNVxCU3VjbrkMvy7xajj44mIiyJTRWUjhd7 vOzyPtBYseYVJ/CQJsevdizLoqDK3RZqiijSqYQ3PGKQcNEuI2o+vvr1ghBGDSRLe3Sl cfR3XVSW85m6qYSdkB0MF6mcZk62rb5ILZv8QOPiexaiUVHLXhBQSvc3QzScsmgHrbVs z3ww== 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:dkim-signature :arc-authentication-results; bh=XXO5gIdr3OjiR6S02XZJ6gMS+ckd4hcKuNUkjOa1fwE=; b=VCMG3wioHPVIMSAsY789H/oVj345OfKbT6GwbPzlmcN7qyfEcD243K+QOfxr3MpD7/ oQCvVNuUFAvZcaB7kf1O0609BhWWRal6nqAj21w9gdqsmrPQtyooZjyAqqnd3gjRDW2k xZrZhRusfPwfJwjeFjcavJEh6cyhX4aa119ygUB1ZhyEYNJsDicnYQpPr5V2UsIvqvrE LDF2MDahSFQIXS+ydqZw4j4SraapLsA1w6UYsT8DBqkYM4IRDm3STeO+Ck+t0o0f0uAI iXRA0ZeUWfBjfFbtdsrkvaXvrqGzTB3Z3y6gOdgpLaMv8XA2iGZjPW/+i3jrLalUfpPQ q+kQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JxUwaW71; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 5-v6si4308287pls.431.2018.08.29.10.00.43; Wed, 29 Aug 2018 10:00:59 -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=@gmail.com header.s=20161025 header.b=JxUwaW71; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728139AbeH2U5Z (ORCPT + 99 others); Wed, 29 Aug 2018 16:57:25 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:46312 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727245AbeH2U5Y (ORCPT ); Wed, 29 Aug 2018 16:57:24 -0400 Received: by mail-oi0-f66.google.com with SMTP id y207-v6so10341123oie.13; Wed, 29 Aug 2018 09:59:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=XXO5gIdr3OjiR6S02XZJ6gMS+ckd4hcKuNUkjOa1fwE=; b=JxUwaW71WdVrgrTBVzC9Mo5SkUCYkuNhc/16uCJvTodsmOedv0HWDze1b/elk8MkEP VaDVBlaLmfGSAxD+xjgGHh/rlIThlCpPrbJOCwlp7gd5u8bRVmLk53APEzL8bm0nVZa3 7Nigk2/L+80sQ2a5wxfgWY+z9f7+GsjAUOMf72t7l9NNmQLPbCdyU7Y4CaApRS/Hi9p4 CXdMC2dH+aCInN5kT1Kr3jcpzIA9S72y0wH9fZ4YrvvXY4Q6yyBqz4R78QrZMDF9oYCb G/FB4RHFto6pHjddR95uc35GyDNyr8hFboQl6PmfdZPLWYRKPmLjhmy1KHe4FVvoe4Oe 1oTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=XXO5gIdr3OjiR6S02XZJ6gMS+ckd4hcKuNUkjOa1fwE=; b=Sjw2y6usLusi/Tsu0ELPJEUXTcJac+k+XvsCrVOsDCai1VdntZpKwkQSaxIbHSmNSS gIHY/VgrrqjZMYBq5l+z8PH+ReFbRgB8FGbleqtfuJM6jiN71+7dgYbDRZdpmtSiIiIb Vtv/WaaUHXccIXqZiXoUHWTH94RWrN7fcqxaqQ1wWG03QWxYSmWCMHc3iUtyOYHh1wIb d9/cWVTNBYm9YK0os2nBOcNgTH4idIn2y3/SgRM6AxSge9BKP6S6F9VFs3T4mlNH3FRj +w7uu8KBb8vHYgQ02ENex0kdjGSrj02bAjX46TydJgfXjm5F3bOXDNokjfEiFd2Qdkcl HFpg== X-Gm-Message-State: APzg51A2iEA6vwJPL4+cVwFx+9qhHa47lHES6NGek1Oz5NgTK2XfO2Pd fN4+LzsDSgrIQ8qGjjLUFxPC+6UXmNY= X-Received: by 2002:aca:d44a:: with SMTP id l71-v6mr3757597oig.199.1535561975304; Wed, 29 Aug 2018 09:59:35 -0700 (PDT) Received: from nuclearis2-1.gtech (c-98-195-139-126.hsd1.tx.comcast.net. [98.195.139.126]) by smtp.gmail.com with ESMTPSA id t141-v6sm6141987oif.18.2018.08.29.09.59.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Aug 2018 09:59:34 -0700 (PDT) Subject: Re: [PATCH] PCI/MSI: Don't touch MSI bits when the PCI device is disconnected To: linux-pci@vger.kernel.org, bhelgaas@google.com Cc: keith.busch@intel.com, alex_gagniuc@dellteam.com, austin_bolen@dell.com, shyam_iyer@dell.com, Narendra_K@Dell.com, Stuart_Hayes@Dell.com, lukas@wunner.de, linux-kernel@vger.kernel.org References: <20180730212146.31909-1-mr.nuke.me@gmail.com> From: "Alex G." Message-ID: Date: Wed, 29 Aug 2018 11:59:33 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180730212146.31909-1-mr.nuke.me@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed 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 Should I resubmit this rebased on 4.19-rc*, or just leave this patch as is? Alex On 07/30/2018 04:21 PM, 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. pci_msi_(un)mask_irq 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 machines with buggy firmware. > Not triggering the IO in the first place eliminates the problem. > > Signed-off-by: Alexandru Gagniuc > --- > > There's another patch by Lukas Wunner that is needed (not yet published) > in order to fully block IO on SURPRISE!!! removal. The existing code only > sets the PCI_DEV_DISCONNECTED bit in an unreasonably narrow set of > circumstances. Lukas' patch fixes that. > > However, this change is otherwise fully independent, and enjoy! > > drivers/pci/msi.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c > index 4d88afdfc843..5f47b5cb0401 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 */ >