lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 11 Feb 2009 10:38:38 -0700
From:	Matthew Wilcox <matthew@....cx>
To:	Yu Zhao <yu.zhao@...el.com>
Cc:	jbarnes@...tuousgeek.org, dwmw2@...radead.org,
	linux-pci@...r.kernel.org, iommu@...ts.linux-foundation.org,
	kvm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/6] PCI: support the ATS capability

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-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