[libvirt] [PATCH v3 01/12] conf: Add definitions for 'uid' and 'fid' PCI address attributes

Andrea Bolognani abologna at redhat.com
Wed Aug 22 10:09:31 UTC 2018


On Wed, 2018-08-22 at 17:39 +0800, Yi Min Zhao wrote:
> 在 2018/8/21 下午9:19, Andrea Bolognani 写道:
> > On Tue, 2018-08-21 at 19:55 +0800, Yi Min Zhao wrote:
> > > > > For zPCI address, if we use the same strategy as PCI part and user
> > > > > wants to assign fid=0 to the specific device, he might encounter
> > > > > assignment failure. At least, according to the doc, 0 shoud be a valid
> > > > > value to assign to fid.
> > > > 
> > > > If the user wants to use a specific zPCI address they can simply
> > > > specify both attributes, eg. uid=1,fid=0 will work just fine with
> > > > the proposed approach and won't produce errors or cause a new zPCI
> > > > address to be automatically assigned.
> > > > 
> > > > If the user only specified fid=0 while leaving uid unspecified,
> > > > well, an address is going to be picked for them.
> > > 
> > > This would be an empty zpci address while parsing XML so that we might
> > > pick a zpci address with non-zero fid. For example:
> > > 
> > > dev1: fid=0 (this address would be treated as an unassigned zpci address)
> > > dev2 (no definition for both fid and uid)
> > > 
> > > Then the process of assigning addresses will iterate devices as type by
> > > type.
> > > If dev2 is processed before dev1, dev2's fid would be assigned by 0.
> > > This causes
> > > dev1's fid=1. The result doesn't match what the user wants.
> > 
> > This would be the same as specifying a partial PCI address such as
> > 
> >    <address type='pci' slot='0x00'/>
> > 
> > and getting an address with slot != 0x00 back: surprising, perhaps,
> > but that's the way it's been with PCI addresses forever so you can
> > assume users are familiar with it by now.
> > 
> > For zPCI addresses to be inconsistent with this behavior would be
> > utterly confusing; moreover, if the user really needs the uid and
> > fid to have certain values, all they have to do is specify both
> > and libvirt will not attempt to override them.
> 
> I tried as your idea. It makes everything complicated, especially 
> alloc/reserve/release
> zpci address. If the user defines uid=1 and fid=0, we don't know whether 
> should
> reserve fid. (uid=1 fid=0) is the same with (uid=1).

You should reserve it. The user can either

  * not specify zPCI information at all: automatic assignment will
    be performed, no error should be reported;

  * specify a *full* zPCI address: manual assignment, will result
    in either that exact address being used or an error;

  * specify partial information: missing properties will default
    to zero, which will probably cause errors eg. if only the uid
    is specified for a bunch of devices.

The last option is less predictable so it should probably never be
used. All of the above is consistent with how the PCI part works.

-- 
Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list