Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3617770pxk; Tue, 29 Sep 2020 01:29:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVcAOgyyI3aL7Zmt3z/aH0nSsxCxu6HefBh+R05hFs9SvVCOCCfBl8+C5yXqJ1jiauhFa0 X-Received: by 2002:a17:906:2747:: with SMTP id a7mr2673664ejd.301.1601368142341; Tue, 29 Sep 2020 01:29:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601368142; cv=none; d=google.com; s=arc-20160816; b=GGdnWwwULvER6tDwa0VM7OoVYETYtqR6dVUPgbqz76h/oIt/6knAZCGPuCgXGoVeHc xIgMniJwKNn8mOf1SHFlqV2IGpCjKp+N7uVgZCBKedDTF0B92pl4FgyE3oHHJVHpf85t Xma2NVBVAkTd63GeiUjdJ4bTtN0eGKLgjoHBxqaK47EMB3qlHkIYbusXVThdiNFdtPW/ JehGQD3QtO98UmLy5Qvy7GUclzpjLvmCkKgMCErpql3slCQfvr+jlo5xJJ9hhhrfZcXi Lsihh7SSe1t7nmpJtLdsgL7UIGD/92WnITeVMA9ai/nuuJSOSrcuLIfoMayOcZxzxrnp 3rcQ== 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=zM4GbGNwrPDKs35Sz19xAVOL9CJfd43cqym15WLGZKQ=; b=v76u5YaLPdWseGxWvgQFyzVGXs3Fkl2kFQJMHljK7XMkzB6MWn5qqZM6rR07mU9csT obNkyG8r69O9E9vetRF9GVqRcN1egDx6Dat2ww6uSoIKXrVWS1z5lombftKOVrOJGuz9 xGiTSUc/5m5doSP9+HH3JA11oP10gwaVm0DSZtQ2AURMm+QLiJ/xFj7cdVLXvssKYXOg /85EgyZXDnjDScWWfRU+Azg8UT3I7U/l+52sKNCOeuVJBQbPVYV2n3mFKDESZ922WYG7 4UECd73khi00wmQazQmB3xVw3Gk1NpJPOnstdMGsFQYwEIx6PTTNG3nXNeMZQlE2ZTqc LGAA== 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 b19si2237282edy.519.2020.09.29.01.28.39; Tue, 29 Sep 2020 01:29:02 -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 S1727796AbgI2I1S (ORCPT + 99 others); Tue, 29 Sep 2020 04:27:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725468AbgI2I1S (ORCPT ); Tue, 29 Sep 2020 04:27:18 -0400 X-Greylist: delayed 554 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 29 Sep 2020 01:27:18 PDT Received: from bmailout1.hostsharing.net (bmailout1.hostsharing.net [IPv6:2a01:37:1000::53df:5f64:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34456C061755; Tue, 29 Sep 2020 01:27:18 -0700 (PDT) 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 "COMODO RSA Domain Validation Secure Server CA" (not verified)) by bmailout1.hostsharing.net (Postfix) with ESMTPS id C9ACA3000C988; Tue, 29 Sep 2020 10:18:00 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 91B9959759; Tue, 29 Sep 2020 10:18:00 +0200 (CEST) Date: Tue, 29 Sep 2020 10:18:00 +0200 From: Lukas Wunner To: Sinan Kaya Cc: Ethan Zhao , bhelgaas@google.com, oohall@gmail.com, ruscur@russell.cc, andriy.shevchenko@linux.intel.com, stuart.w.hayes@gmail.com, mr.nuke.me@gmail.com, mika.westerberg@linux.intel.com, Keith Busch , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, pei.p.jia@intel.com, ashok.raj@linux.intel.com, sathyanarayanan.kuppuswamy@intel.com Subject: Re: [PATCH 2/5 V2] PCI: pciehp: check and wait port status out of DPC before handling DLLSC and PDC Message-ID: <20200929081800.GA15858@wunner.de> References: <20200927032829.11321-1-haifeng.zhao@intel.com> <20200927032829.11321-3-haifeng.zhao@intel.com> 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 Sun, Sep 27, 2020 at 11:27:46AM -0400, Sinan Kaya wrote: > On 9/26/2020 11:28 PM, Ethan Zhao wrote: > > --- a/drivers/pci/hotplug/pciehp_hpc.c > > +++ b/drivers/pci/hotplug/pciehp_hpc.c > > @@ -710,8 +710,10 @@ static irqreturn_t pciehp_ist(int irq, void *dev_id) > > down_read(&ctrl->reset_lock); > > if (events & DISABLE_SLOT) > > pciehp_handle_disable_request(ctrl); > > - else if (events & (PCI_EXP_SLTSTA_PDC | PCI_EXP_SLTSTA_DLLSC)) > > + else if (events & (PCI_EXP_SLTSTA_PDC | PCI_EXP_SLTSTA_DLLSC)) { > > + pci_wait_port_outdpc(pdev); > > pciehp_handle_presence_or_link_change(ctrl, events); > > + } > > up_read(&ctrl->reset_lock); > > This looks like a hack TBH. > > Lukas, Keith; > > What is your take on this? > Why is device lock not protecting this situation? > > Is there a lock missing in hotplug driver? According to Ethan's commit message, there are two issues here: One, that pciehp may remove a device even though DPC recovered the error, and two, that a null pointer deref occurs. The latter is most certainly not a locking issue but failure of DPC to hold a reference on the pci_dev. Thanks, Lukas