qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* -nic model=rocker causes qemu to abort
@ 2020-04-29 16:43 Michael Tokarev
  2020-05-25 18:45 ` Thomas Huth
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Tokarev @ 2020-04-29 16:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Thomas Huth

Hi!

Just a fun case of (invalid) usage of qemu-system command line.
Someone tried -nic model=rocker, and qemu does this:

 Unexpected error in object_property_find() at /build/qemu/git/qom/object.c:1029:
 qemu-system-x86_64: Property '.mac' not found
 Aborted

This happens after this commit:

commit 52310c3fa7dc854dd2376ae8a518141abcdb78f3
Author: Paolo Bonzini <pbonzini@redhat.com>
Date:   Fri Mar 2 10:30:50 2018 +0100

    net: allow using any PCI NICs in -net or -nic


Previously rocker rightly wasn't usable as a nic model,
and after this commit it is now possible.

While I agree this is invalid usage, perhaps qemu should not
abort like this?  Maybe it should check the required property
too, before allowing this device to be a nic model?

Thanks,

/mjt


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: -nic model=rocker causes qemu to abort
  2020-04-29 16:43 -nic model=rocker causes qemu to abort Michael Tokarev
@ 2020-05-25 18:45 ` Thomas Huth
  2020-05-25 19:46   ` Michael Tokarev
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Huth @ 2020-05-25 18:45 UTC (permalink / raw)
  To: Michael Tokarev, qemu-devel; +Cc: Paolo Bonzini, Jason Wang, Jiri Pirko

On 29/04/2020 18.43, Michael Tokarev wrote:
> Hi!
> 
> Just a fun case of (invalid) usage of qemu-system command line.
> Someone tried -nic model=rocker, and qemu does this:
> 
>  Unexpected error in object_property_find() at /build/qemu/git/qom/object.c:1029:
>  qemu-system-x86_64: Property '.mac' not found
>  Aborted
> 
> This happens after this commit:
> 
> commit 52310c3fa7dc854dd2376ae8a518141abcdb78f3
> Author: Paolo Bonzini <pbonzini@redhat.com>
> Date:   Fri Mar 2 10:30:50 2018 +0100
> 
>     net: allow using any PCI NICs in -net or -nic
> 
> 
> Previously rocker rightly wasn't usable as a nic model,
> and after this commit it is now possible.
> 
> While I agree this is invalid usage, perhaps qemu should not
> abort like this?  Maybe it should check the required property
> too, before allowing this device to be a nic model?

QEMU theoretically should never abort() - abort() means there is
something wrong in the code ... so we should definitely fix this by
other means. Some questions:

1) How is that rocker device normally used? Similar to a normal network
card? Or completely different?

2) In case it is similar to a normal network card, would it make sense
to allow it with -nic or -net, too? Or should we simply disallow it
here? I think we could either use a list of devices that should never be
allowed here, or we check for the availability of that "mac" property...

 Thomas



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: -nic model=rocker causes qemu to abort
  2020-05-25 18:45 ` Thomas Huth
@ 2020-05-25 19:46   ` Michael Tokarev
  2020-05-26  5:17     ` Thomas Huth
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Tokarev @ 2020-05-25 19:46 UTC (permalink / raw)
  To: Thomas Huth, qemu-devel; +Cc: Paolo Bonzini, Jason Wang, Jiri Pirko

25.05.2020 21:45, Thomas Huth wrote:
> On 29/04/2020 18.43, Michael Tokarev wrote:
>> Hi!
>>
>> Just a fun case of (invalid) usage of qemu-system command line.
>> Someone tried -nic model=rocker, and qemu does this:
>>
>>  Unexpected error in object_property_find() at /build/qemu/git/qom/object.c:1029:
>>  qemu-system-x86_64: Property '.mac' not found
>>  Aborted
>>
>> This happens after this commit:
>>
>> commit 52310c3fa7dc854dd2376ae8a518141abcdb78f3
>> Author: Paolo Bonzini <pbonzini@redhat.com>
>> Date:   Fri Mar 2 10:30:50 2018 +0100
>>
>>     net: allow using any PCI NICs in -net or -nic
>>
>> Previously rocker rightly wasn't usable as a nic model,
>> and after this commit it is now possible.
>>
>> While I agree this is invalid usage, perhaps qemu should not
>> abort like this?  Maybe it should check the required property
>> too, before allowing this device to be a nic model?
> 
> QEMU theoretically should never abort() - abort() means there is
> something wrong in the code ... so we should definitely fix this by
> other means. Some questions:
> 
> 1) How is that rocker device normally used? Similar to a normal network
> card? Or completely different?

