linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Gordeev <agordeev@redhat.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-kernel@vger.kernel.org,
	Michael Ellerman <michael@ellerman.id.au>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Tejun Heo <tj@kernel.org>,
	Ben Hutchings <bhutchings@solarflare.com>,
	David Laight <David.Laight@ACULAB.COM>,
	Mark Lord <kernel@start.ca>, "H. Peter Anvin" <hpa@zytor.com>,
	linux-pci@vger.kernel.org
Subject: Re: [PATCH v4 9/9] PCI/MSI: Introduce pci_auto_enable_msi*() family helpers
Date: Fri, 20 Dec 2013 11:28:12 +0100	[thread overview]
Message-ID: <20131220102812.GB28367@dhcp-26-207.brq.redhat.com> (raw)
In-Reply-To: <20131218003002.GA15119@google.com>

On Tue, Dec 17, 2013 at 05:30:02PM -0700, Bjorn Helgaas wrote:
> After this patch, we would have:
> 
>     pci_enable_msi()				# existing (1 vector)
>     pci_enable_msi_block(nvec)			# existing
>     pci_enable_msi_block_auto(maxvec)		# existing (removed)
> 
>     pci_auto_enable_msi(maxvec)			# new	(1-maxvec)
>     pci_auto_enable_msi_range(minvec, maxvec)	# new
>     pci_auto_enable_msi_exact(nvec)		# new	(nvec-nvec)
> 
>     pci_enable_msix(nvec)			# existing
> 
>     pci_auto_enable_msix(maxvec)		# new	(1-maxvec)
>     pci_auto_enable_msix_range(minvec, maxvec)	# new
>     pci_auto_enable_msix_exact(nvec)		# new	(nvec-nvec)
> 
> That seems like a lot of interfaces to document and understand, especially
> since most of them are built on each other.  I'd prefer just these:
> 
>     pci_enable_msi()				# existing (1 vector)
>     pci_enable_msi_range(minvec, maxvec)	# new
> 
>     pci_enable_msix(nvec)			# existing
>     pci_enable_msix_range(minvec, maxvec)	# new
> 
> with examples in the documentation about how to call them with ranges like
> (1, maxvec), (nvec, nvec), etc.  I think that will be easier than
> understanding several interfaces.

I agree pci_auto_enable_msix() and pci_auto_enable_msix_exact() are worth
sacrificing for the sake of clarity. My only concern is people will start
defining their own helpers for (1, maxvec) and (nvec, nvec) cases here and
there...

> I don't think the "auto" in the names really adds anything, does it?  The
> whole point of supplying a range is that the core has the flexibility to
> choose any number of vectors within the range.

"Auto" indicates auto-retry, but I see no problem in skipping it, especially
if we deprecate or phase out the existing interfaces.

> I only see five users of pci_enable_msi_block() (nvme, ath10k, wil6210,
> ipr, vfio); we can easily convert those to use pci_enable_msi_range() and
> then remove pci_enable_msi_block().
> 
> pci_enable_msi() itself can simply be pci_enable_msi_range(1, 1).
> 
> There are nearly 80 callers of pci_enable_msix(), so that's a bit harder.
> Can we deprecate that somehow, and incrementally convert callers to use
> pci_enable_msix_range() instead?  Maybe you're already planning that; I
> know you dropped some driver patches from the series for now, and I didn't
> look to see exactly what they did.

Right, the plan is first to introduce pci_auto_* (or whatever) family into
the tree and then gradually convert all drivers to the new interfaces.

> It would be good if pci_enable_msix() could be implemented in terms of
> pci_enable_msix_range(nvec, nvec), with a little extra glue to handle the
> positive return values.

[...]

> I think it would be better to make pci_enable_msix_range() the fundamental
> implementation, with pci_enable_msix() built on top of it.  That way we
> could deprecate and eventually remove pci_enable_msix() and its tri-state
> return values.

We can reuse pci_enable_msix() name, but not before all drivers converted.

But considering the other thread you want to have only pci_enable_msi_range()
and pci_enable_msix_range() interfaces - am I getting it right?

-- 
Regards,
Alexander Gordeev
agordeev@redhat.com

  parent reply	other threads:[~2013-12-20 10:26 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-16  8:34 [PATCH v4 0/9] PCI/MSI: Introduce pci_auto_enable_msi*() family helpers Alexander Gordeev
2013-12-16  8:34 ` [PATCH v4 1/9] PCI/MSI/s390: Fix single MSI only check Alexander Gordeev
2013-12-16  8:34 ` [PATCH v4 2/9] PCI/MSI/s390: Remove superfluous check of MSI type Alexander Gordeev
2013-12-16  8:34 ` [PATCH v4 3/9] PCI/MSI: Fix return value when populate_msi_sysfs() failed Alexander Gordeev
2013-12-16  8:34 ` [PATCH v4 4/9] PCI/MSI: Return -ENOSYS for unimplemented interfaces, not -1 Alexander Gordeev
2013-12-16  8:34 ` [PATCH v4 5/9] PCI/MSI: Make pci_enable_msi/msix() 'nvec' argument type as int Alexander Gordeev
2013-12-16  8:34 ` [PATCH v4 6/9] PCI/MSI: Factor out pci_get_msi_vec_count() interface Alexander Gordeev
2013-12-18  0:33   ` Bjorn Helgaas
2013-12-16  8:35 ` [PATCH v4 7/9] PCI/MSI: Get rid of pci_enable_msi_block_auto() interface Alexander Gordeev
2013-12-16  8:35 ` [PATCH v4 8/9] PCI/MSI: Introduce pci_get_msix_vec_count() interface Alexander Gordeev
2013-12-16  8:35 ` [PATCH v4 9/9] PCI/MSI: Introduce pci_auto_enable_msi*() family helpers Alexander Gordeev
2013-12-18  0:30   ` Bjorn Helgaas
2013-12-18 13:23     ` Alexander Gordeev
2013-12-18 18:58       ` Bjorn Helgaas
2013-12-19 13:42         ` Alexander Gordeev
2013-12-19 13:47           ` Tejun Heo
2013-12-19 21:37           ` Bjorn Helgaas
2013-12-20  9:04             ` Alexander Gordeev
2013-12-20 13:28               ` Tejun Heo
2013-12-20 10:28     ` Alexander Gordeev [this message]
2013-12-23 14:44     ` Alexander Gordeev
2013-12-23 17:19       ` Bjorn Helgaas
2013-12-19 22:30 ` [PATCH v4 0/9] " Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131220102812.GB28367@dhcp-26-207.brq.redhat.com \
    --to=agordeev@redhat.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=benh@kernel.crashing.org \
    --cc=bhelgaas@google.com \
    --cc=bhutchings@solarflare.com \
    --cc=hpa@zytor.com \
    --cc=kernel@start.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=michael@ellerman.id.au \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).