All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Sheng Yang <sheng@linux.intel.com>
Cc: Avi Kivity <avi@redhat.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	kvm@vger.kernel.org
Subject: Re: [PATCH 3/3] qemu-kvm: device assignment: emulate MSI-X mask bits
Date: Mon, 8 Nov 2010 08:27:19 +0200	[thread overview]
Message-ID: <20101108062718.GA30181@redhat.com> (raw)
In-Reply-To: <201011081317.47253.sheng@linux.intel.com>

On Mon, Nov 08, 2010 at 01:17:47PM +0800, Sheng Yang wrote:
> > > > > > > @@ -1250,10 +1297,16 @@ static void
> > > > > > > assigned_dev_update_msix(PCIDevice *pci_dev, int enable_msix)
> > > > > > > 
> > > > > > >          fprintf(stderr, "assigned_dev_update_msix: MSI-X
> > > > > > >          entries_max_nr == 0"); return;
> > > > > > >      
> > > > > > >      }
> > > > > > > 
> > > > > > > +    /*
> > > > > > > +     * Guest may try to enable MSI-X before setting MSI-X entry
> > > > > > > done, so +     * let's wait until guest unmask the entries.
> > > > > > > +     */
> > > > > > 
> > > > > > Well it can also set up any number of entries, enable msix then
> > > > > > set up more entries. Now what?
> > > > > 
> > > > > It's the same. If it want to set up more entries, it have to unmask
> > > > > them. Then we would get them.
> > > > 
> > > > Why can't we handle the first enable in the same way?
> > > 
> > > Don't understand the question, but I guess the answer is
> > > pci_enable_msix().
> > 
> > pci_enable_msix is an internal kernel API to enable msix, isn't it?
> > We are discussing qemu patch here.
> 
> OK, I understand the question now. The others entries would be enabled with 
> unmask, but not very first ones. Guest can unmask the entries first, then enable 
> MSI-X. We should scan the table when MSI-X enabled, that's why the first one is 
> different from others.

I see. I think the comment mislead me: you really mean
'Guest can unmask MSI-X entries when MSI-X is disabled,
 don't do anything until MSI-X is enabled'.



> > > > > > >      entries_max_nr); if (entries_nr == 0) {
> > > > > > > 
> > > > > > > +#ifndef KVM_CAP_DEVICE_MSIX_MASK
> > > > > > > 
> > > > > > >          if (enable_msix)
> > > > > > >          
> > > > > > >              fprintf(stderr, "MSI-X entry number is zero!\n");
> > > > > > 
> > > > > > And what happens then?
> > > > > 
> > > > > MSI-X can't work for old ones without MSIX mask support.
> > > > 
> > > > Old ones?
> > > 
> > > Old userspace without KVM_CAP_DEVICE_MSIX_MASK
> > > 
> > > > > Reload the guest module
> > > > > may help.
> > > > 
> > > > Guest might not have any concept of modules.
> > > 
> > > Just an workaround. Not a suggestion method.
> > 
> > Look, if there's some failure mode we need a way to recover,
> > or to make it very unlikely. If this is guest doing something
> > illegal let's add a comment explaining what it is and why
> > it's illegal. If this is legal, why the print out?
> 
> It's unsupported in the old QEmu.


I think I have it. The comment you want is:

/* Error: number of MSI-X entries is zero. Using this device
   requires KVM_CAP_DEVICE_MSIX_MASK support in kvm
   which is missing.
 */

As I said prebiously, we must check runtime capabilities
for this, ifdef is not enough to know kernel supports a feature
because there's no dependency between kernel and qemu packages.

> I can change the comment, but I do think it's 
> good to let user know something important is wrong. 

stderr is really there for developers.
You can't expect the user to understand this message.

> Maybe it's better to put it into DEBUG.
> --
> regards
> Yang, Sheng
> 
> > 
> > > --
> > > regards
> > > Yang, Sheng
> > > 
> > > > > --
> > > > > regards
> > > > > Yang, Sheng

  reply	other threads:[~2010-11-08  6:27 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-04  6:18 [PATCH 0/3] MSI-X mask supporting for assigned device(QEmu) Sheng Yang
2010-11-04  6:18 ` [PATCH 1/3] qemu-kvm: Ioctl for in-kernel mask support Sheng Yang
2010-11-04  9:47   ` Michael S. Tsirkin
2010-11-05  2:59     ` Sheng Yang
2010-11-05  8:52       ` Michael S. Tsirkin
2010-11-11  6:20         ` Sheng Yang
2010-11-04  6:18 ` [PATCH 2/3] qemu-kvm: device assignment: Some clean up about MSI-X code Sheng Yang
2010-11-04  9:47   ` Michael S. Tsirkin
2010-11-05  3:08     ` Sheng Yang
2010-11-04  6:18 ` [PATCH 3/3] qemu-kvm: device assignment: emulate MSI-X mask bits Sheng Yang
2010-11-04  9:44   ` Michael S. Tsirkin
2010-11-05  3:20     ` Sheng Yang
2010-11-05  9:05       ` Michael S. Tsirkin
2010-11-05 11:02         ` Sheng Yang
2010-11-05 13:54           ` Michael S. Tsirkin
2010-11-08  5:17             ` Sheng Yang
2010-11-08  6:27               ` Michael S. Tsirkin [this message]
2010-11-04 10:04   ` Michael S. Tsirkin
2010-11-05  3:14     ` Sheng Yang
2010-11-05  8:59       ` Michael S. Tsirkin
  -- strict thread matches above, loose matches on Subject: below --
2010-09-28  9:44 [PATCH 0/3] Emulate MSI-X mask bits for assigned devices Sheng Yang
2010-09-28  9:44 ` [PATCH 3/3] qemu-kvm: device assignment: emulate MSI-X mask bits Sheng Yang

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=20101108062718.GA30181@redhat.com \
    --to=mst@redhat.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=sheng@linux.intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.