Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2436633ybl; Mon, 19 Aug 2019 01:57:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqx2jIrWDYpL+VNcmHGoEYnLw5Avo0rdbWMJ9Eu33H7rwONFz1UvUp+rXS3Gg5MP5GzaFE1f X-Received: by 2002:a17:902:4b:: with SMTP id 69mr21453540pla.89.1566205076574; Mon, 19 Aug 2019 01:57:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566205076; cv=none; d=google.com; s=arc-20160816; b=ZK1qjmi6ANUuhsswg2jnZzy2ijX3visy5b9EfIy2sLKUjmWEWclsg6pLM4KQ2E4+6A nWL6t3kY/Eq5jUUX8db2QWra1mMfcRWP4vpesH/iUKFT6+lO/LQWrfrZ4lhvCHAnZlZK P3TkoMgnb1k0w9OP3F0tlVQgzRjVi7Xu6RFg2mIEhOAMsFtS6yhpXRdIOdW3/7sdsODr +FzD0JfmuzpZtHlZQZTjMcOCRf4TWuiQzr5OAj8MF6gFQVRvwzmuQxKfZh+hvPCf5SFs H3rs8Bmz9bijN1GLxRXBmCgKBBCL2fn70BluUxpqrGM4c4ix2IAE0jY8gh0jcL68TiF0 nDUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=2pKvD/7E2lPKkWA2U7gxf92R17jPntzaWZ+qfEvk/gk=; b=WvaTvvTFRa+MoFUhoi7wFw3srDu3Fh1YuYyGaErzYejBQ+2n2hozapclcfevwDqIfZ /lIKPKHndmnBevI36P9n+MEwnFo7PvtAJdqiJuOwaqDmId7IADm66BLxKzg0yp6MC1e1 hRzq0t7j/mP+uA2jGJVjg6QYsxtpPe+gztGIQcHF8vAdT+plyBrtLd5swvkdoo5SgoN6 aofRQ42NxOH+DLtoi+RzsNJULyvk8ztasHiWfK7rTst80ujOjjdGEsz7YYft+vWxVdNT AAlPH30NUukhOsqFXtU5sWVJAO5HCU2gkDfbfzV3678RyDT18PateSh8emfmy3fNOmBg 1LJg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n187si8224492pga.165.2019.08.19.01.57.41; Mon, 19 Aug 2019 01:57:56 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727317AbfHSI40 (ORCPT + 99 others); Mon, 19 Aug 2019 04:56:26 -0400 Received: from mga03.intel.com ([134.134.136.65]:2887 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726186AbfHSI4Z (ORCPT ); Mon, 19 Aug 2019 04:56:25 -0400 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Aug 2019 01:56:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,403,1559545200"; d="scan'208";a="195493515" Received: from lahna.fi.intel.com (HELO lahna) ([10.237.72.157]) by fmsmga001.fm.intel.com with SMTP; 19 Aug 2019 01:56:21 -0700 Received: by lahna (sSMTP sendmail emulation); Mon, 19 Aug 2019 11:56:20 +0300 Date: Mon, 19 Aug 2019 11:56:20 +0300 From: Mika Westerberg To: Sinan Kaya Cc: Bjorn Helgaas , "Rafael J. Wysocki" , Lukas Wunner , Keith Busch , Andy Shevchenko , Frederick Lawler , "Gustavo A . R . Silva" , Kai-Heng Feng , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] PCI: pciehp: Prevent deadlock on disconnect Message-ID: <20190819085620.GM19908@lahna.fi.intel.com> References: <20190812143133.75319-1-mika.westerberg@linux.intel.com> <20190812143133.75319-2-mika.westerberg@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Aug 18, 2019 at 10:28:13PM -0400, Sinan Kaya wrote: > On 8/12/2019 10:31 AM, Mika Westerberg wrote: > > +int pciehp_card_present_or_link_active(struct controller *ctrl) > > { > > - return pciehp_card_present(ctrl) || pciehp_check_link_active(ctrl); > > + int ret; > > + > > + ret = pciehp_card_present(ctrl); > > + if (ret) > > + return ret; > > + > > + return pciehp_check_link_active(ctrl); > > The semantics of this function changed here. Before it was checking for > either presence detect bit or link active bit. Now, it is looking to > have both set. Hmm, maybe I haven't got enough coffee yet but I'm not sure I understand :) The intention was that the above two are equivalent with the exception of handling the possible error. > There are PCI controllers that won't report presence detect correctly, > but still report link active. If that's the case then pciehp_card_present() returns false so we call pciehp_check_link_active() which should work with those controllers. What I'm missing here?