qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 3/7] qdev-monitor: Stop error avalance in qbu


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v2 3/7] qdev-monitor: Stop error avalance in qbus_find_recursive()
Date: Fri, 19 Jun 2015 15:19:17 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Andreas Färber <address@hidden> writes:

> Did you mean avalanche?

Yes, fixing...

> Am 13.06.2015 um 13:18 schrieb Markus Armbruster:
>> Reproducer:
>> 
>>     $ qemu-system-x86_64 -nodefaults -device virtio-rng-pci -device 
>> virtio-rng-pci -device virtio-rng-device,bus=virtio-bus
>>     qemu-system-x86_64: -device virtio-rng-device,bus=virtio-bus: Bus 
>> 'virtio-bus' is full
>>     qemu-system-x86_64: -device virtio-rng-device,bus=virtio-bus: Bus 
>> 'virtio-bus' is full
>>     qemu-system-x86_64: -device virtio-rng-device,bus=virtio-bus: Bus 
>> 'virtio-bus' not found
>> 
>> qbus_find_recursive() reports the "is full" error itself, and leaves
>> reporting "not found" to its caller.  The result is confusion.  Write
>> it a function contract that permits leaving all error reporting to the
>> caller, and implement it.  Update callers to detect and report "is
>> full".
>> 
>> Screwed up when commit 1395af6 added the max_dev limit and the "is
>> full" error condition to enforce it.
>> 
>> Signed-off-by: Markus Armbruster <address@hidden>
>> Reviewed-by: Eric Blake <address@hidden>
>> ---
>>  qdev-monitor.c | 62 
>> ++++++++++++++++++++++++++++++++++++----------------------
>>  1 file changed, 39 insertions(+), 23 deletions(-)
>> 
>> diff --git a/qdev-monitor.c b/qdev-monitor.c
>> index 7dd62dd..1408c86 100644
>> --- a/qdev-monitor.c
>> +++ b/qdev-monitor.c
>> @@ -364,43 +364,55 @@ static DeviceState *qbus_find_dev(BusState *bus, char 
>> *elem)
>>      return NULL;
>>  }
>>  
>> +static inline bool qbus_is_full(BusState *bus)
>> +{
>> +    BusClass *bus_class = BUS_GET_CLASS(bus);
>> +    return bus_class->max_dev && bus->max_index >= bus_class->max_dev;
>> +}
>> +
>> +/**
>
> This should probably just be "/*".

Fixing...

> I'll trust you on getting the functional logic right, can't do a full
> review right now.

Thank you all the same!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]