[libvirt] [PATCH 1/8] Initialize the stubDriver of pci devices if bound to a valid one

Andrea Bolognani abologna at redhat.com
Fri Oct 30 16:48:10 UTC 2015


On Fri, 2015-10-30 at 20:34 +0530, Shivaprasad bhat wrote:
> > > @@ -1556,6 +1563,8 @@ virPCIDeviceNew(unsigned int domain,
> > >      virPCIDevicePtr dev;
> > >      char *vendor = NULL;
> > >      char *product = NULL;
> > > +    char *drvpath = NULL;
> > > +    char *driver = NULL;
> > > 
> > >      if (VIR_ALLOC(dev) < 0)
> > >          return NULL;
> > > @@ -1603,9 +1612,16 @@ virPCIDeviceNew(unsigned int domain,
> > >          goto error;
> > >      }
> > > 
> > > +    if (virPCIDeviceGetDriverPathAndName(dev, &drvpath, &driver) < 0)
> > > +        goto cleanup;
> > > +
> > > +    if (virPCIIsAKnownStub(driver))
> > > +        dev->stubDriver = driver;
> > > +
> > >      VIR_DEBUG("%s %s: initialized", dev->id, dev->name);
> > > 
> > >   cleanup:
> > > +    VIR_FREE(drvpath);
> > >      VIR_FREE(product);
> > >      VIR_FREE(vendor);
> > >      return dev;
> > 
> > What are you doing this for? AFAICT you're using this so you
> > can, in Patch 7, do
> > 
> >   pci = virPCIDeviceNew(...);
> >   if (STREQ_NULLABLE(pci->stubDriver, "vfio-pci"))
> >       ...
> > 
> > Is that so, or is there another reason I'm missing?
> > 
> 
> Its used in P3 as well in virHostdevPCINodeDeviceReAttach().
> I want to keep that function as simple as it is now.
>  And as you pointed out, i am using it in P7 too.Hope its okay now.

I don't see how it's used in that function, as neither the
function itself nor the calls to virHostdevIsPCINodeDeviceUsed()
you've added with Patch 3 seem to touch dev->stubDriver...

Please walk me through it, I'm probably just missing it
because it's Friday :)

Cheers.

-- 
Andrea Bolognani
Software Engineer - Virtualization Team




More information about the libvir-list mailing list