Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2790232pxf; Sun, 28 Mar 2021 02:12:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxP/37dnYmLzKFEsDzbUKUSYurE4E9p4iTQpyD0xwolNEVnb+m+nYAhYSd1sE/X0OBFXdk6 X-Received: by 2002:a05:6402:c:: with SMTP id d12mr23180028edu.100.1616922755941; Sun, 28 Mar 2021 02:12:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616922755; cv=none; d=google.com; s=arc-20160816; b=b7tCG3twuabf2tH20KGC8kAcA/OiqVO3ZFbVWl6Wx/bSmp7QxhWSkSi262aoQ815NM rvbc1t+EAAC4utJFz+9gYzWsr/FNvaYEKr2/xTGyOcNInOl9S1JSU4uO5V/Wlhr2laGB +gLEnVicb5sAhqssYole0/RA/+iaoBXm5+qfJhpVH2jYGp1A8bNUdwsqNDwwp3qzzB6k S59iqN8kLqL+IMpVAxNsPFBA3w5uW8HMazhnt44BOsSQVVgDt/WQwlS1ij6mzR2+7lby 4h1XHM5SugD4rP/tZ3Ry1hEBZ1mLNFAaaeuYPBq65Km6orC8SegRHSyQtnXDQZKO/I4s Rq/Q== 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=mdYASIujFBbFbWafV8FsdE2J2ZFAj4t19qaKlQ85vrE=; b=pS1HnCcijHeysX2DHeWzdQM79lumgmty0e0h78e8HdnSXrTST1WyKhXNVy+HQcxk49 5Aomj7uD4fWKReNuMUESRUjQFvoCNA8ltkkSUa4otSv4AMjBAbQ0Vx9XfHswgZ5dU9SN slmfoMkUT2a/x+rKBPO0UDYExhuvFost2OEFgZsWpoa51pJelC3OfnwSZGQq4ZMkOTIQ 5ReJky3Vgf2Mr5bceWLRt1B8sG4iIeFbnMRSBkvpaLF6n6X1YcmSwOjNZd7Tsi/2WiU/ 1Tk1mUWtPmh3RGNAaJNub8o74m2RXQXplWPAE0mPCkZ46zZ1J2QwCCgoF6j89nNs91iU j25g== 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 m3si10870375ejl.510.2021.03.28.02.12.13; Sun, 28 Mar 2021 02:12:35 -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 S231173AbhC1JHg (ORCPT + 99 others); Sun, 28 Mar 2021 05:07:36 -0400 Received: from bmailout2.hostsharing.net ([83.223.78.240]:38107 "EHLO bmailout2.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230454AbhC1JHK (ORCPT ); Sun, 28 Mar 2021 05:07:10 -0400 Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (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 bmailout2.hostsharing.net (Postfix) with ESMTPS id 6DB092800B3E0; Sun, 28 Mar 2021 11:07:08 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 59BBE8178; Sun, 28 Mar 2021 11:07:08 +0200 (CEST) Date: Sun, 28 Mar 2021 11:07:08 +0200 From: Lukas Wunner To: "Kuppuswamy, Sathyanarayanan" Cc: bhelgaas@google.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, ashok.raj@intel.com, dan.j.williams@intel.com, kbusch@kernel.org, knsathya@kernel.org, Sinan Kaya Subject: Re: [PATCH v2 1/1] PCI: pciehp: Skip DLLSC handling if DPC is triggered Message-ID: <20210328090708.GA20590@wunner.de> References: <59cb30f5e5ac6d65427ceaadf1012b2ba8dbf66c.1615606143.git.sathyanarayanan.kuppuswamy@linux.intel.com> <20210317041342.GA19198@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 Sat, Mar 27, 2021 at 10:49:45PM -0700, Kuppuswamy, Sathyanarayanan wrote: > On 3/16/21 9:13 PM, Lukas Wunner wrote: > > --- a/drivers/pci/hotplug/pciehp_hpc.c > > +++ b/drivers/pci/hotplug/pciehp_hpc.c > > @@ -707,6 +707,17 @@ static irqreturn_t pciehp_ist(int irq, void *dev_id) > > } > > /* > > + * Ignore Link Down/Up caused by Downstream Port Containment > > + * if recovery from the error succeeded. > > + */ > > + if ((events & PCI_EXP_SLTSTA_DLLSC) && pci_dpc_recovered(pdev) && > > + ctrl->state == ON_STATE) { > > + atomic_and(~PCI_EXP_SLTSTA_DLLSC, &ctrl->pending_events); > > Why modify pending_events here. It should be already be zero right? "pending_events" is expected to contain the Link Up event after successful recovery, whereas "events" contains the Link Down event (if DPC was triggered). pciehp is structured around the generic irq core's separation of hardirq handler (runs in interrupt context) and irq thread (runs in task context). The hardirq handler pciehp_isr() picks up events from the Slot Status register and stores them in "pending_events" for later consumption by the irq thread pciehp_ist(). The irq thread performs long running tasks such as slot bringup and bringdown. The irq thread is also allowed to sleep. While pciehp_ist() awaits completion of DPC recovery, a DLLSC event will be picked up by pciehp_isr() which is caused by link retraining. That event is contained in "pending_events", so after successful recovery, pciehp_ist() can just delete it. Thanks, Lukas