Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3523149ybg; Mon, 28 Oct 2019 14:18:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqxzQxoxPgng6C1n70WTEuWmVcaZITZiTyuzdZh3iY4NJKbCq1jK7a2ao2Af55U/2EN1CwmG X-Received: by 2002:a17:906:4b16:: with SMTP id y22mr19083060eju.56.1572297481991; Mon, 28 Oct 2019 14:18:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572297481; cv=none; d=google.com; s=arc-20160816; b=U9YAK+wZL6gpy4PdWeqCJE+OsouPa6RtWMHfjDUPNduCWaEVpfdgqHtfkHCLpQzl9f rGw4nTc1Uhof3eAY6IiDp6MhWQ3vfLj/ljZOzOm+zmEJZT1JhDkc8eDkkxdUwxlF/6N7 UVInrhM14fgKZUYqkUcRogDUy8G4TFwzpzcLLE8I7aSbd9qE2rvR9raOyfwDPejubX07 UUMtVDi0NZjw20ASDwk/XBXXnw0VgOzoLwWoHPwSELf68G6c370fA/81+TltRACntX+r om1XSnbuvi8QrAlVMmWrtd6lfs+bAk4iNTlBMG8UvvvGOYs9v80K2YH5N4Xepr075oBO xQcw== 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:dkim-signature; bh=GRzG+D+EP5Y4GBT80JjuD057rfFJXLiQlYewtqIWXho=; b=MgkgxXzIK+SXBiQJfF25aKkZNRznHQsa2StyndQ3k50fyML6VPYgXYPaedoke0qBPv i6dPkfIIHSHFARNkQPz5XhKTvI6RTdAIjMxrRy6y65XGxYZJ7zqbI8q1Eov5KX+G5uU9 9+h2q+dgMtPXBl6Ou/D4C895TlSpR+GWatijHLlBTu1CPJaonXPkSbBmWBnIPnwB6ulJ YVlFhW6ahqNN/n/ubFkvSCzl9jzrJ1Cn5694oDJn+6s5R0bGXUfEmv7bFdFMFlC6Dl69 mYWNjYXf8Qtg4CighTmEJc3w8+ibqmbHKVRcyCjQcBbEfD0pdMw77obcqlVEq1dX8MCI nzGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="uxYjW9/k"; 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 i52si2448512ede.65.2019.10.28.14.17.38; Mon, 28 Oct 2019 14:18:01 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="uxYjW9/k"; 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 S1732741AbfJ1Qaq (ORCPT + 99 others); Mon, 28 Oct 2019 12:30:46 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:47700 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730494AbfJ1Qaq (ORCPT ); Mon, 28 Oct 2019 12:30:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=GRzG+D+EP5Y4GBT80JjuD057rfFJXLiQlYewtqIWXho=; b=uxYjW9/kDRXPaB3lgbUvwENbu ZQ6mKzPyrL0cC/t3n5wJU4GmHyBPXJk3SJ9vd6w3qnuwdnTlAwIPNfsUInTMKQyRZ2FvTweKHc9Nm kBdzDvDRnT4Lp6936/JiW+/J/RljZEkckZpVpzllfnyXVxN36/QhRbHvvc2n+iVPt/B6oEXLUXMoQ 7x59LIK/dmit3HQumIEb87qdx4D5qX/XhSsG66DiJ0oG4/7Ntori1TOGdrDFKfhDuwgC0RThwKZQU Q3XHUgbbkeGmJLL7/Nv778t0F03/mbAZqewoc4+U6OXEVuzJDka23xKnTtBo9rhQ+yDaH+O95pZYy +Jt9TM80A==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1iP7uj-0006Uv-OI; Mon, 28 Oct 2019 16:30:41 +0000 Date: Mon, 28 Oct 2019 09:30:41 -0700 From: Matthew Wilcox To: Xiang Zheng Cc: bhelgaas@google.com, wangxiongfeng2@huawei.com, wanghaibin.wang@huawei.com, guoheyi@huawei.com, yebiaoxiang@huawei.com, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, rjw@rjwysocki.net, tglx@linutronix.de, guohanjun@huawei.com, yangyingliang@huawei.com Subject: Re: [PATCH] pci: lock the pci_cfg_wait queue for the consistency of data Message-ID: <20191028163041.GA8257@bombadil.infradead.org> References: <20191028091809.35212-1-zhengxiang9@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191028091809.35212-1-zhengxiang9@huawei.com> 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 Mon, Oct 28, 2019 at 05:18:09PM +0800, Xiang Zheng wrote: > Commit "7ea7e98fd8d0" suggests that the "pci_lock" is sufficient, > and all the callers of pci_wait_cfg() are wrapped with the "pci_lock". > > However, since the commit "cdcb33f98244" merged, the accesses to > the pci_cfg_wait queue are not safe anymore. A "pci_lock" is > insufficient and we need to hold an additional queue lock while > read/write the wait queue. > > So let's use the add_wait_queue()/remove_wait_queue() instead of > __add_wait_queue()/__remove_wait_queue(). As I said earlier, this reintroduces the deadlock addressed by cdcb33f9824429a926b971bf041a6cec238f91ff