All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/3] qom: Fix missing interface in qemu-storage-daemon
@ 2020-10-05 10:54 Philippe Mathieu-Daudé
  2020-10-05 10:54 ` [RFC PATCH 1/3] qom: Always register FW_CFG_DATA_GENERATOR_INTERFACE Philippe Mathieu-Daudé
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-05 10:54 UTC (permalink / raw)
  To: Kevin Wolf, Daniel P . Berrange, qemu-devel
  Cc: Eduardo Habkost, qemu-block, Philippe Mathieu-Daudé,
	Gerd Hoffmann, Paolo Bonzini, Laszlo Ersek

Attempt to fix the issue reported by Kevin.

Introduce a trivial test, but there is currently no
framework in place to test qemu-storage-daemon.

There might be better fix to this QOM issue,
I went for the easiest one I could figure out.

Philippe Mathieu-Daudé (3):
  qom: Always register FW_CFG_DATA_GENERATOR_INTERFACE
  tests: Only build socket_scm_helper when a softmmu target is available
  tests: Add a trivial qemu-storage-daemon test

 hw/nvram/fw_cfg.c            |  7 -------
 qom/fw_cfg_interface.c       | 15 +++++++++++++++
 MAINTAINERS                  |  1 +
 qom/meson.build              |  5 +++++
 tests/Makefile.include       |  5 +++++
 tests/qemu-storage-daemon.sh | 10 ++++++++++
 6 files changed, 36 insertions(+), 7 deletions(-)
 create mode 100644 qom/fw_cfg_interface.c
 create mode 100755 tests/qemu-storage-daemon.sh

-- 
2.26.2



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

* [RFC PATCH 1/3] qom: Always register FW_CFG_DATA_GENERATOR_INTERFACE
  2020-10-05 10:54 [RFC PATCH 0/3] qom: Fix missing interface in qemu-storage-daemon Philippe Mathieu-Daudé
@ 2020-10-05 10:54 ` Philippe Mathieu-Daudé
  2020-10-05 13:22   ` Daniel P. Berrangé
  2020-10-06  8:28   ` Laszlo Ersek
  2020-10-05 10:54 ` [RFC PATCH 2/3] tests: Only build socket_scm_helper when a softmmu target is available Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-05 10:54 UTC (permalink / raw)
  To: Kevin Wolf, Daniel P . Berrange, qemu-devel
  Cc: Eduardo Habkost, qemu-block, Philippe Mathieu-Daudé,
	Gerd Hoffmann, Paolo Bonzini, Laszlo Ersek

While the FW_CFG_DATA_GENERATOR_INTERFACE is only consumed
by a device only available using system-mode (fw_cfg), it is
implemented by a crypto component (tls-cipher-suites) which
is always available when crypto is used.

Commit 69699f3055 introduced the following error in the
qemu-storage-daemon binary:

  $ echo -e \
    '{"execute": "qmp_capabilities"}\r\n{"execute": "qom-list-types"}\r\n{"execute": "quit"}\r\n' \
    | storage-daemon/qemu-storage-daemon --chardev stdio,id=qmp0  --monitor qmp0
  {"QMP": {"version": {"qemu": {"micro": 50, "minor": 1, "major": 5}, "package": ""}, "capabilities": ["oob"]}}
  {"return": {}}
  missing interface 'fw_cfg-data-generator' for object 'tls-creds'
  Aborted (core dumped)

Since QOM dependencies are resolved at runtime, this issue
could not be triggered at linktime, and we don't have test
running the qemu-storage-daemon binary.

Fix by always registering the QOM interface.

Reported-by: Kevin Wolf <kwolf@redhat.com>
Fixes: 69699f3055 ("crypto/tls-cipher-suites: Produce fw_cfg consumable blob")
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
I first used:

+if config_host.has_key('CONFIG_GNUTLS') or have_system
+  qom_ss.add(files('fw_cfg_interface.c'))
+endif

but then realized anything could implement a QOM interface,
so better keep this generic.
---
 hw/nvram/fw_cfg.c      |  7 -------
 qom/fw_cfg_interface.c | 15 +++++++++++++++
 MAINTAINERS            |  1 +
 qom/meson.build        |  5 +++++
 4 files changed, 21 insertions(+), 7 deletions(-)
 create mode 100644 qom/fw_cfg_interface.c

diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index 0e95d057fd..08539a1aab 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -1360,18 +1360,11 @@ static const TypeInfo fw_cfg_mem_info = {
     .class_init    = fw_cfg_mem_class_init,
 };
 
-static const TypeInfo fw_cfg_data_generator_interface_info = {
-    .parent = TYPE_INTERFACE,
-    .name = TYPE_FW_CFG_DATA_GENERATOR_INTERFACE,
-    .class_size = sizeof(FWCfgDataGeneratorClass),
-};
-
 static void fw_cfg_register_types(void)
 {
     type_register_static(&fw_cfg_info);
     type_register_static(&fw_cfg_io_info);
     type_register_static(&fw_cfg_mem_info);
-    type_register_static(&fw_cfg_data_generator_interface_info);
 }
 
 type_init(fw_cfg_register_types)
diff --git a/qom/fw_cfg_interface.c b/qom/fw_cfg_interface.c
new file mode 100644
index 0000000000..2b19502ffe
--- /dev/null
+++ b/qom/fw_cfg_interface.c
@@ -0,0 +1,15 @@
+#include "qemu/osdep.h"
+#include "hw/nvram/fw_cfg.h"
+
+static const TypeInfo fw_cfg_data_generator_interface_info = {
+    .parent = TYPE_INTERFACE,
+    .name = TYPE_FW_CFG_DATA_GENERATOR_INTERFACE,
+    .class_size = sizeof(FWCfgDataGeneratorClass),
+};
+
+static void fw_cfg_register_types(void)
+{
+    type_register_static(&fw_cfg_data_generator_interface_info);
+}
+
+type_init(fw_cfg_register_types)
diff --git a/MAINTAINERS b/MAINTAINERS
index b76fb31861..9c89d54b41 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2055,6 +2055,7 @@ R: Gerd Hoffmann <kraxel@redhat.com>
 S: Supported
 F: docs/specs/fw_cfg.txt
 F: hw/nvram/fw_cfg.c
+F: qom/fw_cfg_interface.c
 F: stubs/fw_cfg.c
 F: include/hw/nvram/fw_cfg.h
 F: include/standard-headers/linux/qemu_fw_cfg.h
diff --git a/qom/meson.build b/qom/meson.build
index a1cd03c82c..7335f8c8a2 100644
--- a/qom/meson.build
+++ b/qom/meson.build
@@ -7,6 +7,11 @@ qom_ss.add(files(
   'qom-qobject.c',
 ))
 
+# interfaces any object might implement
+qom_ss.add(files(
+  'fw_cfg_interface.c',
+))
+
 qmp_ss.add(files('qom-qmp-cmds.c'))
 softmmu_ss.add(files('qom-hmp-cmds.c'))
 
-- 
2.26.2



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

* [RFC PATCH 2/3] tests: Only build socket_scm_helper when a softmmu target is available
  2020-10-05 10:54 [RFC PATCH 0/3] qom: Fix missing interface in qemu-storage-daemon Philippe Mathieu-Daudé
  2020-10-05 10:54 ` [RFC PATCH 1/3] qom: Always register FW_CFG_DATA_GENERATOR_INTERFACE Philippe Mathieu-Daudé
