[PATCH v2 1/2] net/virtio: fix legacy device IO port map in secondary process

Li, Miao miao.li at intel.com
Mon Jul 3 10:54:09 CEST 2023


Hi,

> -----Original Message-----
> From: David Marchand <david.marchand at redhat.com>
> Sent: Monday, July 3, 2023 3:48 PM
> To: Li, Miao <miao.li at intel.com>
> Cc: dev at dpdk.org; stable at dpdk.org; Maxime Coquelin
> <maxime.coquelin at redhat.com>; Xia, Chenbo <chenbo.xia at intel.com>
> Subject: Re: [PATCH v2 1/2] net/virtio: fix legacy device IO port map in
> secondary process
> 
> On Thu, Jun 29, 2023 at 4:27 AM Miao Li <miao.li at intel.com> wrote:
> >
> > When doing IO port map for legacy device in secondary process,
> > vfio_cfg setup for legacy device like vfio_group_fd and vfio_dev_fd is
> > missing. So, in secondary process, rte_pci_map_device is added for
> > legacy device to setup vfio_cfg and fill in region info like in
> > primary process.
> 
> I think, in legacy mode, there is no PCI mappable memory.
> So there should be no need for this call to rte_pci_map_device.
> 
> What is missing is a vfio setup, is this correct?
> I'd rather see this issue be fixed in the pci_vfio_ioport_map() function.
> 
If adding vfio setup in the pci_vfio_ioport_map() function, vfio will be setup twice in primary process because rte_pci_map_device will be called for legacy device in primary process.
I add IO port region check to skip region map in the next patch.
> 
> >> Fixes: 512e27eeb743 ("net/virtio: move PCI specific dev init to PCI
> >> ethdev init")
> 
> This commit only moved code, and at this point, there was no need for a call to
> rte_pci_map_device in the secondary process case.
> It seems unlikely this is a faulty change.
> 
> The recent addition on the vfio side seems a better culprit, but I am fine with
> being proven wrong :-).
> 
Yes,  the fix commit is wrong, but not the recent addition commit on the vfio side. Because the root cause is missing a vfio setup. After adding recent addition commit, the uninitialized vfio_cfg info(like vfio_dev_fd, region info) will be used so this bug will be found. I think the correct fix commit will be 6d890f8ab512("net/virtio: fix multiple process support").
> 
> > Cc: stable at dpdk.org
> >
> > Signed-off-by: Miao Li <miao.li at intel.com>
> 
> 
> --
> David Marchand

Thanks,
Miao Li



More information about the stable mailing list