Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2026458imm; Tue, 10 Jul 2018 11:51:47 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe86LrPM5UANGSNk8rmJX11LhzlRnaB6LMD+k/sOq7/ncG/rWZDNNr5wQ9ZWH3Xt8cvlz8u X-Received: by 2002:a63:5d09:: with SMTP id r9-v6mr23564561pgb.303.1531248706969; Tue, 10 Jul 2018 11:51:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531248706; cv=none; d=google.com; s=arc-20160816; b=bmZyTdVa1fCg15PAgOlimLQ4F3iwKJ2rIbGMeRD/dVtpdPibb6gOE0VA/BX/GLdQC3 ky9CimV6+94TvaIyFY9n3MojOAB66z+fgRRSUmENwieYRRqZFMjH4FPWKAeQBEG6qEya CaNICXrQxK37xn5cA5GBb0XITsZYaZyxpsRWGB4huBJoP1cuy0w6fNOjNkdDvuR5zQtl TLc24L9xXyX5zSnAD7rYyVtN0LzHEp2li4XiVr90aVEDUNqw2w/wNzWqrF2/uqfAuvsE Y7Vz8+cHouWCAyFcbzSkYJaFZykfG/qLy7b98QikzCS6jPkYFx3o5ipdbEcL5fxZCv4M 2q8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=KxclsyeLP4mpf0pbA8fPDdABV375HmshsVMj2jDnfsA=; b=YnrucRDs5DwqZovu7hi3Zvk5AQrV2unF8F1yQf8ooK56EaFADezdYHKEk6kmQ4zoKP 5Ihn3ftVZfVxsRegdUFaiNeSR2ThY6Q9Dmh8JU5QKhQbsjoQsrwnulv8SG98nNdy3TeY NckBxBmoYgeGlDYDAMxHPBbBZEHVtNFpDJkbPI0mC63qWfnxX72ZiqmT64fYVZ/ymq/h Qx2dJCEIeJPVtOzxWZqqkMiSqpb7gYgY6OpBfODizXVaCUVrCweY/ED1LtCIlp5DYFMt c6Esj5qEDahoQJJ/pZfCR1UmgZQK1aHAAp6OopsMQ2f7Hi4EV25AcuA/X+/XAF6R9E9i HRzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rsrD7gmM; 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 h21-v6si15326353pgi.430.2018.07.10.11.51.32; Tue, 10 Jul 2018 11:51:46 -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=@kernel.org header.s=default header.b=rsrD7gmM; 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 S2388039AbeGJSaZ (ORCPT + 99 others); Tue, 10 Jul 2018 14:30:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:34370 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733310AbeGJSaY (ORCPT ); Tue, 10 Jul 2018 14:30:24 -0400 Received: from mail-oi0-f41.google.com (mail-oi0-f41.google.com [209.85.218.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B5D3C2083E; Tue, 10 Jul 2018 18:30:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1531247412; bh=Sb9wfFILQKVb0esGwixzfyuuluVnP1gtSN7WwMDc1Fc=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=rsrD7gmM0DHr98GTJEwWz6vKcb0gP7v7or+QM1MSWci5f9mQXvxnWHec/kosQdDJt Jfd4QPWDUUnbzhNNtE098A6n63X3g1dEEGR32n0nze80nnPTWbO4QUZrc2rHUrdNM/ 4j5PsSJarIIty7FsbO1sar6Th8n74lMLQ/i3HHXc= Received: by mail-oi0-f41.google.com with SMTP id w126-v6so44490306oie.7; Tue, 10 Jul 2018 11:30:12 -0700 (PDT) X-Gm-Message-State: APt69E37J9Aj+w0oz9hCk1Bx1nVgPq7afDN83PdGduC4tLu6Bjfes73g U//+w/Jsl4fT08WbhQhCJojon7qAxcJASRYk27w= X-Received: by 2002:aca:b455:: with SMTP id d82-v6mr27777354oif.234.1531247412071; Tue, 10 Jul 2018 11:30:12 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a4a:6952:0:0:0:0:0 with HTTP; Tue, 10 Jul 2018 11:30:11 -0700 (PDT) In-Reply-To: <20180709160008.GA1490@wunner.de> References: <12fc8de5-ff03-cb00-52cb-25a43c71d03a@codeaurora.org> <20180708171418.GA11476@wunner.de> <20180709160008.GA1490@wunner.de> From: Sinan Kaya Date: Tue, 10 Jul 2018 14:30:11 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V5 3/3] PCI: Mask and unmask hotplug interrupts during reset To: Lukas Wunner Cc: linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Bjorn Helgaas , Oza Pawandeep , Keith Busch , open list Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 9, 2018 at 12:00 PM, Lukas Wunner wrote: > > On Mon, Jul 09, 2018 at 08:48:44AM -0600, Sinan Kaya wrote: > > On 7/8/18, Lukas Wunner wrote: > > > On Tue, Jul 03, 2018 at 11:43:26AM -0400, Sinan Kaya wrote: > > > > My solution doesn't help if link down interrupt is observed before the > > > > AER > > > > or DPC services. > > > > > > If pciehp gets an interrupt quicker than dpc/aer, it will (at least with > > > my patches) remove all devices, check if the presence bit is set, > > > and if so, try to bring the slot up again. > > > > Hotplug driver should only observe a link down interrupt. Link would > > come up in response to a secondary bus reset initiated by the AER > > driver. > > PCIe hotplug doesn't have separate Link Down and Link Up interrupts, > there is only a Link State *Changed* event. > > > Can you point me to the code that would bring up the link in hp code? > > I was referring to the situation with my recently posted pciehp patches > applied, in particular patch [21/32] ("PCI: pciehp: Become resilient to > missed events"): > https://patchwork.ozlabs.org/patch/930389/ > > When I get a presence or link changed event, I turn the slot off. That > includes removing all devices in the slot. Because even if the slot is > still occupied or link is up, there was definitely a change and the safe > behavior is to assume that the card in the slot is now a different one > than before. > We do have a bit of mess unfortunately. Error handling and hotplug drivers do not play nicely with each other. When hotplug driver observes a link down, we are not checking if the link down happened because user really wanted to remove a card or if it was because it was originated by an error handling service such as AER/DPC. I'm thinking that we could potentially check if a hotplug event is pending at the entrance of fatal error handling. If it is pending, we could poll until the status bit clears. That should flush the link down event. Even then, link down indication of hotplug seem to turn off slot power and LED. If AER/DPC service runs after the hotplug driver, link won't come back up as the power to the slot is turned off. I'd like to hear about Bjorn's opinion before we throw something else into this problem. > Afterwards, I check if the slot is occupied or link is up. If either > of those conditions is true, I try to bring the slot up again. > > Thanks, > > Lukas