Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp869493ybl; Tue, 28 Jan 2020 13:52:40 -0800 (PST) X-Google-Smtp-Source: APXvYqy0y8qGT1BsotDl5x0ACyguHQiR+2LUNLGzKHLQtodj+CTCsDjVOuhCepf4+GyWeBo5d8CJ X-Received: by 2002:aca:c0c5:: with SMTP id q188mr4137595oif.169.1580248360711; Tue, 28 Jan 2020 13:52:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580248360; cv=none; d=google.com; s=arc-20160816; b=CQKKuK7vlP1CFOM9PpbOMFTY5uj8qHF98gWeDby9gx1SIUFFhdknCxDLHEpkGjGSdg fSompJ2/2gINxfQp4ljcxHwsHBok/k8wOcWqiScOR5+MW3FW+p7qlYAMkwPkroGDxejy XMN32/S6v8lUvd+8xtQYZ55liAJ+GaJkAZucIru39sQ+H/y4mRbw89+NR00IqpQk68TX a3mhpbECoeti+IN/w2u2+vUXPOr6HUhf7AOymkZ45NITZZWin5Tzgxa5Orsvvg8/boOV U5KeiMoXkTSAI9J8ovIWJOz9DPWDTX2Tgl6w97FcUOeA+yp6dLsQ8hhjaR0voqgi+Kyo m5ag== 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:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=7fVmgHGYS1nrVjhwYycZGM8HXmV8SDgJkcuUiKiFezE=; b=Jjx9+XRWJdyYiuZT/SC3CvbKuDIgw1F5XQ9MggPSULgHrlKs7p+mGQ1JOFbOWFyxg2 bui8Ry/7pH6L2AHJZcy7SI4rDClcNKZNsm3EJOlgEGdUbvv/HQcDNH6JF1G+jDXoBfKN l4q80HL9rvzNLpGfdVeDam18cc3MkeSeZ8PHhXhPLY5NrWYxrot1l1fmIboMmKVTZX2f 5GfBpcY2h/NqCyB0qbF3WHMQV1Zh8ZIYBfav7Qyd18r63RklobzBzanAiFXetwp7VjcW j8KLBC484hK6GnNS0Qdcw6Psk1vFVBgMiyBzx222HEQIYxm9j7qtYnKQB2lByvmrWUdw BOAg== ARC-Authentication-Results: i=1; mx.google.com; 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 l6si8890591otk.134.2020.01.28.13.52.28; Tue, 28 Jan 2020 13:52:40 -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; 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 S1726292AbgA1Vvf (ORCPT + 99 others); Tue, 28 Jan 2020 16:51:35 -0500 Received: from mx2.suse.de ([195.135.220.15]:57388 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726211AbgA1Vvf (ORCPT ); Tue, 28 Jan 2020 16:51:35 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id AAE21ACE0; Tue, 28 Jan 2020 21:51:32 +0000 (UTC) Message-ID: <1580248285.18755.2.camel@suse.de> Subject: Re: [PATCH v2] PCI: pciehp: Make sure pciehp_isr clears interrupt events From: Enzo Matsumiya To: linux-kernel@vger.kernel.org Cc: Austin Bolen , keith.busch@intel.com, Alexandru Gagniuc , "Rafael J . Wysocki" , Mika Westerberg , Andy Shevchenko , "Gustavo A . R . Silva" , Sinan Kaya , Oza Pawandeep , linux-pci@vger.kernel.org, lukas@wunner.de, Stuart Hayes , Bjorn Helgaas Date: Tue, 28 Jan 2020 18:51:25 -0300 In-Reply-To: <41285254-1bc1-3ffe-383e-276dc7193990@gmail.com> References: <20191120222043.53432-1-stuart.w.hayes@gmail.com> <41285254-1bc1-3ffe-383e-276dc7193990@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.6 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2020-01-20 at 10:10 -0600, Stuart Hayes wrote: > On 11/20/19 4:20 PM, Stuart Hayes wrote: > > Without this patch, a pciehp hotplug port can stop generating > > interrupts > > on hotplug events, so device adds and removals will not be seen. > > > > The pciehp interrupt handler pciehp_isr() will read the slot status > > register and then write back to it to clear the bits that caused > > the > > interrupt. If a different interrupt event bit gets set between the > > read and > > the write, pciehp_isr will exit without having cleared all of the > > interrupt > > event bits. If this happens, and the port is using an MSI interrupt > > where > > per-vector masking is not supported, we won't get any more hotplug > > interrupts from that device. > > > > That is expected behavior, according to the PCI Express Base > > Specification > > Revision 5.0 Version 1.0, section 6.7.3.4, "Software Notification > > of Hot- > > Plug Events". > > > > Because the "presence detect changed" and "data link layer state > > changed" > > event bits are both getting set at nearly the same time when a > > device is > > added or removed, this is more likely to happen than it might seem. > > The > > issue was found (and can be reproduced rather easily) by connecting > > and > > disconnecting an NVMe storage device on at least one system model. > > > > This issue was found while adding and removing various NVMe storage > > devices > > on an AMD PCIe port (PCI device 0x1022/0x1483). > > > > This patch fixes this issue by modifying pciehp_isr() by looping > > back and > > re-reading the slot status register immediately after writing to > > it, until > > it sees that all of the event status bits have been cleared. > > > > Signed-off-by: Stuart Hayes > > --- > > v2: > > * fixed ctrl_warn() call > > * improved comments > > * added pvm_capable flag and changed pciehp_isr() to loop back > > only when > > pvm_capable flag not set (suggested by Lukas Wunner) > > > > drivers/pci/hotplug/pciehp.h | 3 ++ > > drivers/pci/hotplug/pciehp_hpc.c | 50 > > ++++++++++++++++++++++++++++---- > > 2 files changed, 47 insertions(+), 6 deletions(-) > > > > Bjorn, > > Please let me know if I could do anything to help get this patch > accepted. > > Thanks! > Stuart > Hi, can someone please review/accept this patch please? It fixes NVMe hotplug operations in SLES15-SP1. Thanks, Enzo