Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1150472imm; Tue, 3 Jul 2018 06:26:22 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd4I3zUAX60TBhW3p8hXS2IE1n1n8JItEVxSvIVSRGhTOkO4xyi+p6X8Mb8XwngvPQrFcPj X-Received: by 2002:a63:f919:: with SMTP id h25-v6mr6517197pgi.401.1530624382521; Tue, 03 Jul 2018 06:26:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530624382; cv=none; d=google.com; s=arc-20160816; b=glOSi2vsJpGRvwYz9RQMp6VitIg8m9EdVmY2I/JaZAEFX1nCVJM745gp2WIcE1hF3f hM9HBzrxxz9fIkLMgJ2YuYfBfP4BFFmNxFhz2nf7TZ47m4EjiY8WTUovWuh3e0Nxktrs m8tU0UQR4mpzlE4PuIF49SawTYverxH3++2fKKSyM3iFBLm79FOvKh+Dq0fNXs9RkKLf fCHgiCmTeLEbPul7kO8N5yqaqyGcnNwGZyhilITEQBl2vhlsO7yaCnzmlWt1JoRGFI/f yrAiHCk8EoMr212pe/XKL8yYsuJrJqnTvxmyiOIhzHjbsYvI1JerLQVv8xHrJ9tzhuj3 2KHQ== 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:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=v+4n0Ff8/XJVqxoOi2zsIc5nMFRVnJH3Fx+SddUP8A8=; b=C4500O29xB2LVjNnXW6/P72E0rjIrGq6BwBPhQ+KkK+q9uWinQfZxPI2+0QqMVeTQB zqtP0DysvuGBCtx8qM2YaqCbt4Be3OJsrunEYBkdTQ/Py7Is6FzN/q8cN6nbTXgba9Dd 54USeK2d505R8/7XfwwJUWjhZ+PJY7aa6taP15EulP/adKwyRVaiDxlRYk9HJjB11ozg cF9VGYnashjDfyxJydLCbWHJBLRSznkzTDhL5SluYUavWPA1fRwX6cixWFG7tu63hIto FkBFlTx9c7Y/3P9Dvlfn+yXoU/j0yxflDRhsWT+LiEkyuNNMEln70/A1qSU1uonHVSac foeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=WFVphuVI; dkim=pass header.i=@codeaurora.org header.s=default header.b=WFVphuVI; 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 s3-v6si1077895plp.443.2018.07.03.06.26.07; Tue, 03 Jul 2018 06:26:22 -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=@codeaurora.org header.s=default header.b=WFVphuVI; dkim=pass header.i=@codeaurora.org header.s=default header.b=WFVphuVI; 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 S1753307AbeGCNZV (ORCPT + 99 others); Tue, 3 Jul 2018 09:25:21 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:51882 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752423AbeGCNZT (ORCPT ); Tue, 3 Jul 2018 09:25:19 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id D4F5660B27; Tue, 3 Jul 2018 13:25:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1530624318; bh=pAFHu8wUG8kOBiLRZ41P7G/M9DGhyOSQRRCshAbM01M=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=WFVphuVInRXZoLiDSafpWjD+oxOEjCtATEnHEoJ1B4FhT+J7e74ZeL0krseAoNwHd WavYFRKMfi59VQOI7UCFC3cmpyPw0i0VcQL3Tk1Hu9fexofHuhFKiB1zmausMioQ8I tRSsBvUgOdxyLNkqQPmquk4rszInZadECOw4SKH8= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [192.168.0.117] (cpe-174-109-247-98.nc.res.rr.com [174.109.247.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 4DD486063F; Tue, 3 Jul 2018 13:25:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1530624318; bh=pAFHu8wUG8kOBiLRZ41P7G/M9DGhyOSQRRCshAbM01M=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=WFVphuVInRXZoLiDSafpWjD+oxOEjCtATEnHEoJ1B4FhT+J7e74ZeL0krseAoNwHd WavYFRKMfi59VQOI7UCFC3cmpyPw0i0VcQL3Tk1Hu9fexofHuhFKiB1zmausMioQ8I tRSsBvUgOdxyLNkqQPmquk4rszInZadECOw4SKH8= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 4DD486063F Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=okaya@codeaurora.org Subject: Re: [PATCH V5 3/3] PCI: Mask and unmask hotplug interrupts during reset To: poza@codeaurora.org Cc: Lukas Wunner , linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Bjorn Helgaas , Keith Busch , open list References: <1530571967-19099-1-git-send-email-okaya@codeaurora.org> <1530571967-19099-4-git-send-email-okaya@codeaurora.org> <20180703083447.GA2689@wunner.de> <8b6ce0f415858463d1c0588c29e30415@codeaurora.org> <9e871cc3978fbdca12ccf8a91f34ad07@codeaurora.org> From: Sinan Kaya Message-ID: <2640af5e-f00f-d814-425d-78ac57714f6d@codeaurora.org> Date: Tue, 3 Jul 2018 09:25:15 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <9e871cc3978fbdca12ccf8a91f34ad07@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > what if we only have conditional enumeration ?  (leaving removing devices followed by SBR as is) ? > If we leave it as is, hotplug driver observes a link down interrupt as soon as secondary bus reset is issued. Hotplug driver will try device removal while AER driver is working on the currently observe FATAL error causing a race condition. Hotplug driver wait for rescan lock to be obtained. > following code is doing little more extra work than our normal ERR_FATAL path. > See this comment and the pseudo code below. /* * pciehp has a 1:1 bus:slot relationship so we ultimately want a secondary * bus reset of the bridge, but at the same time we want to ensure that it is * not seen as a hot-unplug, followed by the hot-plug of the device. Thus, * disable link state notification and presence detection change notification * momentarily, if we see that they could interfere. Also, clear any spurious * events after. */ int pciehp_reset_slot(struct slot *slot, int probe) { } This patch is trying to mask the interrupt before secondary bus reset in AER path not after. Otherwise, hotplug driver will remove the devices as soon as it obtains the rescan lock following AER recovery since hotplug interrupts will be pending. > pciehp_unconfigure_device doing little more than enumeration to quiescence the bus. > > /* >          * Ensure that no new Requests will be generated from >          * the device. >          */ >         if (presence) { >             pci_read_config_word(dev, PCI_COMMAND, &command); >             command &= ~(PCI_COMMAND_MASTER | PCI_COMMAND_SERR); >             command |= PCI_COMMAND_INTX_DISABLE; >             pci_write_config_word(dev, PCI_COMMAND, command); >         } > > > >> >>> >>> That would seem like a much simpler solution, given that it is known >>> that the link will flap on reset, causing the hotplug driver to remove >>> and re-enumerate devices.  That would also cover cases where hotplug is >>> handled by a different driver than pciehp, or by the platform firmware. >>> >>> Thanks, >>> >>> Lukas > -- Sinan Kaya Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.