Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp639895pxf; Wed, 17 Mar 2021 12:11:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzf5GukhsNBrFirsTkl56ouKHnmBtSoV7lo56oiEIQLiF4MDCcoMctadNrhne/2zVToAVu X-Received: by 2002:a17:906:229b:: with SMTP id p27mr38423538eja.287.1616008302703; Wed, 17 Mar 2021 12:11:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616008302; cv=none; d=google.com; s=arc-20160816; b=YA8KHG9ij0NCbtXE4fF6grx6+spN1ajKRYOeUUSSMToM15dNP8c+3PR05MWLD8+qrC /ywjVYND4kGDSjkmHDbAKFsqKksgooVV7TkSG9aXZmYa4Kk5LjwQ0w6s0tgCsIvNEJbU UputyIdx2Qgq7BpuigNb2vl1Fm5jwi2fdFykt4dmQzVw2zde+Yu7Jk1gVIFxu8AXmlnx 02BLFwjIsqJNAkwTTQuf2/ejb8cYMF9Ym32lDegCYpNKBuByYV2HyP2hPPlvUb7/1rQI 84aIqaJnRvEl430yMPU//zFsHif3bGA9wGxbrLRWXxnxWwT0fLQi57ex2GR2sXUI6kvX S5mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=NKTW8XkVtRJbkpxgxjphC/6/bu478tmWGq/uCtRRi80=; b=LXVbkpL7acYcH6uGb/D3u6hJP/Nd5mn4nhgK5cgGj3B+D0i2qlGqC/Ty+/7W2rFC2R U0qWcDYyXyhz5290AWPIriBkraJPDCNHgE0IrYtaBEEv+t0IO/8VY7c/idBUdp/HvWxJ gRP5jUfeOdpBjBkSqrPgVlZwmMJhUaSv7mNltwfGIfI/EO+B4l4pV0oANYn/ada3HNtM 5p3wrlGJY7D+iN0Rp73jeTCTfvt/UMQlLIS0eSxuQ3rA3PR5RKc/wmcAnkdIQ/ahGdFa eFvTA+pcUtefuRIBMsKrmMVf30tKjD99lsu9WMZbuFn79MzjcDEEuGgUCsVS4tOjhRRG 6KgQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k13si17377906edr.48.2021.03.17.12.11.19; Wed, 17 Mar 2021 12:11:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232865AbhCQTKR (ORCPT + 99 others); Wed, 17 Mar 2021 15:10:17 -0400 Received: from bmailout3.hostsharing.net ([176.9.242.62]:44953 "EHLO bmailout3.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232976AbhCQTJ4 (ORCPT ); Wed, 17 Mar 2021 15:09:56 -0400 Received: from h08.hostsharing.net (h08.hostsharing.net [IPv6:2a01:37:1000::53df:5f1c:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "RapidSSL TLS DV RSA Mixed SHA256 2020 CA-1" (verified OK)) by bmailout3.hostsharing.net (Postfix) with ESMTPS id BC444100D940D; Wed, 17 Mar 2021 20:09:52 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 88A032A9D51; Wed, 17 Mar 2021 20:09:52 +0100 (CET) Date: Wed, 17 Mar 2021 20:09:52 +0100 From: Lukas Wunner To: Dan Williams Cc: Sathyanarayanan Kuppuswamy Natarajan , Kuppuswamy Sathyanarayanan , Bjorn Helgaas , Linux PCI , Linux Kernel Mailing List , "Raj, Ashok" , Keith Busch , knsathya@kernel.org, Sinan Kaya Subject: Re: [PATCH v2 1/1] PCI: pciehp: Skip DLLSC handling if DPC is triggered Message-ID: <20210317190952.GB27146@wunner.de> References: <59cb30f5e5ac6d65427ceaadf1012b2ba8dbf66c.1615606143.git.sathyanarayanan.kuppuswamy@linux.intel.com> <20210317041342.GA19198@wunner.de> <20210317053114.GA32370@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 17, 2021 at 10:45:21AM -0700, Dan Williams wrote: > Ah, ok, we're missing a flush of the hotplug event handler after the > link is up to make sure the hotplug handler does not see the Link Up. > I'm not immediately seeing how the new proposal ensures that there is > no Link Up event still in flight after DPC completes its work. > Wouldn't it be required to throw away Link Up to Link Up transitions? If you look at the new code added to pciehp_ist() by my patch... atomic_and(~PCI_EXP_SLTSTA_DLLSC, &ctrl->pending_events); if (pciehp_check_link_active(ctrl) > 0) events &= ~PCI_EXP_SLTSTA_DLLSC; ... the atomic_and() ignores the Link Up event which was picked up by the hardirq handler pciehp_isr() while pciehp_ist() waited for link recovery. Afterwards, the Link Down event is only ignored if the link is still up: If the link has gone down again before the call to pciehp_check_link_active(), that event is honored immediately (because the DLLSC event is then not filtered). If it goes down after the call, that event will be picked up by pciehp_isr(). Thus, only the DLLSC events caused by DPC are ignored, but no others. A DLLSC event caused by surprise removal during DPC may be incorrectly ignored, but the expectation is that the ensuing Presence Detect Changed event will still cause bringdown of the slot after DPC has completed. Hardware does exist which erroneously hardwires Presence Detect to zero, but that's rare and DPC-capable systems are likely not affected. I've realized today that I forgot to add a "synchronize_hardirq(irq);" before the call to atomic_and(). Sorry, that will be fixed in the next iteration. Thanks, Lukas