@ 2020-10-05 10:54 ` Philippe Mathieu-Daudé
  2020-10-05 10:54 ` [RFC PATCH 3/3] tests: Add a trivial qemu-storage-daemon test Philippe Mathieu-Daudé
  2020-10-05 11:00 ` [RFC PATCH 0/3] qom: Fix missing interface in qemu-storage-daemon no-reply
  3 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-05 10:54 UTC (permalink / raw)
  To: Kevin Wolf, Daniel P . Berrange, qemu-devel
  Cc: Eduardo Habkost, qemu-block, Philippe Mathieu-Daudé,
	Gerd Hoffmann, Paolo Bonzini, Laszlo Ersek

Do not try to build socket_scm_helper if not softmmu target
is available. This fixes:

  $ make check-block
  Generating qemu-version.h with a meson_exe.py custom command
  make: *** No rule to make target 'tests/qemu-iotests/socket_scm_helper', needed by 'check-block'.  Stop.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/Makefile.include | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 40d909badc..d257777560 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -136,7 +136,9 @@ check-acceptance: check-venv $(TESTS_RESULTS_DIR) get-vm-images
 check:
 
 ifeq ($(CONFIG_TOOLS)$(CONFIG_POSIX),yy)
+ifneq ($(TARGET_DIRS),)
 QEMU_IOTESTS_HELPERS-$(CONFIG_LINUX) = tests/qemu-iotests/socket_scm_helper$(EXESUF)
+endif
 check: check-block
 check-block: $(SRC_PATH)/tests/check-block.sh qemu-img$(EXESUF) \
 		qemu-io$(EXESUF) qemu-nbd$(EXESUF) $(QEMU_IOTESTS_HELPERS-y) \
-- 
2.26.2



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

* [RFC PATCH 3/3] tests: Add a trivial qemu-storage-daemon test
  2020-10-05 10:54 [RFC PATCH 0/3] qom: Fix missing interface in qemu-storage-daemon Philippe Mathieu-Daudé
  2020-10-05 10:54 ` [RFC PATCH 1/3] qom: Always register FW_CFG_DATA_GENERATOR_INTERFACE Philippe Mathieu-Daudé
  2020-10-05 10:54 ` [RFC PATCH 2/3] tests: Only build socket_scm_helper when a softmmu target is available Philippe Mathieu-Daudé
@ 2020-10-05 10:54 ` Philippe Mathieu-Daudé
  2020-10-05 13:19   ` Paolo Bonzini
  2020-10-05 11:00 ` [RFC PATCH 0/3] qom: Fix missing interface in qemu-storage-daemon no-reply
  3 siblings, 1 reply; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-05 10:54 UTC (permalink / raw)
  To: Kevin Wolf, Daniel P . Berrange, qemu-devel
  Cc: Eduardo Habkost, qemu-block, Philippe Mathieu-Daudé,
	Gerd Hoffmann, Paolo Bonzini, Laszlo Ersek

