[PATCH v2 00/11] vl: compound properties for machines

Paolo Bonzini posted 11 patches 2 years, 10 months ago
Test checkpatch failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20210617155308.928754-1-pbonzini@redhat.com
Maintainers: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Paolo Bonzini <pbonzini@redhat.com>, Thomas Huth <thuth@redhat.com>, Laurent Vivier <lvivier@redhat.com>, Markus Armbruster <armbru@redhat.com>, "Michael S. Tsirkin" <mst@redhat.com>, Eduardo Habkost <ehabkost@redhat.com>, Richard Henderson <richard.henderson@linaro.org>
hw/core/machine.c           | 192 +++++++++++---------
hw/i386/pc.c                | 110 +++++-------
hw/i386/x86.c               |  15 +-
include/hw/boards.h         |   4 +-
include/hw/i386/pc.h        |   3 -
include/hw/i386/x86.h       |   1 -
include/qemu/option.h       |   6 +-
include/qom/object.h        |  23 +++
qapi/machine.json           |  27 +++
qom/object_interfaces.c     |  58 ++++--
softmmu/vl.c                | 348 ++++++++++++++++++------------------
tests/qtest/numa-test.c     |  22 +--
tests/unit/test-keyval.c    |  58 ++++++
tests/unit/test-qemu-opts.c |  35 ----
util/keyval.c               | 114 +++++++++++-
util/qemu-option.c          |  51 ++----
16 files changed, 621 insertions(+), 446 deletions(-)
[PATCH v2 00/11] vl: compound properties for machines
Posted by Paolo Bonzini 2 years, 10 months ago
This series converts -M to keyval parsing, so that they can use
compound properties.  The series also converts -smp to a
compound property.

This is also a preparatory work for SGX support, which would like to use
an array-type machine property.

Patches 1-3 introduce the infrastructure and the new functions that
will be used for "-M help" and to use keyval with "merge_lists = true"
semantics.

Patch 4 does the actual switch of -M to keyval and patch 5 removes now
dead code from qemu-option

Patches 6-11 finally validate the concept by implementing -smp as a
compound property; that is "-smp X=Y" is converted to "-machine smp.X=Y"
automatically.  Really the only interesting patches are 9 and 11,
while the others are just cleanups.

The series does not support JSON syntax for -M because we need
to consider what happens if string-based dictionaries (produced by -M
key=val) have to be merged with strongly-typed dictionaries (produced
by -M {'key': 123}).

The plan is to only allow exactly one -M option when JSON syntax is in
use; the problem is that this is a forwards-compatibility landmine.
As soon as -smp is converted, for example, -smp becomes a shortcut for -M
and it is now forbidden to use -M '{....}' together with -smp.  It would
be impossible to know which options in the future will become incompatible
with -M JSON syntax.  Therefore, support for JSON syntax is delayed
until after the main options are converted to QOM compound properties.
These could be -boot, -acpitable, -smbios, -m, -semihosting-config,
-rtc and -fw_cfg.

Paolo

Paolo Bonzini (11):
  qom: export more functions for use with non-UserCreatable objects
  keyval: introduce keyval_merge
  keyval: introduce keyval_parse_into
  vl: switch -M parsing to keyval
  qemu-option: remove now-dead code
  machine: move dies from X86MachineState to CpuTopology
  machine: move common smp_parse code to caller
  machine: add error propagation to mc->smp_parse
  machine: pass QAPI struct to mc->smp_parse
  machine: reject -smp dies!=1 for non-PC machines
  machine: add smp compound property

 hw/core/machine.c           | 192 +++++++++++---------
 hw/i386/pc.c                | 110 +++++-------
 hw/i386/x86.c               |  15 +-
 include/hw/boards.h         |   4 +-
 include/hw/i386/pc.h        |   3 -
 include/hw/i386/x86.h       |   1 -
 include/qemu/option.h       |   6 +-
 include/qom/object.h        |  23 +++
 qapi/machine.json           |  27 +++
 qom/object_interfaces.c     |  58 ++++--
 softmmu/vl.c                | 348 ++++++++++++++++++------------------
 tests/qtest/numa-test.c     |  22 +--
 tests/unit/test-keyval.c    |  58 ++++++
 tests/unit/test-qemu-opts.c |  35 ----
 util/keyval.c               | 114 +++++++++++-
 util/qemu-option.c          |  51 ++----
 16 files changed, 621 insertions(+), 446 deletions(-)

-- 
2.31.1


Re: [PATCH v2 00/11] vl: compound properties for machines
Posted by no-reply@patchew.org 2 years, 10 months ago
Patchew URL: https://patchew.org/QEMU/20210617155308.928754-1-pbonzini@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Type: series
Message-id: 20210617155308.928754-1-pbonzini@redhat.com
Subject: [PATCH v2 00/11] vl: compound properties for machines

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]         patchew/20210617155308.928754-1-pbonzini@redhat.com -> patchew/20210617155308.928754-1-pbonzini@redhat.com
Switched to a new branch 'test'
7860c75 machine: add smp compound property
4041654 machine: reject -smp dies!=1 for non-PC machines
9f99606 machine: pass QAPI struct to mc->smp_parse
c40ee9c machine: add error propagation to mc->smp_parse
a25c706 machine: move common smp_parse code to caller
b484366 machine: move dies from X86MachineState to CpuTopology
610f271 qemu-option: remove now-dead code
9fe2b23 vl: switch -M parsing to keyval
49a23ce keyval: introduce keyval_parse_into
d3a4e0d keyval: introduce keyval_merge
2dee6bc qom: export more functions for use with non-UserCreatable objects

