Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1450486
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v11 09/10] genirq/msi: map/unmap the MSI doorbells on msi_domain_alloc/free_irqs |
| Date | 2016-07-26 11:10 +0200 |
| Message-ID | <rZ6xb-5m-11@gated-at.bofh.it> (permalink) |
| References | <rWCWB-4qE-3@gated-at.bofh.it> <rWCWC-4qE-35@gated-at.bofh.it> <rWVFT-7RJ-15@gated-at.bofh.it> <rYQVs-6No-51@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
B1;2802;0cEric,
On Mon, 25 Jul 2016, Auger Eric wrote:
> On 20/07/2016 11:04, Thomas Gleixner wrote:
> > On Tue, 19 Jul 2016, Eric Auger wrote:
> >> + if (ret) {
> >> + for (; i >= 0; i--) {
> >> + struct irq_data *d = irq_get_irq_data(virq + i);
> >> +
> >> + msi_handle_doorbell_mappings(d, false);
> >> + }
> >> + irq_domain_free_irqs(virq, desc->nvec_used);
> >> + desc->irq = 0;
> >> + goto error;
> >
> > How is that supposed to work? You clear desc->irq and then you call
> > ops->handle_error.
>
> if I don't clear the desc->irq I enter an infinite loop in
> pci_enable_msix_range.
>
> This happens because msix_capability_init and pcie_enable_msix returns 1.
> In msix_capability_init, at out_avail: we enumerate the msi_desc which have
> a non zero irq, hence the returned value equal to 1.
>
> Currently the only handle_error ops I found, pci_msi_domain_handle_error
> does not use irq field so works although questionable.
The logic here is: If the allocation does not succeed for the requested number
of interrupts, we tell the caller how many interrupts we were able to set up.
So the caller can decide what to do.
In your case you don't want to have a partial allocation, so instead of
playing silly games with desc->irq you should add a flag which tells the PCI
code that you are not interested in a partial allocation and that it should
return an error code instead.
Something like PCI_DEV_FLAGS_MSI_NO_PARTIAL_ALLOC should do the trick.
> As for the irq_domain_free_irqs I think I can remove it since handled later.
Not only the free_irqs(). You should let the teardown function handle
everything including your doorbell mapping teardown. It's nothing special and
free_msi_irqs() at the end of msix_capability_init() will take care of it.
Thanks,
tglx
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v11 00/10] KVM PCIe/MSI passthrough on ARM/ARM64: kernel part 2/3: msi changes Eric Auger <eric.auger@redhat.com> - 2016-07-19 15:10 +0200
[PATCH v11 02/10] genirq/msi: msi_compose wrapper Eric Auger <eric.auger@redhat.com> - 2016-07-19 15:10 +0200
[PATCH v11 09/10] genirq/msi: map/unmap the MSI doorbells on msi_domain_alloc/free_irqs Eric Auger <eric.auger@redhat.com> - 2016-07-19 15:10 +0200
Re: [PATCH v11 09/10] genirq/msi: map/unmap the MSI doorbells on msi_domain_alloc/free_irqs Thomas Gleixner <tglx@linutronix.de> - 2016-07-20 11:10 +0200
Re: [PATCH v11 09/10] genirq/msi: map/unmap the MSI doorbells on msi_domain_alloc/free_irqs Auger Eric <eric.auger@redhat.com> - 2016-07-25 18:30 +0200
Re: [PATCH v11 09/10] genirq/msi: map/unmap the MSI doorbells on msi_domain_alloc/free_irqs Thomas Gleixner <tglx@linutronix.de> - 2016-07-26 11:10 +0200
Re: [PATCH v11 09/10] genirq/msi: map/unmap the MSI doorbells on msi_domain_alloc/free_irqs Auger Eric <eric.auger@redhat.com> - 2016-07-26 12:00 +0200
Re: [PATCH v11 09/10] genirq/msi: map/unmap the MSI doorbells on msi_domain_alloc/free_irqs Thomas Gleixner <tglx@linutronix.de> - 2016-07-26 13:10 +0200
[PATCH v11 10/10] genirq/msi: use the MSI doorbell's IOVA when requested Eric Auger <eric.auger@redhat.com> - 2016-07-19 15:10 +0200
Re: [PATCH v11 10/10] genirq/msi: use the MSI doorbell's IOVA when requested Thomas Gleixner <tglx@linutronix.de> - 2016-07-20 11:20 +0200
Re: [PATCH v11 10/10] genirq/msi: use the MSI doorbell's IOVA when requested Auger Eric <eric.auger@redhat.com> - 2016-07-25 18:40 +0200
Re: [PATCH v11 10/10] genirq/msi: use the MSI doorbell's IOVA when requested Thomas Gleixner <tglx@linutronix.de> - 2016-07-26 11:10 +0200
Re: [PATCH v11 10/10] genirq/msi: use the MSI doorbell's IOVA when requested Auger Eric <eric.auger@redhat.com> - 2016-07-26 12:10 +0200
[PATCH v11 08/10] irqchip/gicv3-its: register the MSI global doorbell Eric Auger <eric.auger@redhat.com> - 2016-07-19 15:10 +0200
[PATCH v11 06/10] genirq/msi-doorbell: msi_doorbell_safe Eric Auger <eric.auger@redhat.com> - 2016-07-19 15:10 +0200
Re: [PATCH v11 06/10] genirq/msi-doorbell: msi_doorbell_safe Thomas Gleixner <tglx@linutronix.de> - 2016-07-20 10:20 +0200
Re: [PATCH v11 06/10] genirq/msi-doorbell: msi_doorbell_safe Auger Eric <eric.auger@redhat.com> - 2016-07-21 15:40 +0200
Re: [PATCH v11 06/10] genirq/msi-doorbell: msi_doorbell_safe Thomas Gleixner <tglx@linutronix.de> - 2016-07-22 14:50 +0200
Re: [PATCH v11 06/10] genirq/msi-doorbell: msi_doorbell_safe Auger Eric <eric.auger@redhat.com> - 2016-07-22 16:10 +0200
[PATCH v11 01/10] genirq/msi: export msi_get_domain_info Eric Auger <eric.auger@redhat.com> - 2016-07-19 15:10 +0200
csiph-web