This test fails on top of commit 69699f3055
("crypto/tls-cipher-suites: Produce fw_cfg consumable blob")
because the TYPE_FW_CFG_DATA_GENERATOR_INTERFACE registered
in hw/nvram/fw_cfg.c is not linked into qemu-storage-daemon:

  $ make check-block
  Generating qemu-version.h with a meson_exe.py custom command
    qemu-storage-daemon
  tests/qemu-storage-daemon.sh: line 10: 2089929 Aborted                 (core dumped)

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/Makefile.include       |  3 +++
 tests/qemu-storage-daemon.sh | 10 ++++++++++
 2 files changed, 13 insertions(+)
 create mode 100755 tests/qemu-storage-daemon.sh

diff --git a/tests/Makefile.include b/tests/Makefile.include
index d257777560..be12581c77 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -142,7 +142,10 @@ endif
 check: check-block
 check-block: $(SRC_PATH)/tests/check-block.sh qemu-img$(EXESUF) \
 		qemu-io$(EXESUF) qemu-nbd$(EXESUF) $(QEMU_IOTESTS_HELPERS-y) \
+		storage-daemon/qemu-storage-daemon \
 		$(patsubst %-softmmu,qemu-system-%,$(filter %-softmmu,$(TARGET_DIRS)))
+	$(call quiet-command, \
+			$(SRC_PATH)/tests/qemu-storage-daemon.sh, "qemu-storage-daemon")
 	@$<
 endif
 
diff --git a/tests/qemu-storage-daemon.sh b/tests/qemu-storage-daemon.sh
new file mode 100755
index 0000000000..9fd4c73400
--- /dev/null
+++ b/tests/qemu-storage-daemon.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# Test all QOM dependencies are resolved
+storage-daemon/qemu-storage-daemon \
+  --chardev stdio,id=qmp0  --monitor qmp0 \
+  > /dev/null << 'EOF'
+{"execute": "qmp_capabilities"}
+{"execute": "qom-list-types"}
+{"execute": "quit"}
+EOF
-- 
2.26.2



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

