Why do we check for "link-up" in *_pcie_valid_device()?

Jingoo Han jingoohan1 at gmail.com
Fri Dec 15 10:39:50 PST 2017


On Thursday, December 14, 2017 5:58 PM, Bjorn Helgaas wrote:
> 
> Hi all,
> 
> In the PCI config access path, the *_pcie_valid_device() functions in
> the dwc, altera, rockchip, and xilinx drivers all check whether the
> link is up.
> 
> I think this is racy because the link may go down after we check but
> before we perform the config access.
> 
> What would blow up if we removed the *_pcie_link_up() checks?

The original intention is to avoid config access before link up.

Also, I did not find any racy condition as you mentioned.
However, if you think that we need to prevent the racy condition,
someone can send a patch or add comments.

Best regards,
Jingoo Han

> 
> I'd like to either remove the checks or add comments about why the
> race is acceptable.  If we've covered this before, I apologize.
> Adding a comment will keep me from pestering you about this again in
> the future.
> 
> Bjorn




More information about the Linux-rockchip mailing list