mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Alexander Gordeev <agordeev@redhat.com>,
	Bjorn Helgaas <bhelgaas@google.com>
Subject: Re: question about pci_enable_msix_range
Date: Tue, 15 Mar 2016 15:33:28 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.10.1603151532100.2531@hadrien> (raw)
In-Reply-To: <20160315082941.11216f19@t450s.home>



On Tue, 15 Mar 2016, Alex Williamson wrote:

> On Tue, 15 Mar 2016 11:26:50 +0100 (CET)
> Julia Lawall <julia.lawall@lip6.fr> wrote:
>
> > Hello,
> >
> > I was looking at the following code in the file
> > drivers/vfio/pci/vfio_pci_intrs.c:
> >
> >                 ret = pci_enable_msix_range(pdev, vdev->msix, 1, nvec);
> >                 if (ret < nvec) {
> >                         if (ret > 0)
> >                                 pci_disable_msix(pdev);
> >                         kfree(vdev->msix);
> >                         kfree(vdev->ctx);
> >                         return ret;
> >                 }
> >
> > I was wondering what is the point of using a range of 1 .. nvec if there
> > is going to be a failure if the number of allocated irqs is less than
> > nvec?
>
> Hi Julia,
>
> The intention is that on failure we can indicate to the user a value
> that might work.  If we were to call with {nvec, nvec} we'd only get
> back -ENOSPC and the user could only arbitrarily decrease the request
> by some amount and try again.  By using {1, nvec} we can hopefully
> provide a useful next step.  On the other hand, we haven't enabled the
> number of vectors the user requested, so it doesn't seem to make sense
> to leave any enabled.  Thanks,

Ah, OK I see now that the ret will be the value that works in this case,
not a normal failure value.  Thanks for the feedback, which has made
things a lot clearer.

julia

      reply	other threads:[~2016-03-15 14:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-15 10:26 Julia Lawall
2016-03-15 14:29 ` Alex Williamson
2016-03-15 14:33   ` Julia Lawall [this message]

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=alpine.DEB.2.10.1603151532100.2531@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=agordeev@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=bhelgaas@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.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

all inboxes | Powered by JetHome®