* Re: [RFC PATCH 0/3] qom: Fix missing interface in qemu-storage-daemon
  2020-10-05 10:54 [RFC PATCH 0/3] qom: Fix missing interface in qemu-storage-daemon Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2020-10-05 10:54 ` [RFC PATCH 3/3] tests: Add a trivial qemu-storage-daemon test Philippe Mathieu-Daudé
@ 2020-10-05 11:00 ` no-reply
  3 siblings, 0 replies; 9+ messages in thread
From: no-reply @ 2020-10-05 11:00 UTC (permalink / raw)
  To: philmd
  Cc: kwolf, berrange, ehabkost, qemu-block, philmd, qemu-devel,
	kraxel, pbonzini, lersek

Patchew URL: https://patchew.org/QEMU/20201005105442.2093105-1-philmd@redhat.com/



Hi,

This series failed build test on FreeBSD host. Please find the details below.

=== TEST SCRIPT BEGIN ===
#!/bin/bash
# Testing script will be invoked under the git checkout with
# HEAD pointing to a commit that has the patches applied on top of "base"
# branch
if qemu-system-x86_64 --help >/dev/null 2>&1; then
  QEMU=qemu-system-x86_64
elif /usr/libexec/qemu-kvm --help >/dev/null 2>&1; then
  QEMU=/usr/libexec/qemu-kvm
else
  exit 1
fi
make vm-build-freebsd J=21 QEMU=$QEMU
exit 0
=== TEST SCRIPT END ===




The full log is available at
http://patchew.org/logs/20201005105442.2093105-1-philmd@redhat.com/testing.FreeBSD/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

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

* Re: [RFC PATCH 3/3] tests: Add a trivial qemu-storage-daemon test
  2020-10-05 10:54 ` [RFC PATCH 3/3] tests: Add a trivial qemu-storage-daemon test Philippe Mathieu-Daudé
@ 2020-10-05 13:19   ` Paolo Bonzini
  0 siblings, 0 replies; 9+ messages in thread
From: Paolo Bonzini @ 2020-10-05 13:19 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Kevin Wolf, Daniel P . Berrange, qemu-devel
  Cc: Laszlo Ersek, Eduardo Habkost, qemu-block, Gerd Hoffmann

On 05/10/20 12:54, Philippe Mathieu-Daudé wrote:
> This test fails on top of commit 69699f3055
> ("crypto/tls-cipher-suites: Produce fw_cfg consumable blob")
> because the TYPE_FW_CFG_DATA_GENERATOR_INTERFACE registered
> in hw/nvram/fw_cfg.c is not linked into qemu-storage-daemon:
> 
>   $ make check-block
>   Generating qemu-version.h with a meson_exe.py custom command
>     qemu-storage-daemon
>   tests/qemu-storage-daemon.sh: line 10: 2089929 Aborted                 (core dumped)
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  tests/Makefile.include       |  3 +++
>  tests/qemu-storage-daemon.sh | 10 ++++++++++
>  2 files changed, 13 insertions(+)
>  create mode 100755 tests/qemu-storage-daemon.sh
> 
> diff --git a/tests/Makefile.include b/tests/Makefile.include
> index d257777560..be12581c77 100644
> --- a/tests/Makefile.include
> +++ b/tests/Makefile.include
> @@ -142,7 +142,10 @@ endif
>  check: check-block
>  check-block: $(SRC_PATH)/tests/check-block.sh qemu-img$(EXESUF) \
>  		qemu-io$(EXESUF) qemu-nbd$(EXESUF) $(QEMU_IOTESTS_HELPERS-y) \
> +		storage-daemon/qemu-storage-daemon \
>  		$(patsubst %-softmmu,qemu-system-%,$(filter %-softmmu,$(TARGET_DIRS)))
> +	$(call quiet-command, \
> +			$(SRC_PATH)/tests/qemu-storage-daemon.sh, "qemu-storage-daemon")
>  	@$<
>  endif
>  
> diff --git a/tests/qemu-storage-daemon.sh b/tests/qemu-storage-daemon.sh
> new file mode 100755
> index 0000000000..9fd4c73400
> --- /dev/null
> +++ b/tests/qemu-storage-daemon.sh
> @@ -0,0 +1,10 @@
> +#!/bin/sh
> +
> +# Test all QOM dependencies are resolved
> +storage-daemon/qemu-storage-daemon \
> +  --chardev stdio,id=qmp0  --monitor qmp0 \
> +  > /dev/null << 'EOF'
> +{"execute": "qmp_capabilities"}
> +{"execute": "qom-list-types"}
> +{"execute": "quit"}
> +EOF

