qdev: obey no_user
PATCH 1/1 qdev: obey no_user
since
commit 18b6dade8c0799c48f5c5e124b8c407cd5e22e96
qdev: refactor device creation to allow bus_info to be set only in class
A user can specify a device that is no_user.
For example on my i386 box, I can add a 2nd kvmvapic device.
This patch checks for no-user and rejects the device_add.
--- hw/qdev-monitor.c | 5 +++++ 1 file changed, 5 insertions(+)
hw/qdev-monitor.c +5 -0
@@ -426,6 +426,11 @@ DeviceState *qdev_device_add(QemuOpts *opts) } k =DEVICE_CLASS (obj); +if (k->no_user) { +qerror_report (QERR_INVALID_PARAMETER_VALUE ,"driver" ,"a driver name" ); +error_printf_unless_qmp ("Try with argument 'help' for a list.\n" ); +return NULL ; + }/* find bus */ path =qemu_opt_get (opts,"bus" );
Signature · 1 line
1.7.11.4
Ping?
Quoted 32 lines · Christian Borntraeger
since
commit
18b6dade8c0799c48f5c5e124b8c407cd5e22e96
qdev: refactor device creation to allowbus_infoto be set only in classA user can specify a device that is
no_user.
For example on my i386 box, I can add a 2nd kvmvapic device.This patch checks for no-user and rejects the
device_add.Signed-off-by Christian Borntraeger <[email protected]>--- hw/qdev-monitor.c | 5 +++++ 1 file changed, 5 insertions(+)hw/qdev-monitor.c +5
-0@@ -426,6 +426,11 @@ DeviceState *qdev_device_add(QemuOpts *opts) } k =DEVICE_CLASS (obj); +if (k->no_user) { +qerror_report (QERR_INVALID_PARAMETER_VALUE ,"driver" ,"a driver name" ); +error_printf_unless_qmp ("Try with argument 'help' for a list.\n" ); +return NULL ; + }/* find bus */ path =qemu_opt_get (opts,"bus" );
Am 17.12.2012 17:00, schrieb Christian Borntraeger:
Quoted 20 lines
since
commit
18b6dade8c0799c48f5c5e124b8c407cd5e22e96
qdev: refactor device creation to allowbus_infoto be set only in classA user can specify a device that is
no_user.
For example on my i386 box, I can add a 2nd kvmvapic device.This patch checks for no-user and rejects the
device_add.Signed-off-by Christian Borntraeger <[email protected]>--- hw/qdev-monitor.c | 5 +++++ 1 file changed, 5 insertions(+)hw/qdev-monitor.c +0
-0
hw/qdev-monitor.c DeviceState *qdev_device_add(QemuOpts *opts) · line 429
Quoted 4 lines
hw/qdev-monitor.c +1
-0@@ -426,6 +426,11 @@ DeviceState *qdev_device_add(QemuOpts *opts) } k =DEVICE_CLASS (obj); +if (k->no_user) {
Ack for this check...
hw/qdev-monitor.c DeviceState *qdev_device_add(QemuOpts *opts) · line 431
Quoted 2 lines
hw/qdev-monitor.c +2
-0+qerror_report (QERR_INVALID_PARAMETER_VALUE ,"driver" ,"a driver name" ); +error_printf_unless_qmp ("Try with argument 'help' for a list.\n" );
...but I'm not sure if this error reporting with QERR_... is still in the desired form, cc'ing Luiz.
Andreas
Quoted 5 lines
hw/qdev-monitor.c +2
-0+return NULL ; + }/* find bus */ path =qemu_opt_get (opts,"bus" );
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Quoted 28 lines · On Mon, 07 Jan 2013 15:20:17 +0100 Andreas Färber <[email protected]> wrote:
Am 17.12.2012 17:00, schrieb Christian Borntraeger:
Quoted 20 lines
since
commit
18b6dade8c0799c48f5c5e124b8c407cd5e22e96
qdev: refactor device creation to allowbus_infoto be set only in classA user can specify a device that is
no_user.
For example on my i386 box, I can add a 2nd kvmvapic device.This patch checks for no-user and rejects the
device_add.Signed-off-by Christian Borntraeger <[email protected]>--- hw/qdev-monitor.c | 5 +++++ 1 file changed, 5 insertions(+)hw/qdev-monitor.c +0
-0hw/qdev-monitor.c DeviceState *qdev_device_add(QemuOpts *opts) · line 429
Quoted 4 lines
hw/qdev-monitor.c +1
-0@@ -426,6 +426,11 @@ DeviceState *qdev_device_add(QemuOpts *opts) } k =DEVICE_CLASS (obj); +if (k->no_user) {Ack for this check...
Quoted 5 lines
hw/qdev-monitor.c DeviceState *qdev_device_add(QemuOpts *opts) · line 431
Quoted 2 lines
hw/qdev-monitor.c +2
-0+qerror_report (QERR_INVALID_PARAMETER_VALUE ,"driver" ,"a driver name" ); +error_printf_unless_qmp ("Try with argument 'help' for a list.\n" );...but I'm not sure if this error reporting with
QERR_... is still in the desired form, cc'ing Luiz.
The device_add command hasn't been converted to the qapi yet, so it's fine to use qerror_report(). However, I'd drop the error_printf_unless_qmp() call, as this has the potential of making the conversion harder.
Quoted 9 lines
Andreas
Quoted 5 lines
hw/qdev-monitor.c +2
-0+return NULL ; + }/* find bus */ path =qemu_opt_get (opts,"bus" );
Quoted 11 lines · Christian Borntraeger
since
commit
18b6dade8c0799c48f5c5e124b8c407cd5e22e96
qdev: refactor device creation to allowbus_infoto be set only in classA user can specify a device that is
no_user.
For example on my i386 box, I can add a 2nd kvmvapic device.This patch checks for no-user and rejects the
device_add.Signed-off-by Christian Borntraeger <[email protected]>
I specifically broke this when QOM was introduced because no_user precludes a management tool from constructing a machine directlt.
The real problem you're trying to solve is that it's an error to have two kvmvapic devices, not that users shouldn't be allowed to create them via -device.
Regards,
Anthony Liguori
Quoted 22 lines
--- hw/qdev-monitor.c | 5 +++++ 1 file changed, 5 insertions(+)hw/qdev-monitor.c +5
-0@@ -426,6 +426,11 @@ DeviceState *qdev_device_add(QemuOpts *opts) } k =DEVICE_CLASS (obj); +if (k->no_user) { +qerror_report (QERR_INVALID_PARAMETER_VALUE ,"driver" ,"a driver name" ); +error_printf_unless_qmp ("Try with argument 'help' for a list.\n" ); +return NULL ; + }/* find bus */ path =qemu_opt_get (opts,"bus" );Signature · 1 line
1.7.11.4
Quoted 10 lines · Anthony Liguori
Quoted 8 lines · Christian Borntraeger
since
commit
18b6dade8c0799c48f5c5e124b8c407cd5e22e96
qdev: refactor device creation to allowbus_infoto be set only in classA user can specify a device that is
no_user.
For example on my i386 box, I can add a 2nd kvmvapic device.
Quoted 6 lines
Quoted 3 lines
This patch checks for no-user and rejects the
device_add.Signed-off-by Christian Borntraeger <[email protected]>I specifically broke this when QOM was introduced because
no_userprecludes a management tool from constructing a machine directlt.
You can't do that anyway...
Quoted 3 lines
The real problem you're trying to solve is that it's an error to have two kvmvapic devices, not that users shouldn't be allowed to create them via -device.
That's not the only thing no-user gets used for. A bunch of the ARM sysbus devices have it set presumably because it's just flat impossible for a user to correctly create and wire in a sysbus device at all, so you might as well not confuse matters by listing them in '-device help' output. (We're not consistent about that, though.)
It seems to me like arbitrarily allowing the monitor to construct no-user devices isn't really the right way to attack the problem of "allow complete machine construction by management tools"...
-- PMM
Quoted 31 lines · Peter Maydell
Quoted 10 lines · Anthony Liguori
Quoted 8 lines · Christian Borntraeger
since
commit
18b6dade8c0799c48f5c5e124b8c407cd5e22e96
qdev: refactor device creation to allowbus_infoto be set only in classA user can specify a device that is
no_user.
For example on my i386 box, I can add a 2nd kvmvapic device.Quoted 6 lines
Quoted 3 lines
This patch checks for no-user and rejects the
device_add.Signed-off-by Christian Borntraeger <[email protected]>I specifically broke this when QOM was introduced because
no_userprecludes a management tool from constructing a machine directlt.You can't do that anyway...
Quoted 3 lines
The real problem you're trying to solve is that it's an error to have two kvmvapic devices, not that users shouldn't be allowed to create them via -device.
That's not the only thing no-user gets used for. A bunch of the ARM sysbus devices have it set presumably because it's just flat impossible for a user to correctly create and wire in a sysbus device at all, so you might as well not confuse matters by listing them in '-device help' output. (We're not consistent about that, though.)
Quoted 3 lines
It seems to me like arbitrarily allowing the monitor to construct no-user devices isn't really the right way to attack the problem of "allow complete machine construction by management tools"...
There is no such thing as a 'no-user' device. It's a silly distinction that has never had a consistent meaning.
There's really no good reason why kvmvapic isn't supported by -device other than it was an implementation short cut.
Regards,
Anthony Liguori
Quoted 2 lines
-- PMM
Quoted 7 lines · Anthony Liguori
Quoted 3 lines · Peter Maydell
It seems to me like arbitrarily allowing the monitor to construct no-user devices isn't really the right way to attack the problem of "allow complete machine construction by management tools"...
There is no such thing as a 'no-user' device. It's a silly distinction that has never had a consistent meaning.
Then let's just rip that flag out completely.
-- PMM
Quoted 10 lines · Peter Maydell
Quoted 7 lines · Anthony Liguori
Quoted 3 lines · Peter Maydell
It seems to me like arbitrarily allowing the monitor to construct no-user devices isn't really the right way to attack the problem of "allow complete machine construction by management tools"...
There is no such thing as a 'no-user' device. It's a silly distinction that has never had a consistent meaning.
Then let's just rip that flag out completely.
I have no objection to that. I would have done that but it wasn't easy to script at the time.
Regards,
Anthony Liguori
Quoted 2 lines
-- PMM
Am 07.01.2013 21:16, schrieb Peter Maydell:
Quoted 10 lines · Anthony Liguori
Quoted 7 lines
Quoted 3 lines · Peter Maydell
It seems to me like arbitrarily allowing the monitor to construct no-user devices isn't really the right way to attack the problem of "allow complete machine construction by management tools"...
There is no such thing as a 'no-user' device. It's a silly distinction that has never had a consistent meaning.
Then let's just rip that flag out completely.
That's a bad idea, given that we are about to make the CPU a device.
So yes, there are devices that are not meant to be instantiated more than once (e.g., sclp-console). And there are devices that are not meant to be instantiated by the user at all.
BTW this patch exposed that there is silly code in this function: When the bus is NULL, it is initialized as the SysBus. But we all know that SysBus is not hotplug-capable in the first place, so we can never device_add on SysBus.
Regards,
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Quoted 7 lines · Andreas Färber
Am 07.01.2013 21:16, schrieb Peter Maydell:
Quoted 6 lines · Anthony Liguori
Quoted 5 lines
Quoted 3 lines · Peter Maydell
It seems to me like arbitrarily allowing the monitor to construct no-user devices isn't really the right way to attack the problem of "allow complete machine construction by management tools"...
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
There is no such thing as a 'no-user' device. It's a silly distinction that has never had a consistent meaning.
Then let's just rip that flag out completely.
That's a bad idea, given that we are about to make the CPU a device.
We already have a pile of devices which the user can't usefully use -device on...CPUs would be just another one, right?
-- PMM
Am 07.01.2013 23:20, schrieb Peter Maydell:
Quoted 11 lines · Andreas Färber
Quoted 10 lines
Am 07.01.2013 21:16, schrieb Peter Maydell:
Quoted 9 lines · Anthony Liguori
Quoted 7 lines
Quoted 3 lines · Peter Maydell
It seems to me like arbitrarily allowing the monitor to construct no-user devices isn't really the right way to attack the problem of "allow complete machine construction by management tools"...
There is no such thing as a 'no-user' device. It's a silly distinction that has never had a consistent meaning.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Then let's just rip that flag out completely.
That's a bad idea, given that we are about to make the CPU a device.
We already have a pile of devices which the user can't usefully use -device on...CPUs would be just another one, right?
Not sure what you're arguing for here? The CPU is the worst example of a device I know in that it is not limited to a particular bus and messes with global state and threads.
Also, I'm sure that there will be objects/devices that a management tool is not supposed to mess with either, once we start using object_initialize() more.
If we agree that "no_user = 1" is not ideal or used inconsistently, then we should IMO talk about how to replace/amend it and not conclude to just rip it out and leave users without sensible error messages while praying for The Omnipotent Management Tool that AFAICS we don't have today...
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Quoted 27 lines · Andreas Färber
Am 07.01.2013 23:20, schrieb Peter Maydell:
Quoted 11 lines · Andreas Färber
Quoted 10 lines
Am 07.01.2013 21:16, schrieb Peter Maydell:
Quoted 9 lines · Anthony Liguori
Quoted 7 lines
Quoted 3 lines · Peter Maydell
It seems to me like arbitrarily allowing the monitor to construct no-user devices isn't really the right way to attack the problem of "allow complete machine construction by management tools"...
There is no such thing as a 'no-user' device. It's a silly distinction that has never had a consistent meaning.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Then let's just rip that flag out completely.
That's a bad idea, given that we are about to make the CPU a device.
We already have a pile of devices which the user can't usefully use -device on...CPUs would be just another one, right?
Not sure what you're arguing for here? The CPU is the worst example of a device I know in that it is not limited to a particular bus and messes with global state and threads.
Also, I'm sure that there will be objects/devices that a management tool is not supposed to mess with either, once we start using
object_initialize()more.
Quoted 5 lines
If we agree that "
no_user= 1" is not ideal or used inconsistently, then we should IMO talk about how to replace/amend it and not conclude to just rip it out and leave users without sensible error messages while praying for The Omnipotent Management Tool that AFAICS we don't have today...
If you want to replace 'no_user' with 'cannot_instantiate_with_device_add_yet_due_to_internal_bugs' I'm okay with that.
I'm all for having friendly errors for users. But no_user doesn't just serve a 'broken' flag today. Random devices are marked as no_user that really shouldn't be like isa-fdc.
Regards,
Anthony Liguori
Quoted 6 lines
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Quoted 10 lines · Anthony Liguori
Quoted 8 lines · Christian Borntraeger
since
commit
18b6dade8c0799c48f5c5e124b8c407cd5e22e96
qdev: refactor device creation to allowbus_infoto be set only in classA user can specify a device that is
no_user.
For example on my i386 box, I can add a 2nd kvmvapic device.
Quoted 6 lines
Quoted 3 lines
This patch checks for no-user and rejects the
device_add.Signed-off-by Christian Borntraeger <[email protected]>I specifically broke this when QOM was introduced because
no_userprecludes a management tool from constructing a machine directlt.
Breaking it but leaving it in the code doesnt seem to be the right thing. The commit message from 18b6dade doesnt give any hint that this is now broken and nobody audited the callers of no_user that they handle things gracefully.
So whats the plan? Totally remove no_user tree-wide?
Christian
Quoted 18 lines · Christian Borntraeger
Quoted 10 lines · Anthony Liguori
Quoted 8 lines · Christian Borntraeger
since
commit
18b6dade8c0799c48f5c5e124b8c407cd5e22e96
qdev: refactor device creation to allowbus_infoto be set only in classA user can specify a device that is
no_user.
For example on my i386 box, I can add a 2nd kvmvapic device.Quoted 6 lines
Quoted 3 lines
This patch checks for no-user and rejects the
device_add.Signed-off-by Christian Borntraeger <[email protected]>I specifically broke this when QOM was introduced because
no_userprecludes a management tool from constructing a machine directlt.
Quoted 6 lines
Breaking it but leaving it in the code doesnt seem to be the right thing. The commit message from
18b6dadedoesnt give any hint that this is now broken and nobody audited the callers ofno_userthat they handle things gracefully.So whats the plan? Totally remove
no_usertree-wide?
One of the reasons I left no_user is that it's exposed to users via 'info qdm'. I don't think it matters anymore so we can probably safely remove it.
Regards,
Anthony Liguori
Quoted 2 lines
Christian