Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp37646imb; Thu, 28 Feb 2019 15:14:12 -0800 (PST) X-Google-Smtp-Source: AHgI3Ibca/L9iS7sokI8Zbd+r7SSGVDC4hlFXlx0m7XbE50V5ihlskJ/2FZX3imsdrQ6ySMK1jG0 X-Received: by 2002:a62:1346:: with SMTP id b67mr2256073pfj.195.1551395652460; Thu, 28 Feb 2019 15:14:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551395652; cv=none; d=google.com; s=arc-20160816; b=MetUifRhYjWiZe6wpU/d/K1IrSq1yw0/wpun+pbCoD1R7DkN+q0Ju/1W0p6zn1aj07 w4pyp6LWqW5vBlX6oodKnusc+/n2sjyzWoC5z23SAI+uu/n+94ZtDhU6dgIfXOPSoJ00 4GHqTDyyfDyISxJM6s8vvpZDT5BCFof43J6ElQesCZ9cehvupBJZKLM9M7K8sTIEo5GT 6RY7fLHmRjaP9hVFZlsh8ZWhClEJOQpXKI0SNiyqQYTYNIWHuHcHlrsCU653uORqFcsZ JHS4eNnWjFZnsUGs5c8yDcOZ6b+HxWvH+PwDeG6jh1rXRdbJ1lwljuPcSaJ6FhLWPOb3 G3eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Wo/LUz+YAoHMxzB9Y7V0ETnhY6VR9dzHyL71ShD5rSA=; b=SlzhMgpixHzP1ZoxP3vTcCzDXcSqpoqD1zj5NtqLpqxjFEicyw2XqwqAeNlmKWwQqZ bRt/wDBh4+MjzFbwGJDBkIe4e/6gFPDMQyICyooMFtTHYMuYsTezjS+Z6FEyfL8mSgbn fENBFFqiC55g7tGxso5J2ed6q0NNiQirT8GW6NvlUQ3VcoF7a0ftPYWro3wfaCsoi38b cN8KjU16n80FpLaaTEy9CN2gFB7meTm+byOG0+x5X6CR6zv4TDb28chNouwHYSCdNBQf Qoy7z8gXKKMSFlGa+Qjyg8W8WfncxeQIWlZhzWFtqR/lSLV3E8gw8XrFAXFUFhO1DczZ chgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=LW1Nh+cu; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 23si6054497pfy.16.2019.02.28.15.13.57; Thu, 28 Feb 2019 15:14:12 -0800 (PST) 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; dkim=pass header.i=@google.com header.s=20161025 header.b=LW1Nh+cu; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387520AbfB1Um1 (ORCPT + 99 others); Thu, 28 Feb 2019 15:42:27 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:40454 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731269AbfB1Um1 (ORCPT ); Thu, 28 Feb 2019 15:42:27 -0500 Received: by mail-wm1-f65.google.com with SMTP id g20so9468431wmh.5 for ; Thu, 28 Feb 2019 12:42:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Wo/LUz+YAoHMxzB9Y7V0ETnhY6VR9dzHyL71ShD5rSA=; b=LW1Nh+cuFRwVhlqTTyUjN+fKMDPV5Ij6APlwPDgTrF99V362MKgmc1EF6k1GwDE3OA Gb5ka8IS89BVzhzza5St7D8WNWD58lDqQbqbgNMvqvKMVM/6Gjo96IkYqvQ0+OOhJtDs XGAPEWstafAhSKpsLh+nwAbzWzxTT+bEZu0rrrTckhCOitnGu93xnndgUdLdu4l7DT4J xI8TfWEt48cAOnmwqzYQn+7bxIj+TWTp3cKpNd6o8qPDBeydYfHLLR9IyKBkyIfC+gXH y5KQJGjKWuZIZ+1Cyi5t8B1mRnzDOKtkwVSYii5hOVdQ8A04ArO3ec3ySso3w7UgVGW7 HCMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Wo/LUz+YAoHMxzB9Y7V0ETnhY6VR9dzHyL71ShD5rSA=; b=TFjxI/p9SabJhaVys2QoB7XpgbajM/mWcDy9jhBrfyRYsdxHnK6zfZZn+LsvQrGkT6 j+tZOvoEaL6/w4WWyjXTTuDffDvkqjDeHFsdVbbLkXefMAR6pQThASGtqL9johM11RVA auTkAacFs8mylE7G+zF3xhRZkOIxhQ0TSIkqfawbppumUyEyYCq31DhVzr1NKgwfPbRn yw7yuAXCINKKigYmGRKEMk9OJxUmX9JjnjE8FqrefdGD1euOxlIHebM7kwHIdBKpRctP RoZoYPRqFqOjy/SCYpPEYxkuzNSLcHwe148l/Zet1vAGul70Sn1fsysaLabhOr44SMFO UgqQ== X-Gm-Message-State: APjAAAXdYGKUrthDQ+WZUPgds5GEvNL0q/A6cArNdbmzFzB+D4QwsqJS 8AUDyUh5EKIgavvt7tn2E6CcOUnOCIIIo9RdIMhe X-Received: by 2002:a1c:6409:: with SMTP id y9mr1048634wmb.68.1551386545111; Thu, 28 Feb 2019 12:42:25 -0800 (PST) MIME-Version: 1.0 References: <1943648.NMEmlssb0J@aspire.rjw.lan> In-Reply-To: <1943648.NMEmlssb0J@aspire.rjw.lan> From: Bjorn Helgaas Date: Thu, 28 Feb 2019 14:42:13 -0600 Message-ID: Subject: Re: [PATCH] PCI: PCIe: PME: Fix pcie_pme_remove() To: "Rafael J. Wysocki" Cc: Dongdong Liu , Lukas Wunner , Linux PCI , Linux PM , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 27, 2019 at 5:58 PM Rafael J. Wysocki wrote: > > From: Rafael J. Wysocki > > It is incorrect to call pcie_pme_suspend() from pcie_pme_remove() for > two reasons. > > First, pcie_pme_suspend() calls synchronize_irq() that will wait for > the native hotplug interrupt handler as well as for the PME one, > because they share one IRQ (as per the spec). That may deadlock if > hotplug is signaled while pcie_pme_remove() is running and the latter > calls pci_lock_rescan_remove() before the former. > > Second, if pcie_pme_suspend() figures out that wakeup needs to be > enabled for the port, it will return without disabling the interrupt > as expected by pcie_pme_remove() which was overlooked by commit > c7b5a4e6e8fb ("PCI / PM: Fix native PME handling during system > suspend/resume"). > > To fix that, rework pcie_pme_remove() to disable the PME interrupt, > clear its status and prevent the PME worker function from re-enabling it > before calling free_irq() on it which should be sufficient. > > Fixes: c7b5a4e6e8fb ("PCI / PM: Fix native PME handling during system suspend/resume") > Reported-by: Dongdong Liu > Signed-off-by: Rafael J. Wysocki I added the deadlock details from Dongdong and applied this to pci/pm for v5.1, thanks! Bjorn