Nope, this is not a network card, it is a network SWITCH, used as a
regular PCI device, not network-specific. Hence the problem at hand, -
before the patch this device weren't "nic-able", so to say, because
while it is network-related PCI device, it is not a NIC.

I guess while building a list of "nic-able" cards, we should skip some
"nic-alike" devices and use some more specific criteria. Not everything
which is network-related is a regular NIC.

Maybe in time some other devices will appear in qemu with similar effect
which will require another condition.

Or adding a new field into the pci structure to indicate this device
can be a NIC will solve it once for all. Or just reverting the patch :) -
after all it isn't that bad to have a list of NIC-able devices outside
of the device definitions, - we don't have tons of devices anyway where
maintaining such a list outside of device model is a problem.

Thanks,

/mjt

> 2) In case it is similar to a normal network card, would it make sense
> to allow it with -nic or -net, too? Or should we simply disallow it
> here? I think we could either use a list of devices that should never be
> allowed here, or we check for the availability of that "mac" property...
> 
>  Thomas
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: -nic model=rocker causes qemu to abort
  2020-05-25 19:46   ` Michael Tokarev
@ 2020-05-26  5:17     ` Thomas Huth
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Huth @ 2020-05-26  5:17 UTC (permalink / raw)
  To: Michael Tokarev, qemu-devel; +Cc: Paolo Bonzini, Jason Wang, Jiri Pirko

On 25/05/2020 21.46, Michael Tokarev wrote:
> 25.05.2020 21:45, Thomas Huth wrote:
>> On 29/04/2020 18.43, Michael Tokarev wrote:
>>> Hi!
>>>
>>> Just a fun case of (invalid) usage of qemu-system command line.
>>> Someone tried -nic model=rocker, and qemu does this:
>>>
>>>  Unexpected error in object_property_find() at /build/qemu/git/qom/object.c:1029:
>>>  qemu-system-x86_64: Property '.mac' not found
>>>  Aborted
>>>
>>> This happens after this commit:
>>>
>>> commit 52310c3fa7dc854dd2376ae8a518141abcdb78f3
>>> Author: Paolo Bonzini <pbonzini@redhat.com>
>>> Date:   Fri Mar 2 10:30:50 2018 +0100
>>>
>>>     net: allow using any PCI NICs in -net or -nic
>>>
>>> Previously rocker rightly wasn't usable as a nic model,
>>> and after this commit it is now possible.
>>>
>>> While I agree this is invalid usage, perhaps qemu should not
>>> abort like this?  Maybe it should check the required property
>>> too, before allowing this device to be a nic model?
>>
>> QEMU theoretically should never abort() - abort() means there is
>> something wrong in the code ... so we should definitely fix this by
>> other means. Some questions:
>>
>> 1) How is that rocker device normally used? Similar to a normal network
>> card? Or completely different?
> 
> Nope, this is not a network card, it is a network SWITCH, used as a
> regular PCI device, not network-specific. Hence the problem at hand, -
> before the patch this device weren't "nic-able", so to say, because
> while it is network-related PCI device, it is not a NIC.
> 
> I guess while building a list of "nic-able" cards, we should skip some
> "nic-alike" devices and use some more specific criteria. Not everything
> which is network-related is a regular NIC.

Ok, thanks for the explanation! So looking at the properties of the
rocker and real NIC devices again, I think the solution might be simple:
For -nic/-net, we should only consider devices that have a "netdev"
property. I'll try to write a patch when I've got some spare minutes...

 Thomas



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-26  5:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-29 16:43 -nic model=rocker causes qemu to abort Michael Tokarev
2020-05-25 18:45 ` Thomas Huth
2020-05-25 19:46   ` Michael Tokarev
2020-05-26  5:17     ` Thomas Huth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).