All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Sasha Levin <levinsasha928@gmail.com>, linux-kernel@vger.kernel.org
Cc: Sasha Levin <levinsasha928@gmail.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	virtualization@lists.linux-foundation.org,
	netdev@vger.kernel.org, kvm@vger.kernel.org
Subject: Re: [PATCH] virtio-net: Read MAC only after initializing MSI-X
Date: Sun, 14 Aug 2011 12:23:44 +0930	[thread overview]
Message-ID: <878vqw9007.fsf@rustcorp.com.au> (raw)
In-Reply-To: <1313225461-24458-1-git-send-email-levinsasha928@gmail.com>

On Sat, 13 Aug 2011 11:51:01 +0300, Sasha Levin <levinsasha928@gmail.com> wrote:
> The MAC of a virtio-net device is located at the first field of the device
> specific header. This header is located at offset 20 if the device doesn't
> support MSI-X or offset 24 if it does.

Erk.  This means, in general, we have to do virtio_find_single_vq or
config->find_vqs before we examine any config options.

Look at virtio_blk, which has the same error.

Solutions in order of best to worst:
(1) Enable MSI-X before calling device probe.  This means reserving two
    vectors in virtio_pci_probe to ensure we *can* do this, I think.  Michael?

(2) Ensure ordering of "find_vqs then access config space" statically.  This
    probably means handing the vqs array to virtio_config_val, so noone
    can call it before they have their virtqueues.

(3) Ensure ordering dynamically, ie. BUG_ON() if they haven't done
    find_vqs when they call the config accessors.

If (1) is too invasive for -stable, then we should rearrange the drivers
in separate patches (and cc: -stable), then fix it properly.

Good catch Sasha!

Cheers,
Rusty.

  parent reply	other threads:[~2011-08-14  3:57 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-13  8:51 [PATCH] virtio-net: Read MAC only after initializing MSI-X Sasha Levin
2011-08-14  2:53 ` Rusty Russell
2011-08-14  2:53 ` Rusty Russell [this message]
2011-08-14 13:57   ` Sasha Levin
2011-08-15  0:25     ` Rusty Russell
2011-08-15  0:25     ` Rusty Russell
2011-08-15 22:17       ` Sasha Levin
2011-08-15 22:17       ` Sasha Levin
2011-08-14 13:57   ` Sasha Levin
2011-08-19 15:23 ` Michael S. Tsirkin
2011-08-19 16:33   ` Sasha Levin
2011-08-20 20:00     ` Michael S. Tsirkin
2011-08-20 20:00     ` Michael S. Tsirkin
2011-09-19  3:35       ` Rusty Russell
2011-09-19  6:01         ` Michael S. Tsirkin
2011-09-19  7:49           ` Rusty Russell
2011-09-28 18:30             ` Sasha Levin
2011-10-02  9:11               ` Michael S. Tsirkin
2011-10-02  9:09             ` Michael S. Tsirkin
2011-10-03 23:51               ` Rusty Russell
2011-08-19 16:33   ` Sasha Levin
2011-08-22  0:24   ` Rusty Russell
2011-08-22  0:24   ` Rusty Russell
2011-08-22  8:36     ` Michael S. Tsirkin
2011-08-23  3:49       ` Rusty Russell
2011-08-23  3:49       ` Rusty Russell
2011-08-31 16:24       ` Sasha Levin
2011-08-31 16:24       ` Sasha Levin
2011-08-22  8:36     ` Michael S. Tsirkin
2011-08-19 15:23 ` Michael S. Tsirkin
  -- strict thread matches above, loose matches on Subject: below --
2011-08-13  8:51 Sasha Levin

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=878vqw9007.fsf@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=kvm@vger.kernel.org \
    --cc=levinsasha928@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.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 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.