I think you should either do this as a qemu-iotests testcase, or use
libqtest.

Paolo



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

* Re: [RFC PATCH 1/3] qom: Always register FW_CFG_DATA_GENERATOR_INTERFACE
  2020-10-05 10:54 ` [RFC PATCH 1/3] qom: Always register FW_CFG_DATA_GENERATOR_INTERFACE Philippe Mathieu-Daudé
@ 2020-10-05 13:22   ` Daniel P. Berrangé
  2020-10-06  9:50     ` Philippe Mathieu-Daudé
  2020-10-06  8:28   ` Laszlo Ersek
  1 sibling, 1 reply; 9+ messages in thread
From: Daniel P. Berrangé @ 2020-10-05 13:22 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Kevin Wolf, Eduardo Habkost, qemu-block, qemu-devel,
	Gerd Hoffmann, Paolo Bonzini, Laszlo Ersek

On Mon, Oct 05, 2020 at 12:54:40PM +0200, Philippe Mathieu-Daudé wrote:
> While the FW_CFG_DATA_GENERATOR_INTERFACE is only consumed
> by a device only available using system-mode (fw_cfg), it is
> implemented by a crypto component (tls-cipher-suites) which
> is always available when crypto is used.
> 
> Commit 69699f3055 introduced the following error in the
> qemu-storage-daemon binary:
> 
>   $ echo -e \
>     '{"execute": "qmp_capabilities"}\r\n{"execute": "qom-list-types"}\r\n{"execute": "quit"}\r\n' \
>     | storage-daemon/qemu-storage-daemon --chardev stdio,id=qmp0  --monitor qmp0
>   {"QMP": {"version": {"qemu": {"micro": 50, "minor": 1, "major": 5}, "package": ""}, "capabilities": ["oob"]}}
>   {"return": {}}
>   missing interface 'fw_cfg-data-generator' for object 'tls-creds'
>   Aborted (core dumped)
> 
> Since QOM dependencies are resolved at runtime, this issue
> could not be triggered at linktime, and we don't have test
> running the qemu-storage-daemon binary.
> 
> Fix by always registering the QOM interface.
> 
> Reported-by: Kevin Wolf <kwolf@redhat.com>
> Fixes: 69699f3055 ("crypto/tls-cipher-suites: Produce fw_cfg consumable blob")
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> I first used:
> 
> +if config_host.has_key('CONFIG_GNUTLS') or have_system
> +  qom_ss.add(files('fw_cfg_interface.c'))
> +endif
> 
> but then realized anything could implement a QOM interface,
> so better keep this generic.
> ---
>  hw/nvram/fw_cfg.c      |  7 -------
>  qom/fw_cfg_interface.c | 15 +++++++++++++++

I feel this should be left in hw/nvram, but still added to qom_ss.

The code location should reflect the functional area and maintainership,
so we shouldn't move code just to satisfy linkage problems.