=== OUTPUT BEGIN ===
1/11 Checking commit 2dee6bc29821 (qom: export more functions for use with non-UserCreatable objects)
2/11 Checking commit d3a4e0dd01bb (keyval: introduce keyval_merge)
ERROR: line over 90 characters
#45: FILE: tests/unit/test-keyval.c:756:
+    QDict *combined = keyval_parse("opt1=ABC,opt2.sub1=def,opt2.sub2=GHI,opt2.sub3=JKL,opt3=xyz",

WARNING: line over 80 characters
#119: FILE: util/keyval.c:318:
+static void keyval_do_merge(QDict *dest, const QDict *merged, GString *str, Error **errp)

ERROR: line over 90 characters
#129: FILE: util/keyval.c:328:
+                error_setg(errp, "Parameter '%s%s' used inconsistently", str->str, ent->key);

WARNING: Block comments use a leading /* on a separate line
#160: FILE: util/keyval.c:359:
+/* Merge the @merged dictionary into @dest.  The dictionaries are expected to be

total: 2 errors, 2 warnings, 153 lines checked

Patch 2/11 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

3/11 Checking commit 49a23ce11213 (keyval: introduce keyval_parse_into)
WARNING: line over 80 characters
#28: FILE: include/qemu/option.h:150:
+QDict *keyval_parse_into(QDict *qdict, const char *params, const char *implied_key,

WARNING: line over 80 characters
#50: FILE: util/keyval.c:510:
+QDict *keyval_parse_into(QDict *qdict, const char *params, const char *implied_key,

total: 0 errors, 2 warnings, 78 lines checked

Patch 3/11 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
4/11 Checking commit 9fe2b23c1acd (vl: switch -M parsing to keyval)
WARNING: line over 80 characters
#206: FILE: softmmu/vl.c:1592:
+            error_setg(&local_err, "No machine specified, and there is no default");

WARNING: line over 80 characters
#219: FILE: softmmu/vl.c:1598:
+        error_append_hint(&local_err, "Use -machine help to list supported machines\n");

WARNING: line over 80 characters
#256: FILE: softmmu/vl.c:1639:
+            error_setg(errp, "Conflict between '%s' and '%s'", ent->key, new_key);

WARNING: line over 80 characters
#300: FILE: softmmu/vl.c:1663:
+        object_register_sugar_prop(ACCEL_CLASS_NAME("xen"), "igd-passthru", value,

WARNING: line over 80 characters
#307: FILE: softmmu/vl.c:1670:
+        object_register_sugar_prop(ACCEL_CLASS_NAME("kvm"), "kvm-shadow-mem", value,

WARNING: line over 80 characters
#314: FILE: softmmu/vl.c:1677:
+        object_register_sugar_prop(ACCEL_CLASS_NAME("kvm"), "kernel-irqchip", value,

WARNING: line over 80 characters
#316: FILE: softmmu/vl.c:1679:
+        object_register_sugar_prop(ACCEL_CLASS_NAME("whpx"), "kernel-irqchip", value,

ERROR: line over 90 characters
#338: FILE: softmmu/vl.c:1804:
+    object_set_properties_from_keyval(OBJECT(current_machine), qdict, false, &error_fatal);

ERROR: line over 90 characters
#350: FILE: softmmu/vl.c:1834:
+        semihosting_arg_fallback(current_machine->kernel_filename, current_machine->kernel_cmdline);

ERROR: code indent should never use tabs
#414: FILE: softmmu/vl.c:2128:
+^I * Cannot merge string-valued and type-safe dictionaries, so JSON$

ERROR: code indent should never use tabs
#415: FILE: softmmu/vl.c:2129:
+^I * is not accepted yet for -M.$

ERROR: code indent should never use tabs
#416: FILE: softmmu/vl.c:2130:
+^I */$

ERROR: line over 90 characters
#526: FILE: softmmu/vl.c:3248:
+                    keyval_parse_into(machine_opts_dict, optarg, "type", &help, &error_fatal);

total: 6 errors, 7 warnings, 536 lines checked

Patch 4/11 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

5/11 Checking commit 610f27167f8f (qemu-option: remove now-dead code)
6/11 Checking commit b48436688841 (machine: move dies from X86MachineState to CpuTopology)
7/11 Checking commit a25c706e0639 (machine: move common smp_parse code to caller)
8/11 Checking commit c40ee9c046fb (machine: add error propagation to mc->smp_parse)
9/11 Checking commit 9f9960617bab (machine: pass QAPI struct to mc->smp_parse)
WARNING: line over 80 characters
#96: FILE: hw/i386/pc.c:713:
+static void pc_smp_parse(MachineState *ms, SMPConfiguration *config, Error **errp)

total: 0 errors, 1 warnings, 134 lines checked

Patch 9/11 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.
10/11 Checking commit 4041654d0ebc (machine: reject -smp dies!=1 for non-PC machines)
11/11 Checking commit 7860c7588061 (machine: add smp compound property)
ERROR: line over 90 characters
#236: FILE: softmmu/vl.c:3316:
+                machine_parse_property_opt(qemu_find_opts("smp-opts"), "smp", optarg, &error_fatal);

WARNING: line over 80 characters
#249: FILE: tests/qtest/numa-test.c:28:
+    cli = make_cli(data, "-machine smp.cpus=8 -numa node,nodeid=0,memdev=ram,cpus=0-3 "

WARNING: line over 80 characters
#258: FILE: tests/qtest/numa-test.c:45:
+    cli = make_cli(data, "-machine smp.cpus=8 -numa node,memdev=ram -numa node");

ERROR: line over 90 characters
#285: FILE: tests/qtest/numa-test.c:127:
+    cli = make_cli(data, "-cpu pentium -machine smp.cpus=8,smp.sockets=2,smp.cores=2,smp.threads=2 "

total: 2 errors, 2 warnings, 284 lines checked

Patch 11/11 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1


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