Re: [RFC PATCH v1 06/22] PCI: use a global lock to serialize PCIroot bridge hotplug operations

From: Jiang Liu
Date: Mon Sep 17 2012 - 11:51:26 EST


>>> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/