From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pb0-f46.google.com ([209.85.160.46]:59798 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932093Ab2IQPve (ORCPT ); Mon, 17 Sep 2012 11:51:34 -0400 Message-ID: <505746FA.5030904@gmail.com> Date: Mon, 17 Sep 2012 23:51:22 +0800 From: Jiang Liu MIME-Version: 1.0 To: Bjorn Helgaas CC: Don Dutile , Yinghai Lu , Greg KH , Kenji Kaneshige , Jiang Liu , Taku Izumi , "Rafael J . Wysocki" , Yijing Wang , Xinwei Hu , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: Re: [RFC PATCH v1 06/22] PCI: use a global lock to serialize PCI root bridge hotplug operations References: <1344355862-2726-1-git-send-email-jiang.liu@huawei.com> <1344355862-2726-7-git-send-email-jiang.liu@huawei.com> <5050AD65.1000801@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-pci-owner@vger.kernel.org List-ID: >>> I'm not sure why you didn't add a pci_host_bridge_hotplug_lock() in >>> the sba_init() path, since it looks similar to the drm_open_helper() >>> path above. But in any case, I think that would be the wrong thing to >>> do because it would fix the superficial problem while leaving the >>> deeper problem of host bridge hot-add not setting the iommu pointer. > >> sba_init is called during system initialization stages through subsys_initcall, >> so no extra protection for it. > > OK, I see your reasoning. But I don't agree :) All the users of an > interface should use the same locking scheme, even if they're at > boot-time where we "know" we don't need it. It's too hard to analyze > differences, and code gets copied from one place to somewhere else > where it might not be appropriate. Hi Bjorn, "All the users of an interface should use the same locking scheme", a really good design pattern to follow. It's so easy for everybody to remove the __init modifier without noticing the design limitation. --Gerry