[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87vctz7c7d.fsf@rustcorp.com.au>
Date: Mon, 15 Aug 2011 09:55:26 +0930
From: Rusty Russell <rusty@...tcorp.com.au>
To: Sasha Levin <levinsasha928@...il.com>
Cc: linux-kernel@...r.kernel.org,
"Michael S. Tsirkin" <mst@...hat.com>,
virtualization@...ts.linux-foundation.org, netdev@...r.kernel.org,
kvm@...r.kernel.org
Subject: Re: [PATCH] virtio-net: Read MAC only after initializing MSI-X
On Sun, 14 Aug 2011 16:57:32 +0300, Sasha Levin <levinsasha928@...il.com> wrote:
> On Sun, 2011-08-14 at 12:23 +0930, Rusty Russell wrote:
> > On Sat, 13 Aug 2011 11:51:01 +0300, Sasha Levin <levinsasha928@...il.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?
>
> Do you mean reserving the vectors even before we probed the device for
> MSI-X support? Wouldn't we need 3 vectors then? (config, input, output).
We want three, but *need* two: see vp_find_vqs(). Also, the generic
code doesn't know how many virtqueues we have on the device.
> > (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.
>
> Just noticed that only virtio-blk uses virtio_config_val(), while the
> others are still doing 'if(virtio_has_feature()) vdev->config->get()',
> I'll send patches to fix that regardless of what we end up doing here.
Thanks.
> Did you want to pass the vq array to virtio_config_val() just to check
> that they were already found?
Not if we fix is using method #1...
Thanks,
Rusty.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists