Re: [PATCH v2 1/6] PCI: support the ATS capability

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jan 18, 2009 at 12:17:29PM +0800, Yu Zhao wrote:
> +/**
> + * pci_ats_qdep - query ATS invalidate queue depth
> + * @dev: the PCI device
> + *
> + * Returns the queue depth on success, or 0 on error.
> + */
> +int pci_ats_qdep(struct pci_dev *dev)
> +{
> +	int pos;
> +	u16 cap;
> +
> +	pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ATS);
> +	if (!pos)
> +		return 0;
> +
> +	pci_read_config_word(dev, pos + PCI_ATS_CAP, &cap);
> +
> +	return PCI_ATS_CAP_QDEP(cap) ? : PCI_ATS_MAX_QDEP;
> +}

The only concern I have with this patch is that every time we enable,
disable or call qdep (ok, maybe I have a second problem with 'qdep'
instead of spelling out 'queue_depth'), we call
pci_find_ext_capability() which is not necessarily cheap.  I can't tell
from this series of patches whether this is a real performance problem
or whether we ask for the qdep once per device per boot.

There was a performance problem with the MSI code when it would try to
pci_find_capability() the MSI cap in the interrupt handler.  This was
fixed long ago by caching the pos of the cap, so I want to be sure we're
not making the same mistake again here.

Hm, a third problem is that the empty ? : is really confusing and
generally to be avoided.  GCC should be able to figure out that it's a
pure/const function anyway and avoid recalculating it.

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux