From patchwork Wed Nov 25 09:07:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mika Westerberg X-Patchwork-Id: 1405955 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=linux-pci-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4Cgw5Q5xt1z9s0b for ; Wed, 25 Nov 2020 20:07:38 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725836AbgKYJHi (ORCPT ); Wed, 25 Nov 2020 04:07:38 -0500 Received: from mga01.intel.com ([192.55.52.88]:35359 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725776AbgKYJHh (ORCPT ); Wed, 25 Nov 2020 04:07:37 -0500 IronPort-SDR: 1tsgFErB55rAfAgLAxleQWTGGc+F/wX2W4E/NQvIShwEfmT2GCCunshObER2v9sRo7LoG/DyX0 MdBaT4S1NUqg== X-IronPort-AV: E=McAfee;i="6000,8403,9815"; a="190232552" X-IronPort-AV: E=Sophos;i="5.78,368,1599548400"; d="scan'208";a="190232552" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Nov 2020 01:07:36 -0800 IronPort-SDR: uphSjmss0FpqTYsyXOuLSMrDORa1j2u2mEL8rKRoS5mzno3l3bF8fUT8+uva96xlJhbri//3qg qX5VzwY4vrUw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,368,1599548400"; d="scan'208";a="332907488" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga006.jf.intel.com with ESMTP; 25 Nov 2020 01:07:34 -0800 Received: by black.fi.intel.com (Postfix, from userid 1001) id 6EDD8133; Wed, 25 Nov 2020 11:07:33 +0200 (EET) From: Mika Westerberg To: Bjorn Helgaas , "Rafael J. Wysocki" Cc: Lukas Wunner , David Airlie , Daniel Vetter , Utkarsh Patel , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Mika Westerberg , linux-pci@vger.kernel.org Subject: [PATCH v2 1/2] PCI/PM: Do not generate wakeup event when runtime resuming bus Date: Wed, 25 Nov 2020 12:07:32 +0300 Message-Id: <20201125090733.77782-1-mika.westerberg@linux.intel.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org When a PCI bridge is runtime resumed from D3cold the underlying bus is walked and the attached devices are runtime resumed as well. However, in addition to that we also generate a wakeup event for these devices even though this actually is not a real wakeup event coming from the hardware. Normally this does not cause problems but when combined with /sys/power/wakeup_count like using the steps below: # count=$(cat /sys/power/wakeup_count) # echo $count > /sys/power/wakeup_count # echo mem > /sys/power/state The system suspend cycle might fail at this point if a PCI bridge that was runtime suspended (D3cold) was runtime resumed for any reason. The runtime resume calls pci_wakeup_bus() and that generates wakeup event increasing wakeup_count. Since this is not a real wakeup event we can prevent the above from happening by removing the call to pci_wakeup_event() in pci_wakeup_bus(). Reported-by: Utkarsh Patel Signed-off-by: Mika Westerberg Reviewed-by: Rafael J. Wysocki --- Previous version can be found here: https://www.spinics.net/lists/linux-pci/msg101083.html Changes from the previous version: - Split the patch in two. The second patch only does the rename. - Tried to improve the commit message a bit - Added Rafael's reviewed-by tag drivers/pci/pci.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index e578d34095e9..6f7b33998fbe 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1181,7 +1181,6 @@ EXPORT_SYMBOL_GPL(pci_platform_power_transition); */ static int pci_wakeup(struct pci_dev *pci_dev, void *ign) { - pci_wakeup_event(pci_dev); pm_request_resume(&pci_dev->dev); return 0; }