>  MAINTAINERS            |  1 +
>  qom/meson.build        |  5 +++++
>  4 files changed, 21 insertions(+), 7 deletions(-)
>  create mode 100644 qom/fw_cfg_interface.c
> 
> diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
> index 0e95d057fd..08539a1aab 100644
> --- a/hw/nvram/fw_cfg.c
> +++ b/hw/nvram/fw_cfg.c
> @@ -1360,18 +1360,11 @@ static const TypeInfo fw_cfg_mem_info = {
>      .class_init    = fw_cfg_mem_class_init,
>  };
>  
> -static const TypeInfo fw_cfg_data_generator_interface_info = {
> -    .parent = TYPE_INTERFACE,
> -    .name = TYPE_FW_CFG_DATA_GENERATOR_INTERFACE,
> -    .class_size = sizeof(FWCfgDataGeneratorClass),
> -};
> -
>  static void fw_cfg_register_types(void)
>  {
>      type_register_static(&fw_cfg_info);
>      type_register_static(&fw_cfg_io_info);
>      type_register_static(&fw_cfg_mem_info);
> -    type_register_static(&fw_cfg_data_generator_interface_info);
>  }
>  
>  type_init(fw_cfg_register_types)
> diff --git a/qom/fw_cfg_interface.c b/qom/fw_cfg_interface.c
> new file mode 100644
> index 0000000000..2b19502ffe
> --- /dev/null
> +++ b/qom/fw_cfg_interface.c
> @@ -0,0 +1,15 @@
> +#include "qemu/osdep.h"
> +#include "hw/nvram/fw_cfg.h"
> +
> +static const TypeInfo fw_cfg_data_generator_interface_info = {
> +    .parent = TYPE_INTERFACE,
> +    .name = TYPE_FW_CFG_DATA_GENERATOR_INTERFACE,
> +    .class_size = sizeof(FWCfgDataGeneratorClass),
> +};
> +
> +static void fw_cfg_register_types(void)
> +{
> +    type_register_static(&fw_cfg_data_generator_interface_info);
> +}
> +
> +type_init(fw_cfg_register_types)
> diff --git a/MAINTAINERS b/MAINTAINERS
> index b76fb31861..9c89d54b41 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -2055,6 +2055,7 @@ R: Gerd Hoffmann <kraxel@redhat.com>
>  S: Supported
>  F: docs/specs/fw_cfg.txt
>  F: hw/nvram/fw_cfg.c
> +F: qom/fw_cfg_interface.c
>  F: stubs/fw_cfg.c
>  F: include/hw/nvram/fw_cfg.h
>  F: include/standard-headers/linux/qemu_fw_cfg.h
> diff --git a/qom/meson.build b/qom/meson.build
> index a1cd03c82c..7335f8c8a2 100644
> --- a/qom/meson.build
> +++ b/qom/meson.build
> @@ -7,6 +7,11 @@ qom_ss.add(files(
>    'qom-qobject.c',
>  ))
>  
> +# interfaces any object might implement
> +qom_ss.add(files(
> +  'fw_cfg_interface.c',
> +))
> +
>  qmp_ss.add(files('qom-qmp-cmds.c'))
>  softmmu_ss.add(files('qom-hmp-cmds.c'))
>  
> -- 
> 2.26.2
> 

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



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

* Re: [RFC PATCH 1/3] qom: Always register FW_CFG_DATA_GENERATOR_INTERFACE
  2020-10-05 10:54 ` [RFC PATCH 1/3] qom: Always register FW_CFG_DATA_GENERATOR_INTERFACE Philippe Mathieu-Daudé
  2020-10-05 13:22   ` Daniel P. Berrangé
