Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2623438ybi; Mon, 17 Jun 2019 07:54:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6VhwQKk2Q69swa1sq+T1r3ar6be092HlFzGuQHuqpQnFZ80NdSXYqmkwX28bBWVIv4CCg X-Received: by 2002:a17:902:2e81:: with SMTP id r1mr108766518plb.0.1560783276672; Mon, 17 Jun 2019 07:54:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560783276; cv=none; d=google.com; s=arc-20160816; b=RnRPbpplWIJD6nbRw1iVV/zkpyHv4IUkfORRWLZ7OAEydwzU3Aej9PJrZrzUVXYVim yJkLSWgax75Egm3WbptbvrhP73XPU0RUY5Dlv18C9YUFnO/N1iWC19QtxXqC5R8BTqSN PmTLO/qjXT/M8crrwVRcQvK1nUMjTwGBAdvfgfRIZj5wqciYZUwnKTUJa6iPelWG+v+k KZfeMaxTJWRVbKbrPXBoBWJ7amx9UmHhnbB2gQQtFpLr3GUUbguUk7u8iZWoo1kDb+Bo FG75Yc9jO74BMlO2sfxd6jF2dbrzdbokLGJZFrc8MXRTnTOMomw/CENq/GzvwOomoR/1 oYDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=/r/mNmCYZR/pF1Tbg5Ha86qR9jZ6MiiDWQnmhrst/1o=; b=KcDfAs+I6NouYxGq0K8n0JxXh4kYjvNQG5au6oPAAKYCSU3+LA7Cy6fyzBLMHD0Cpf DOqXGKP93BHPm2vgRypqmSWvlCa9aG+czP93Tu1SipGH/gEqj7BG2xZYSBqH6f9xtNFJ vREeRlm69HEW8IE2KDQqoY0C9KS+XhG0+7OBUsXuuAtRA4DpN5z0KMh4bCY/GK9aFwgm /rvFDoDsdVMHsv4C0XCG05uqQdLlgbuODVidXDPHITWUj9P9Y7sPlkU+8xle+RJfsXTP iMjyAHiWW+Wt3Hy2YjQXu284ZO/sRyUFr75ph/znPQu2/6mGHpRSlZ3Gv64g2IE+YaOB 0Vuw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b26si11079333pgl.407.2019.06.17.07.54.21; Mon, 17 Jun 2019 07:54:36 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727997AbfFQOxv (ORCPT + 99 others); Mon, 17 Jun 2019 10:53:51 -0400 Received: from bmailout1.hostsharing.net ([83.223.95.100]:34111 "EHLO bmailout1.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726405AbfFQOxv (ORCPT ); Mon, 17 Jun 2019 10:53:51 -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 "COMODO RSA Domain Validation Secure Server CA" (not verified)) by bmailout1.hostsharing.net (Postfix) with ESMTPS id ACA9C3001237D; Mon, 17 Jun 2019 16:53:48 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 7B4E5417199; Mon, 17 Jun 2019 16:53:48 +0200 (CEST) Date: Mon, 17 Jun 2019 16:53:48 +0200 From: Lukas Wunner To: Mika Westerberg Cc: "Rafael J. Wysocki" , Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, "Rafael J. Wysocki" , Keith Busch , Alex Williamson , Alexandru Gagniuc Subject: Re: [PATCH] PCI/PME: Fix race on PME polling Message-ID: <20190617145348.cqmtuqlvabgpo2ky@wunner.de> References: <0113014581dbe2d1f938813f1783905bd81b79db.1560079442.git.lukas@wunner.de> <1957149.eOSnrBRbHu@kreacher> <20190617143510.GT2640@lahna.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190617143510.GT2640@lahna.fi.intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 17, 2019 at 05:35:10PM +0300, Mika Westerberg wrote: > Today when doing some PM testing I noticed that this patch actually > reveals an issue in our native PME handling. Problem is in > pcie_pme_handle_request() where we first convert req_id to struct > pci_dev and then call pci_check_pme_status() for it. Now, when a device > triggers wake the link is first brought up and then the PME is sent to > root complex with req_id matching the originating device. However, if > there are PCIe ports in the middle they may still be in D3 which means > that pci_check_pme_status() returns 0xffff for the device below so there > are lots of > > Spurious native interrupt" > > messages in the dmesg but the actual PME is never handled. > > It has been working because pci_check_pme_status() returned true in case > of 0xffff as well and we went and runtime resumed to originating device. > > I think the correct way to handle this is actually drop the call to > pci_check_pme_status() in pcie_pme_handle_request() because the whole > idea of req_id in PME message is to allow the root complex and SW to > identify the device without need to poll for the PME status bit. Either that or the call to pci_check_pme_status() should be encapsulated in a pci_config_pm_runtime_get() / _put() pair. Thanks, Lukas