On Thu, 6 Jun 2019 08:23:47 -0500 Eric Blake <[email protected]> wrote:
> On 6/6/19 2:47 AM, Tao Xu wrote: > > On 6/5/2019 10:40 PM, Igor Mammedov wrote: > >> On Wed, 8 May 2019 14:17:23 +0800 > >> Tao Xu <[email protected]> wrote: > >> > >>> From: Liu Jingqi <[email protected]> > >>> > >>> Add -numa hmat-lb option to provide System Locality Latency and > >>> Bandwidth Information. These memory attributes help to build > >>> System Locality Latency and Bandwidth Information Structure(s) > >>> in ACPI Heterogeneous Memory Attribute Table (HMAT). > >>> > >>> Signed-off-by: Liu Jingqi <[email protected]> > >>> Signed-off-by: Tao Xu <[email protected]> > >>> --- > > ... > >>> +## > >>> +{ 'struct': 'NumaHmatLBOptions', > >>> + 'data': { > >>> + 'initiator': 'uint16', > >>> + 'target': 'uint16', > >>> + 'hierarchy': 'HmatLBMemoryHierarchy', > >>> + 'data-type': 'HmatLBDataType', > >> I think union will be better here with data-type used as discriminator, > >> on top of that you'll be able to drop a bit of error checking above since > >> QAPI's union will not allow user to mix latency and bandwidth. > >> > > Hi Igor, > > > > I have quesion here, the 'hmat-lb' is a member of a union 'NumaOptions', > > it seems can' use a union as a member of union. > > It should be technically possible to expand the QAPI generators to allow > one union as a branch within another union, so long as there are no > collisions in identifiers, if that makes for the smartest on-the-wire > representation. It would save quite a bit of boiler plate error checking in numa code, but since I don't know much about QAPI to make meaningful suggestion how to implement it, I won't insist on using union.