@ 2020-10-06  8:28   ` Laszlo Ersek
  1 sibling, 0 replies; 9+ messages in thread
From: Laszlo Ersek @ 2020-10-06  8:28 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Kevin Wolf, Daniel P . Berrange, qemu-devel
  Cc: Paolo Bonzini, Eduardo Habkost, qemu-block, Gerd Hoffmann

On 10/05/20 12:54, Philippe Mathieu-Daudé wrote:
> While the FW_CFG_DATA_GENERATOR_INTERFACE is only consumed
> by a device only available using system-mode (fw_cfg), it is
> implemented by a crypto component (tls-cipher-suites) which
> is always available when crypto is used.
> 
> Commit 69699f3055 introduced the following error in the
> qemu-storage-daemon binary:
> 
>   $ echo -e \
>     '{"execute": "qmp_capabilities"}\r\n{"execute": "qom-list-types"}\r\n{"execute": "quit"}\r\n' \
>     | storage-daemon/qemu-storage-daemon --chardev stdio,id=qmp0  --monitor qmp0
>   {"QMP": {"version": {"qemu": {"micro": 50, "minor": 1, "major": 5}, "package": ""}, "capabilities": ["oob"]}}
>   {"return": {}}
>   missing interface 'fw_cfg-data-generator' for object 'tls-creds'
>   Aborted (core dumped)
> 
> Since QOM dependencies are resolved at runtime, this issue
> could not be triggered at linktime,

O_o

I'll defer the review of this work to others with actual QOM knowledge.

Please ping me when the series is otherwise ready; I'll be happy to ACK
the fw_cfg parts (if any).

Laszlo

> and we don't have test
> running the qemu-storage-daemon binary.
> 
> Fix by always registering the QOM interface.
> 
> Reported-by: Kevin Wolf <kwolf@redhat.com>
> Fixes: 69699f3055 ("crypto/tls-cipher-suites: Produce fw_cfg consumable blob")
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> I first used:
> 
> +if config_host.has_key('CONFIG_GNUTLS') or have_system
> +  qom_ss.add(files('fw_cfg_interface.c'))
> +endif
> 
> but then realized anything could implement a QOM interface,
> so better keep this generic.
> ---
>  hw/nvram/fw_cfg.c      |  7 -------
>  qom/fw_cfg_interface.c | 15 +++++++++++++++
>  MAINTAINERS            |  1 +
>  qom/meson.build        |  5 +++++
>  4 files changed, 21 insertions(+), 7 deletions(-)
>  create mode 100644 qom/fw_cfg_interface.c
> 
> diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
> index 0e95d057fd..08539a1aab 100644
> --- a/hw/nvram/fw_cfg.c
> +++ b/hw/nvram/fw_cfg.c
> @@ -1360,18 +1360,11 @@ static const TypeInfo fw_cfg_mem_info = {
>      .class_init    = fw_cfg_mem_class_init,
>  };
>  
> -static const TypeInfo fw_cfg_data_generator_interface_info = {
> -    .parent = TYPE_INTERFACE,
> -    .name = TYPE_FW_CFG_DATA_GENERATOR_INTERFACE,
> -    .class_size = sizeof(FWCfgDataGeneratorClass),
> -};
> -
>  static void fw_cfg_register_types(void)
>  {
>      type_register_static(&fw_cfg_info);
>      type_register_static(&fw_cfg_io_info);
>      type_register_static(&fw_cfg_mem_info);
> -    type_register_static(&fw_cfg_data_generator_interface_info);
>  }
>  
>  type_init(fw_cfg_register_types)
> diff --git a/qom/fw_cfg_interface.c b/qom/fw_cfg_interface.c
> new file mode 100644
> index 0000000000..2b19502ffe
> --- /dev/null
> +++ b/qom/fw_cfg_interface.c
> @@ -0,0 +1,15 @@
> +#include "qemu/osdep.h"
> +#include "hw/nvram/fw_cfg.h"
> +
> +static const TypeInfo fw_cfg_data_generator_interface_info = {
> +    .parent = TYPE_INTERFACE,
> +    .name = TYPE_FW_CFG_DATA_GENERATOR_INTERFACE,
> +    .class_size = sizeof(FWCfgDataGeneratorClass),
> +};
> +
> +static void fw_cfg_register_types(void)
> +{
> +    type_register_static(&fw_cfg_data_generator_interface_info);
> +}
> +
> +type_init(fw_cfg_register_types)
> diff --git a/MAINTAINERS b/MAINTAINERS
> index b76fb31861..9c89d54b41 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -2055,6 +2055,7 @@ R: Gerd Hoffmann <kraxel@redhat.com>
>  S: Supported
>  F: docs/specs/fw_cfg.txt
>  F: hw/nvram/fw_cfg.c
> +F: qom/fw_cfg_interface.c
>  F: stubs/fw_cfg.c
>  F: include/hw/nvram/fw_cfg.h
>  F: include/standard-headers/linux/qemu_fw_cfg.h
> diff --git a/qom/meson.build b/qom/meson.build
> index a1cd03c82c..7335f8c8a2 100644
> --- a/qom/meson.build
> +++ b/qom/meson.build
> @@ -7,6 +7,11 @@ qom_ss.add(files(
>    'qom-qobject.c',
>  ))
>  
> +# interfaces any object might implement
> +qom_ss.add(files(
> +  'fw_cfg_interface.c',
> +))
> +
>  qmp_ss.add(files('qom-qmp-cmds.c'))
>  softmmu_ss.add(files('qom-hmp-cmds.c'))
>  
> 



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

* Re: [RFC PATCH 1/3] qom: Always register FW_CFG_DATA_GENERATOR_INTERFACE
  2020-10-05 13:22   ` Daniel P. Berrangé
