From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Return-Path: Message-ID: <648c06a779a535266afa5ee7bd96ffba8f14d0ca.camel@kernel.crashing.org> Subject: Re: [PATCH 1/1] PCI/AER: prevent pcie_do_fatal_recovery from using device after it is removed From: Benjamin Herrenschmidt To: Sinan Kaya , Keith Busch Cc: poza@codeaurora.org, Bjorn Helgaas , Thomas Tai , bhelgaas@google.com, linux-pci@vger.kernel.org, linux-pci-owner@vger.kernel.org, Sam Bobroff Date: Tue, 21 Aug 2018 08:19:02 +1000 In-Reply-To: <184814fb-0caf-b260-4415-8f96fbdf4831@kernel.org> References: <20180819021922.GE128050@bhelgaas-glaptop.roam.corp.google.com> <908ff33ded8f31830f95a8889d8540f1@codeaurora.org> <5027d857bb59edfd33442003aa618ece1bc9cd52.camel@kernel.crashing.org> <2ecd1fd6d763810d45697f846fa876b58a193b1b.camel@kernel.crashing.org> <20180820155325.GA16148@localhost.localdomain> <6aa71d74-e4dc-c627-1496-981278388bce@kernel.org> <20180820213544.GA16805@localhost.localdomain> <0193e0c5a52d8f2e93958f0683f3acc81cef2bc9.camel@kernel.crashing.org> <44195c0d7159ce4cd01b660002b2f5af5d53678b.camel@kernel.crashing.org> <184814fb-0caf-b260-4415-8f96fbdf4831@kernel.org> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 List-ID: On Mon, 2018-08-20 at 18:13 -0400, Sinan Kaya wrote: > > I proposed this as one of the possible solutions but presence detect is > optional Is it optional on hotplug capable bridges ? I thought it wasn't ... > and also presence detect interrupt can be delivered after We don't care about the interrupt, we just need to look at the value of the change latch. > link layer interrupt as well. No guarantees with respect to the order of > link layer interrupt and presence detect interrupts delivery. > > I instead look at fatal error pending bit in device status register to > decide if the link down was initiated due to a pending fatal error or > somebody actually removed the card. > > If fatal error is pending, wait until it is cleared. If link is healthy, > return gracefully. > > Otherwise, proceed with the hotplug removal. That could work too but it would be safer to also use the change in presence detect if available. Cheers, Ben.