[Qemu-devel] [PATCH v2 03/29] qapi: Split error.json off common.json

Markus Armbruster posted 29 patches 6 years, 6 months ago
Maintainers: Giuseppe Lettieri <g.lettieri@iet.unipi.it>, Andrzej Zaborowski <balrogg@gmail.com>, Stafford Horne <shorne@gmail.com>, Xiao Guangrong <xiaoguangrong.eric@gmail.com>, Aleksandar Markovic <amarkovic@wavecomp.com>, Riku Voipio <riku.voipio@iki.fi>, Michael Walle <michael@walle.cc>, Juan Quintela <quintela@redhat.com>, Pierre Morel <pmorel@linux.ibm.com>, Bastian Koppelmann <kbastian@mail.uni-paderborn.de>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>, Markus Armbruster <armbru@redhat.com>, BALATON Zoltan <balaton@eik.bme.hu>, Stefan Weil <sw@weilnetz.de>, Corey Minyard <minyard@acm.org>, Leif Lindholm <leif.lindholm@linaro.org>, Beniamino Galvani <b.galvani@gmail.com>, "Michael S. Tsirkin" <mst@redhat.com>, Amit Shah <amit@kernel.org>, Sagar Karandikar <sagark@eecs.berkeley.edu>, Collin Walling <walling@linux.ibm.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Yuval Shaia <yuval.shaia@oracle.com>, Liu Yuan <namei.unix@gmail.com>, Alex Williamson <alex.williamson@redhat.com>, Peter Chubb <peter.chubb@nicta.com.au>, Anthony Perard <anthony.perard@citrix.com>, Andrew Jeffery <andrew@aj.id.au>, Alistair Francis <Alistair.Francis@wdc.com>, Richard Henderson <rth@twiddle.net>, Luigi Rizzo <rizzo@iet.unipi.it>, Anthony Green <green@moxielogic.com>, Shannon Zhao <shannon.zhaosl@gmail.com>, Peter Lieven <pl@kamp.de>, Jason Wang <jasowang@redhat.com>, Laurent Vivier <laurent@vivier.eu>, Corey Minyard <cminyard@mvista.com>, Vincenzo Maffione <v.maffione@gmail.com>, James Hogan <jhogan@kernel.org>, Gonglei <arei.gonglei@huawei.com>, Christian Borntraeger <borntraeger@de.ibm.com>, Fabien Chouteau <chouteau@adacore.com>, "Cédric Le Goater" <clg@kaod.org>, David Gibson <david@gibson.dropbear.id.au>, Marek Vasut <marex@denx.de>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Alberto Garcia <berto@igalia.com>, Laurent Vivier <lvivier@redhat.com>, Max Filippov <jcmvbkbc@gmail.com>, KONRAD Frederic <frederic.konrad@adacore.com>, "Hervé Poussineau" <hpoussin@reactos.org>, Keith Busch <keith.busch@intel.com>, Stefano Stabellini <sstabellini@kernel.org>, zhanghailiang <zhang.zhanghailiang@huawei.com>, Eric Blake <eblake@redhat.com>, David Hildenbrand <david@redhat.com>, Paul Burton <pburton@wavecomp.com>, Jan Kiszka <jan.kiszka@web.de>, Igor Mitsyanko <i.mitsyanko@gmail.com>, Joel Stanley <joel@jms.id.au>, Stefan Berger <stefanb@linux.ibm.com>, Peter Maydell <peter.maydell@linaro.org>, Jia Liu <proljc@gmail.com>, Igor Mammedov <imammedo@redhat.com>, Helge Deller <deller@gmx.de>, Fam Zheng <fam@euphon.net>, Jiri Pirko <jiri@resnulli.us>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Magnus Damm <magnus.damm@gmail.com>, Samuel Thibault <samuel.thibault@ens-lyon.org>, Stefan Hajnoczi <stefanha@redhat.com>, Xie Changlong <xiechanglong.d@gmail.com>, Thomas Huth <huth@tuxfamily.org>, Marcelo Tosatti <mtosatti@redhat.com>, "Philippe Mathieu-Daudé" <philmd@redhat.com>, John Snow <jsnow@redhat.com>, Guan Xuetao <gxt@mprc.pku.edu.cn>, Palmer Dabbelt <palmer@sifive.com>, Gerd Hoffmann <kraxel@redhat.com>, Andrey Smirnov <andrew.smirnov@gmail.com>, Thomas Huth <thuth@redhat.com>, Hannes Reinecke <hare@suse.com>, Jiri Slaby <jslaby@suse.cz>, Kevin Wolf <kwolf@redhat.com>, Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>, Subbaraya Sundeep <sundeep.lkml@gmail.com>, Andrew Baumann <Andrew.Baumann@microsoft.com>, Alistair Francis <alistair@alistair23.me>, Rob Herring <robh@kernel.org>, Halil Pasic <pasic@linux.ibm.com>, Paolo Bonzini <pbonzini@redhat.com>, Aurelien Jarno <aurelien@aurel32.net>, Dmitry Fleytman <dmitry.fleytman@gmail.com>, Cornelia Huck <cohuck@redhat.com>, "Alex Bennée" <alex.bennee@linaro.org>, Eduardo Habkost <ehabkost@redhat.com>, Radoslaw Biernacki <radoslaw.biernacki@linaro.org>, Eric Farman <farman@linux.ibm.com>, Wen Congyang <wencongyang2@huawei.com>, Max Reitz <mreitz@redhat.com>, Chris Wulff <crwulff@gmail.com>, Eric Auger <eric.auger@redhat.com>, Greg Kurz <groug@kaod.org>, Paul Durrant <paul.durrant@citrix.com>, Antony Pavlov <antonynpavlov@gmail.com>, Michael Roth <mdroth@linux.vnet.ibm.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Jean-Christophe Dubois <jcd@tribudubois.net>, Tony Krowiak <akrowiak@linux.ibm.com>, Ben Warren <ben@skyportsystems.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Aleksandar Rikalo <arikalo@wavecomp.com>, "Dr. David Alan Gilbert" <dgilbert@redhat.com>, Laszlo Ersek <lersek@redhat.com>, Artyom Tarasenko <atar4qemu@gmail.com>
There is a newer version of this series
[Qemu-devel] [PATCH v2 03/29] qapi: Split error.json off common.json
Posted by Markus Armbruster 6 years, 6 months ago
In my "build everything" tree, changing a type in qapi/common.json
triggers a recompile of some 3600 out of 6600 objects (not counting
tests and objects that don't depend on qemu/osdep.h).

One common dependency is QapiErrorClass: it's used only in in
qapi/error.h, which uses nothing else, and is widely included.

Move QapiErrorClass from common.json to new error.json.  Touching
common.json now recompiles only some 2900 objects.

Cc: Eric Blake <eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
 MAINTAINERS           |  2 ++
 include/qapi/error.h  |  2 +-
 qapi/Makefile.objs    |  2 +-
 qapi/common.json      | 24 ------------------------
 qapi/error.json       | 29 +++++++++++++++++++++++++++++
 qapi/qapi-schema.json |  1 +
 6 files changed, 34 insertions(+), 26 deletions(-)
 create mode 100644 qapi/error.json

diff --git a/MAINTAINERS b/MAINTAINERS
index d6de200453..adc64cfe33 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1874,6 +1874,7 @@ M: Markus Armbruster <armbru@redhat.com>
 S: Supported
 F: include/qapi/error.h
 F: include/qemu/error-report.h
+F: qapi/error.json
 F: util/error.c
 F: util/qemu-error.c
 
@@ -2062,6 +2063,7 @@ F: monitor/monitor-internal.h
 F: monitor/qmp*
 F: monitor/misc.c
 F: monitor/monitor.c
+F: qapi/error.json
 F: docs/devel/*qmp-*
 F: docs/interop/*qmp-*
 F: scripts/qmp/
diff --git a/include/qapi/error.h b/include/qapi/error.h
index 51b63dd4b5..3f95141a01 100644
--- a/include/qapi/error.h
+++ b/include/qapi/error.h
@@ -119,7 +119,7 @@
 #ifndef ERROR_H
 #define ERROR_H
 
-#include "qapi/qapi-types-common.h"
+#include "qapi/qapi-types-error.h"
 
 /*
  * Overall category of an error.
diff --git a/qapi/Makefile.objs b/qapi/Makefile.objs
index c5a29e86e2..dd3f5e6f94 100644
--- a/qapi/Makefile.objs
+++ b/qapi/Makefile.objs
@@ -6,7 +6,7 @@ util-obj-y += qmp-event.o
 util-obj-y += qapi-util.o
 
 QAPI_COMMON_MODULES = audio authz block-core block char common crypto
-QAPI_COMMON_MODULES += dump introspect job machine migration misc net
+QAPI_COMMON_MODULES += dump error introspect job machine migration misc net
 QAPI_COMMON_MODULES += qdev qom rdma rocker run-state sockets tpm
 QAPI_COMMON_MODULES += trace transaction ui
 QAPI_TARGET_MODULES = machine-target misc-target
diff --git a/qapi/common.json b/qapi/common.json
index 99d313ef3b..3d4e8de1e0 100644
--- a/qapi/common.json
+++ b/qapi/common.json
@@ -4,30 +4,6 @@
 # = Common data types
 ##
 
-##
-# @QapiErrorClass:
-#
-# QEMU error classes
-#
-# @GenericError: this is used for errors that don't require a specific error
-#                class. This should be the default case for most errors
-#
-# @CommandNotFound: the requested command has not been found
-#
-# @DeviceNotActive: a device has failed to be become active
-#
-# @DeviceNotFound: the requested device has not been found
-#
-# @KVMMissingCap: the requested operation can't be fulfilled because a
-#                 required KVM capability is missing
-#
-# Since: 1.2
-##
-{ 'enum': 'QapiErrorClass',
-  # Keep this in sync with ErrorClass in error.h
-  'data': [ 'GenericError', 'CommandNotFound',
-            'DeviceNotActive', 'DeviceNotFound', 'KVMMissingCap' ] }
-
 ##
 # @IoOperationType:
 #
diff --git a/qapi/error.json b/qapi/error.json
new file mode 100644
index 0000000000..3fad08f506
--- /dev/null
+++ b/qapi/error.json
@@ -0,0 +1,29 @@
+# -*- Mode: Python -*-
+
+##
+# = QMP errors
+##
+
+##
+# @QapiErrorClass:
+#
+# QEMU error classes
+#
+# @GenericError: this is used for errors that don't require a specific error
+#                class. This should be the default case for most errors
+#
+# @CommandNotFound: the requested command has not been found
+#
+# @DeviceNotActive: a device has failed to be become active
+#
+# @DeviceNotFound: the requested device has not been found
+#
+# @KVMMissingCap: the requested operation can't be fulfilled because a
+#                 required KVM capability is missing
+#
+# Since: 1.2
+##
+{ 'enum': 'QapiErrorClass',
+  # Keep this in sync with ErrorClass in error.h
+  'data': [ 'GenericError', 'CommandNotFound',
+            'DeviceNotActive', 'DeviceNotFound', 'KVMMissingCap' ] }
diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
index 38af54d6b3..920b03b0aa 100644
--- a/qapi/qapi-schema.json
+++ b/qapi/qapi-schema.json
@@ -80,6 +80,7 @@
 # stable order, it's best to include each sub-schema just once, or
 # include it first right here.
 
+{ 'include': 'error.json' }
 { 'include': 'common.json' }
 { 'include': 'sockets.json' }
 { 'include': 'run-state.json' }
-- 
2.21.0


Re: [Qemu-devel] [PATCH v2 03/29] qapi: Split error.json off common.json
Posted by Philippe Mathieu-Daudé 6 years, 6 months ago
On 8/6/19 5:14 PM, Markus Armbruster wrote:
> In my "build everything" tree, changing a type in qapi/common.json
> triggers a recompile of some 3600 out of 6600 objects (not counting
> tests and objects that don't depend on qemu/osdep.h).
> 
> One common dependency is QapiErrorClass: it's used only in in
> qapi/error.h, which uses nothing else, and is widely included.
> 
> Move QapiErrorClass from common.json to new error.json.  Touching
> common.json now recompiles only some 2900 objects.

Nice.

> 
> Cc: Eric Blake <eblake@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> Reviewed-by: Eric Blake <eblake@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  MAINTAINERS           |  2 ++
>  include/qapi/error.h  |  2 +-
>  qapi/Makefile.objs    |  2 +-
>  qapi/common.json      | 24 ------------------------
>  qapi/error.json       | 29 +++++++++++++++++++++++++++++
>  qapi/qapi-schema.json |  1 +
>  6 files changed, 34 insertions(+), 26 deletions(-)
>  create mode 100644 qapi/error.json
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index d6de200453..adc64cfe33 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1874,6 +1874,7 @@ M: Markus Armbruster <armbru@redhat.com>
>  S: Supported
>  F: include/qapi/error.h
>  F: include/qemu/error-report.h
> +F: qapi/error.json
>  F: util/error.c
>  F: util/qemu-error.c
>  
> @@ -2062,6 +2063,7 @@ F: monitor/monitor-internal.h
>  F: monitor/qmp*
>  F: monitor/misc.c
>  F: monitor/monitor.c
> +F: qapi/error.json
>  F: docs/devel/*qmp-*
>  F: docs/interop/*qmp-*
>  F: scripts/qmp/
> diff --git a/include/qapi/error.h b/include/qapi/error.h
> index 51b63dd4b5..3f95141a01 100644
> --- a/include/qapi/error.h
> +++ b/include/qapi/error.h
> @@ -119,7 +119,7 @@
>  #ifndef ERROR_H
>  #define ERROR_H
>  
> -#include "qapi/qapi-types-common.h"
> +#include "qapi/qapi-types-error.h"
>  
>  /*
>   * Overall category of an error.
> diff --git a/qapi/Makefile.objs b/qapi/Makefile.objs
> index c5a29e86e2..dd3f5e6f94 100644
> --- a/qapi/Makefile.objs
> +++ b/qapi/Makefile.objs
> @@ -6,7 +6,7 @@ util-obj-y += qmp-event.o
>  util-obj-y += qapi-util.o
>  
>  QAPI_COMMON_MODULES = audio authz block-core block char common crypto
> -QAPI_COMMON_MODULES += dump introspect job machine migration misc net
> +QAPI_COMMON_MODULES += dump error introspect job machine migration misc net
>  QAPI_COMMON_MODULES += qdev qom rdma rocker run-state sockets tpm
>  QAPI_COMMON_MODULES += trace transaction ui
>  QAPI_TARGET_MODULES = machine-target misc-target
> diff --git a/qapi/common.json b/qapi/common.json
> index 99d313ef3b..3d4e8de1e0 100644
> --- a/qapi/common.json
> +++ b/qapi/common.json
> @@ -4,30 +4,6 @@
>  # = Common data types
>  ##
>  
> -##
> -# @QapiErrorClass:
> -#
> -# QEMU error classes
> -#
> -# @GenericError: this is used for errors that don't require a specific error
> -#                class. This should be the default case for most errors
> -#
> -# @CommandNotFound: the requested command has not been found
> -#
> -# @DeviceNotActive: a device has failed to be become active
> -#
> -# @DeviceNotFound: the requested device has not been found
> -#
> -# @KVMMissingCap: the requested operation can't be fulfilled because a
> -#                 required KVM capability is missing
> -#
> -# Since: 1.2
> -##
> -{ 'enum': 'QapiErrorClass',
> -  # Keep this in sync with ErrorClass in error.h
> -  'data': [ 'GenericError', 'CommandNotFound',
> -            'DeviceNotActive', 'DeviceNotFound', 'KVMMissingCap' ] }
> -
>  ##
>  # @IoOperationType:
>  #
> diff --git a/qapi/error.json b/qapi/error.json
> new file mode 100644
> index 0000000000..3fad08f506
> --- /dev/null
> +++ b/qapi/error.json
> @@ -0,0 +1,29 @@
> +# -*- Mode: Python -*-
> +
> +##
> +# = QMP errors
> +##
> +
> +##
> +# @QapiErrorClass:
> +#
> +# QEMU error classes
> +#
> +# @GenericError: this is used for errors that don't require a specific error
> +#                class. This should be the default case for most errors
> +#
> +# @CommandNotFound: the requested command has not been found
> +#
> +# @DeviceNotActive: a device has failed to be become active
> +#
> +# @DeviceNotFound: the requested device has not been found
> +#
> +# @KVMMissingCap: the requested operation can't be fulfilled because a
> +#                 required KVM capability is missing
> +#
> +# Since: 1.2
> +##
> +{ 'enum': 'QapiErrorClass',
> +  # Keep this in sync with ErrorClass in error.h
> +  'data': [ 'GenericError', 'CommandNotFound',
> +            'DeviceNotActive', 'DeviceNotFound', 'KVMMissingCap' ] }
> diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
> index 38af54d6b3..920b03b0aa 100644
> --- a/qapi/qapi-schema.json
> +++ b/qapi/qapi-schema.json
> @@ -80,6 +80,7 @@
>  # stable order, it's best to include each sub-schema just once, or
>  # include it first right here.
>  
> +{ 'include': 'error.json' }
>  { 'include': 'common.json' }
>  { 'include': 'sockets.json' }
>  { 'include': 'run-state.json' }
>