@ 2020-10-06  9:50     ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 9+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-10-06  9:50 UTC (permalink / raw)
  To: Daniel P. Berrangé
  Cc: Kevin Wolf, Eduardo Habkost, qemu-block, qemu-devel,
	Gerd Hoffmann, Paolo Bonzini, Laszlo Ersek

On 10/5/20 3:22 PM, Daniel P. Berrangé wrote:
> On Mon, Oct 05, 2020 at 12:54:40PM +0200, Philippe Mathieu-Daudé wrote:
>> While the FW_CFG_DATA_GENERATOR_INTERFACE is only consumed
>> by a device only available using system-mode (fw_cfg), it is
>> implemented by a crypto component (tls-cipher-suites) which
>> is always available when crypto is used.
>>
>> Commit 69699f3055 introduced the following error in the
>> qemu-storage-daemon binary:
>>
>>   $ echo -e \
>>     '{"execute": "qmp_capabilities"}\r\n{"execute": "qom-list-types"}\r\n{"execute": "quit"}\r\n' \
>>     | storage-daemon/qemu-storage-daemon --chardev stdio,id=qmp0  --monitor qmp0
>>   {"QMP": {"version": {"qemu": {"micro": 50, "minor": 1, "major": 5}, "package": ""}, "capabilities": ["oob"]}}
>>   {"return": {}}
>>   missing interface 'fw_cfg-data-generator' for object 'tls-creds'
>>   Aborted (core dumped)
>>
>> Since QOM dependencies are resolved at runtime, this issue
>> could not be triggered at linktime, and we don't have test
>> running the qemu-storage-daemon binary.
>>
>> Fix by always registering the QOM interface.
>>
>> Reported-by: Kevin Wolf <kwolf@redhat.com>
>> Fixes: 69699f3055 ("crypto/tls-cipher-suites: Produce fw_cfg consumable blob")
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>> I first used:
>>
>> +if config_host.has_key('CONFIG_GNUTLS') or have_system
>> +  qom_ss.add(files('fw_cfg_interface.c'))
>> +endif
>>
>> but then realized anything could implement a QOM interface,
>> so better keep this generic.
>> ---
>>  hw/nvram/fw_cfg.c      |  7 -------
>>  qom/fw_cfg_interface.c | 15 +++++++++++++++
> 
> I feel this should be left in hw/nvram, but still added to qom_ss.
> 
> The code location should reflect the functional area and maintainership,
> so we shouldn't move code just to satisfy linkage problems.

I thought Meson would conditionally include subdir() meson.build
like the Makefile based previous buildsys, but I was wrong, all
subdir are processed.
I'll respin with your suggestion, thanks.

Phil.



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

end of thread, other threads:[~2020-10-06  9:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-05 10:54 [RFC PATCH 0/3] qom: Fix missing interface in qemu-storage-daemon Philippe Mathieu-Daudé
2020-10-05 10:54 ` [RFC PATCH 1/3] qom: Always register FW_CFG_DATA_GENERATOR_INTERFACE Philippe Mathieu-Daudé
2020-10-05 13:22   ` Daniel P. Berrangé
2020-10-06  9:50     ` Philippe Mathieu-Daudé
2020-10-06  8:28   ` Laszlo Ersek
2020-10-05 10:54 ` [RFC PATCH 2/3] tests: Only build socket_scm_helper when a softmmu target is available Philippe Mathieu-Daudé
2020-10-05 10:54 ` [RFC PATCH 3/3] tests: Add a trivial qemu-storage-daemon test Philippe Mathieu-Daudé
2020-10-05 13:19   ` Paolo Bonzini
2020-10-05 11:00 ` [RFC PATCH 0/3] qom: Fix missing interface in qemu-storage-daemon no-reply

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.