Skip to contentSkip to conversation

Move target- and device specific code from monitor

PATCH Superseded Denis V. Lunev 4 participants 20 messages Aug 12, 2015 – Aug 28, 2015 Kbuild

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover Move target- and device specific code from monitor

The monivation of this set is simple. Recently we have proposed patch to monitor.c with specific x86 APIC HMP commands. The patchset was denied with the main motivation "No more arch specific code in monitor.c" This patchset is the first step to move arch specific code from monitor.c targets.

So, monitor.c already contains a lot of generic code, as well as the target specifics code and eventually monitor.c volume will only grow. This trend leads to a variety of fouling code ifdeffery(and combinations thereof), poor readability, and entanglement of architecture of the project. If someone wants to improve processing logic commands at the monitor, it isn't necessarily must differentiate amongst the implementation of some ARM or x86_64 specific commands, because the project already has separation of target specific code on directories.

The presented solution is not the best, but it is quite simple (PATCH doesn't add more code!) and decides the above mentioned issue. Subsequently it will not prevent the introduction of more advanced mechanism that can more effectively resolve the issue.

There is a issue with the placement of code for multiple architectures (isn't for everyone), but this code is very small. This patch is a step towards solving the issue associated with maintaining the purity of the code and structure of the project, which solves not all, but doing a little better than it is.

Changes from v1:
- ported to new head

CC Luiz Capitulino <[email protected]>
CC Paolo Bonzini <[email protected]>
CC Peter Maydell <[email protected]>
#1 lore raw

PATCH v2 1/3 hmp-commands-info: move info_cmds content out of monitor.c

From: Pavel Butsykin <[email protected]>

For moving target- and device-specific code from monitor.c, to beginning we move info_cmds content to hmp-commands-info.hx

CC Luiz Capitulino <[email protected]>
CC Paolo Bonzini <[email protected]>
CC Peter Maydell <[email protected]>
---
 Makefile.target      |   5 +-
 hmp-commands-info.hx | 711 +++++++++++++++++++++++++++++++++++++++++++++++++++
 monitor.c            | 373 +--------------------------
 3 files changed, 717 insertions(+), 372 deletions(-)
 create mode 100644 hmp-commands-info.hx
Makefile.target +4 -1
index 3e7aafd..93ae46d 100644
@@ -151,7 +151,7 @@ else
 obj-y += hw/$(TARGET_BASE_ARCH)/
 endif
 
-GENERATED_HEADERS += hmp-commands.h qmp-commands-old.h
+GENERATED_HEADERS += hmp-commands.h hmp-commands-info.h qmp-commands-old.h
 
 endif # CONFIG_SOFTMMU
 
@@ -193,6 +193,9 @@ gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
 hmp-commands.h: $(SRC_PATH)/hmp-commands.hx
 	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
 
+hmp-commands-info.h: $(SRC_PATH)/hmp-commands-info.hx
+	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
+
 qmp-commands-old.h: $(SRC_PATH)/qmp-commands.hx
 	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $(TARGET_DIR)$@")
 
hmp-commands-info.hx new file +711 -0

711 lines not on this page · raw message

monitor.c +2 -371

379 lines not on this page · raw message

Signature · 1 line
2.1.4
Reviewed-by on v2 1/3
#2 lore raw

Re: [Qemu-devel] [PATCH 1/3] hmp-commands-info: move info_cmds content out of monitor.c

Quoted 11 lines · Denis V. Lunev

From: Pavel Butsykin <[email protected]>

For moving target- and device-specific code from monitor.c, to beginning we move info_cmds content to hmp-commands-info.hx

CC Luiz Capitulino <[email protected]>
CC Paolo Bonzini <[email protected]>
CC Peter Maydell <[email protected]>

---

We should be able to pull some of the #ifdefs out of this a bit better, but easier to do that as a secondary stop.

thanks
-- PMM

#3 lore raw

PATCH v2 2/3 monitor: remove target-specific code from monitor.c

In reply to Denis V. Lunev

From: Pavel Butsykin <[email protected]>

Move target-specific code out of /monitor.c to /target-*/monitor.c, this will avoid code cluttering and using random ifdeffery. The solution is quite simple, but solves the issue of the separation of target-specific code from monitor

CC Luiz Capitulino <[email protected]>
CC Paolo Bonzini <[email protected]>
CC Peter Maydell <[email protected]>
---
 include/monitor/monitor-common.h |  43 ++
 monitor.c                        | 854 +--------------------------------------
 target-i386/Makefile.objs        |   2 +-
 target-i386/monitor.c            | 489 ++++++++++++++++++++++
 target-ppc/Makefile.objs         |   2 +-
 target-ppc/monitor.c             | 250 ++++++++++++
 target-sh4/Makefile.objs         |   1 +
 target-sh4/monitor.c             |  52 +++
 target-sparc/Makefile.objs       |   2 +-
 target-sparc/monitor.c           | 153 +++++++
 target-xtensa/Makefile.objs      |   1 +
 target-xtensa/monitor.c          |  34 ++
 12 files changed, 1032 insertions(+), 851 deletions(-)
 create mode 100644 include/monitor/monitor-common.h
 create mode 100644 target-i386/monitor.c
 create mode 100644 target-ppc/monitor.c
 create mode 100644 target-sh4/monitor.c
 create mode 100644 target-sparc/monitor.c
 create mode 100644 target-xtensa/monitor.c
include/monitor/monitor-common.h new file +43 -0
new file mode 100644
index 0000000..e1d79b9
@@ -0,0 +1,43 @@
+/*
+ * QEMU monitor
+ *
+ * Copyright (c) 2003-2004 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#ifndef MONITOR_COMMON_H
+#define MONITOR_COMMON_H
+
+#define MD_TLONG 0
+#define MD_I32   1
+
+typedef struct MonitorDef {
+    const char *name;
+    int offset;
+    target_long (*get_value)(const struct MonitorDef *md, int val);
+    int type;
+} MonitorDef;
+
+CPUArchState *mon_get_cpu_env(void);
+
+void hmp_info_mem(Monitor *mon, const QDict *qdict);
+void hmp_info_tlb(Monitor *mon, const QDict *qdict);
+void hmp_mce(Monitor *mon, const QDict *qdict);
+
+#endif /* MONITOR_COMMON */
monitor.c +6 -848

886 lines not on this page · raw message

target-i386/Makefile.objs +1 -1
index 7a1df2c..3da413e 100644
@@ -2,6 +2,6 @@ obj-y += translate.o helper.o cpu.o
 obj-y += excp_helper.o fpu_helper.o cc_helper.o int_helper.o svm_helper.o
 obj-y += smm_helper.o misc_helper.o mem_helper.o seg_helper.o
 obj-y += gdbstub.o
-obj-$(CONFIG_SOFTMMU) += machine.o arch_memory_mapping.o arch_dump.o
+obj-$(CONFIG_SOFTMMU) += machine.o arch_memory_mapping.o arch_dump.o monitor.o
 obj-$(CONFIG_KVM) += kvm.o
 obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
target-i386/monitor.c new file +489 -0

489 lines not on this page · raw message

target-ppc/Makefile.objs +1 -1
index a7ae392..47a3e98 100644
@@ -1,7 +1,7 @@
 obj-y += cpu-models.o
 obj-y += translate.o
 ifeq ($(CONFIG_SOFTMMU),y)
-obj-y += machine.o mmu_helper.o mmu-hash32.o
+obj-y += machine.o mmu_helper.o mmu-hash32.o monitor.o
 obj-$(TARGET_PPC64) += mmu-hash64.o arch_dump.o
 endif
 obj-$(CONFIG_KVM) += kvm.o kvm_ppc.o
target-ppc/monitor.c new file +250 -0

250 lines not on this page · raw message

target-sh4/Makefile.objs +1 -0
index a285358..2c25d96 100644
@@ -1,2 +1,3 @@
 obj-y += translate.o op_helper.o helper.o cpu.o
+obj-$(CONFIG_SOFTMMU) += monitor.o
 obj-y += gdbstub.o
target-sh4/monitor.c new file +52 -0

52 lines not on this page · raw message

target-sparc/Makefile.objs +1 -1
index 1cd81cc..ec90569 100644
@@ -1,4 +1,4 @@
-obj-$(CONFIG_SOFTMMU) += machine.o
+obj-$(CONFIG_SOFTMMU) += machine.o monitor.o
 obj-y += translate.o helper.o cpu.o
 obj-y += fop_helper.o cc_helper.o win_helper.o mmu_helper.o ldst_helper.o
 obj-$(TARGET_SPARC) += int32_helper.o
target-sparc/monitor.c new file +153 -0

153 lines not on this page · raw message

target-xtensa/Makefile.objs +1 -0
index 5c150a8..481de91 100644
@@ -2,5 +2,6 @@ obj-y += xtensa-semi.o
 obj-y += core-dc232b.o
 obj-y += core-dc233c.o
 obj-y += core-fsf.o
+obj-$(CONFIG_SOFTMMU) += monitor.o
 obj-y += translate.o op_helper.o helper.o cpu.o
 obj-y += gdbstub.o
target-xtensa/monitor.c new file +34 -0
new file mode 100644
index 0000000..412379b
@@ -0,0 +1,34 @@
+/*
+ * QEMU monitor
+ *
+ * Copyright (c) 2003-2004 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#include "cpu.h"
+#include "monitor/monitor.h"
+#include "monitor/monitor-common.h"
+#include "hmp.h"
+
+void hmp_info_tlb(Monitor *mon, const QDict *qdict)
+{
+    CPUArchState *env1 = mon_get_cpu_env();
+
+    dump_mmu((FILE*)mon, (fprintf_function)monitor_printf, env1);
+}
Signature · 1 line
2.1.4
#4 lore raw

Re: [Qemu-devel] [PATCH 2/3] monitor: remove target-specific code from monitor.c

Quoted 33 lines · Denis V. Lunev

From: Pavel Butsykin <[email protected]>

Move target-specific code out of /monitor.c to /target-*/monitor.c, this will avoid code cluttering and using random ifdeffery. The solution is quite simple, but solves the issue of the separation of target-specific code from monitor

CC Luiz Capitulino <[email protected]>
CC Paolo Bonzini <[email protected]>
CC Peter Maydell <[email protected]>
---
 include/monitor/monitor-common.h |  43 ++
 monitor.c                        | 854 +--------------------------------------
 target-i386/Makefile.objs        |   2 +-
 target-i386/monitor.c            | 489 ++++++++++++++++++++++
 target-ppc/Makefile.objs         |   2 +-
 target-ppc/monitor.c             | 250 ++++++++++++
 target-sh4/Makefile.objs         |   1 +
 target-sh4/monitor.c             |  52 +++
 target-sparc/Makefile.objs       |   2 +-
 target-sparc/monitor.c           | 153 +++++++
 target-xtensa/Makefile.objs      |   1 +
 target-xtensa/monitor.c          |  34 ++
 12 files changed, 1032 insertions(+), 851 deletions(-)
 create mode 100644 include/monitor/monitor-common.h
 create mode 100644 target-i386/monitor.c
 create mode 100644 target-ppc/monitor.c
 create mode 100644 target-sh4/monitor.c
 create mode 100644 target-sparc/monitor.c
 create mode 100644 target-xtensa/monitor.c

monitor.c static const mon_cmd_t qmp_cmds[] = { · line 2076

Quoted 5 lines
monitor.c +4 -0
+#if defined(TARGET_SPARC) || defined(TARGET_PPC) || defined(TARGET_I386)
+extern const MonitorDef monitor_defs[];
+#else
+const MonitorDef monitor_defs[] = {};
 #endif

So, rather than having to have a list of which targets provide a monitor_defs[], I would suggest that we make the API implemented by the target be a function, like:
const MonitorDef *target_monitor_defs(void);
(which just returns a pointer to a static const array in the target-*/monitor.c file). Then you can add a file stubs/target-monitor-defs.c which provides the "stub" version of this function (just returns a pointer to the no-commands array). The link process will arrange that the stub version is pulled in for any target that doesn't provide its own implementation of the function.

Other than that, I suspect we can improve the separation out of target-specific things, but this is a good improvement and it'll be easier to do the rest as incremental fixes on top of this later.

thanks
-- PMM

#5 lore raw

Re: [Qemu-devel] [PATCH 2/3] monitor: remove target-specific code from monitor.c

Quoted 50 lines · Peter Maydell
Quoted 32 lines · Denis V. Lunev

From: Pavel Butsykin <[email protected]>

Move target-specific code out of /monitor.c to /target-*/monitor.c, this will avoid code cluttering and using random ifdeffery. The solution is quite simple, but solves the issue of the separation of target-specific code from monitor

CC Luiz Capitulino <[email protected]>
CC Paolo Bonzini <[email protected]>
CC Peter Maydell <[email protected]>
---
  include/monitor/monitor-common.h |  43 ++
  monitor.c                        | 854 +--------------------------------------
  target-i386/Makefile.objs        |   2 +-
  target-i386/monitor.c            | 489 ++++++++++++++++++++++
  target-ppc/Makefile.objs         |   2 +-
  target-ppc/monitor.c             | 250 ++++++++++++
  target-sh4/Makefile.objs         |   1 +
  target-sh4/monitor.c             |  52 +++
  target-sparc/Makefile.objs       |   2 +-
  target-sparc/monitor.c           | 153 +++++++
  target-xtensa/Makefile.objs      |   1 +
  target-xtensa/monitor.c          |  34 ++
  12 files changed, 1032 insertions(+), 851 deletions(-)

create mode 100644 include/monitor/monitor-common.h create mode 100644 target-i386/monitor.c create mode 100644 target-ppc/monitor.c create mode 100644 target-sh4/monitor.c create mode 100644 target-sparc/monitor.c create mode 100644 target-xtensa/monitor.c

monitor.c static const mon_cmd_t qmp_cmds[] = { · line 2076

Quoted 5 lines
monitor.c +4 -0
+#if defined(TARGET_SPARC) || defined(TARGET_PPC) || defined(TARGET_I386)
+extern const MonitorDef monitor_defs[];
+#else
+const MonitorDef monitor_defs[] = {};
  #endif

So, rather than having to have a list of which targets provide a monitor_defs[], I would suggest that we make the API implemented by the target be a function, like:

    const MonitorDef *target_monitor_defs(void);

(which just returns a pointer to a static const array in the target-*/monitor.c file). Then you can add a file stubs/target-monitor-defs.c which provides the "stub" version of this function (just returns a pointer to the no-commands array). The link process will arrange that the stub version is pulled in for any target that doesn't provide its own implementation of the function.

Quoted 7 lines

Other than that, I suspect we can improve the separation out of target-specific things, but this is a good improvement and it'll be easier to do the rest as incremental fixes on top of this later.

thanks
-- PMM

ok, sounds good to me

Thank you for the suggestion

#6 lore raw

Re: [Qemu-devel] [PATCH 2/3] monitor: remove target-specific code from monitor.c

In reply to Peter Maydell
Quoted 50 lines · Peter Maydell
Quoted 32 lines · Denis V. Lunev

From: Pavel Butsykin <[email protected]>

Move target-specific code out of /monitor.c to /target-*/monitor.c, this will avoid code cluttering and using random ifdeffery. The solution is quite simple, but solves the issue of the separation of target-specific code from monitor

CC Luiz Capitulino <[email protected]>
CC Paolo Bonzini <[email protected]>
CC Peter Maydell <[email protected]>
---
  include/monitor/monitor-common.h |  43 ++
  monitor.c                        | 854 +--------------------------------------
  target-i386/Makefile.objs        |   2 +-
  target-i386/monitor.c            | 489 ++++++++++++++++++++++
  target-ppc/Makefile.objs         |   2 +-
  target-ppc/monitor.c             | 250 ++++++++++++
  target-sh4/Makefile.objs         |   1 +
  target-sh4/monitor.c             |  52 +++
  target-sparc/Makefile.objs       |   2 +-
  target-sparc/monitor.c           | 153 +++++++
  target-xtensa/Makefile.objs      |   1 +
  target-xtensa/monitor.c          |  34 ++
  12 files changed, 1032 insertions(+), 851 deletions(-)

create mode 100644 include/monitor/monitor-common.h create mode 100644 target-i386/monitor.c create mode 100644 target-ppc/monitor.c create mode 100644 target-sh4/monitor.c create mode 100644 target-sparc/monitor.c create mode 100644 target-xtensa/monitor.c

monitor.c static const mon_cmd_t qmp_cmds[] = { · line 2076

Quoted 5 lines
monitor.c +4 -0
+#if defined(TARGET_SPARC) || defined(TARGET_PPC) || defined(TARGET_I386)
+extern const MonitorDef monitor_defs[];
+#else
+const MonitorDef monitor_defs[] = {};
  #endif

So, rather than having to have a list of which targets provide a monitor_defs[], I would suggest that we make the API implemented by the target be a function, like:

    const MonitorDef *target_monitor_defs(void);

(which just returns a pointer to a static const array in the target-*/monitor.c file). Then you can add a file stubs/target-monitor-defs.c which provides the "stub" version of this function (just returns a pointer to the no-commands array). The link process will arrange that the stub version is pulled in for any target that doesn't provide its own implementation of the function.

Quoted 7 lines

Other than that, I suspect we can improve the separation out of target-specific things, but this is a good improvement and it'll be easier to do the rest as incremental fixes on top of this later.

thanks
-- PMM

Yes, this is a good way if we make the interface: const MonitorDef *target_monitor_defs(void); But we can't include the 'monitor/monitor-common.h' to stubs/target-monitor-defs.c, because there is a dependency with a target-specific headers( such as cpu.h:CPUArchState, cpu-defs.h:target_long). Make a copy of the struct MonitorDef not a good way because we can miss the change of copied MonitorDef in stubs/target-monitor-defs.c and this will result in an bug. Can this be solved somehow else?

#7 lore raw

Re: [Qemu-devel] [PATCH 2/3] monitor: remove target-specific code from monitor.c

Quoted 10 lines · Pavel Butsykin

Yes, this is a good way if we make the interface: const MonitorDef *target_monitor_defs(void);
But we can't include the 'monitor/monitor-common.h' to stubs/target-monitor-defs.c, because
there is a dependency with a target-specific headers( such as cpu.h:CPUArchState, cpu-defs.h:target_long).
Make a copy of the struct MonitorDef not a good way because we can miss the change of copied MonitorDef
in stubs/target-monitor-defs.c and this will result in an bug. Can this be solved somehow else?

That target_long is awkward. I suggest making the stub version just return NULL rather than a pointer to an empty list (you'll need to adjust the calling code slightly to handle the NULL return). Then the stub code only needs to be able to see the 'typedef struct MonitorDef MonitorDef' (which you can put in qemu-typedefs.h).

-- PMM

#8 lore raw

Re: [Qemu-devel] [PATCH 2/3] monitor: remove target-specific code from monitor.c

Quoted 11 lines · Peter Maydell
Quoted 10 lines · Pavel Butsykin

Yes, this is a good way if we make the interface: const MonitorDef *target_monitor_defs(void);
But we can't include the 'monitor/monitor-common.h' to stubs/target-monitor-defs.c, because
there is a dependency with a target-specific headers( such as cpu.h:CPUArchState, cpu-defs.h:target_long).
Make a copy of the struct MonitorDef not a good way because we can miss the change of copied MonitorDef
in stubs/target-monitor-defs.c and this will result in an bug. Can this be solved somehow else?

Quoted 8 lines

That target_long is awkward. I suggest making the stub version just return NULL rather than a pointer to an empty list (you'll need to adjust the calling code slightly to handle the NULL return). Then the stub code only needs to be able to see the 'typedef struct MonitorDef MonitorDef' (which you can put in qemu-typedefs.h).

-- PMM

Thank you for the suggestion, this seems a good way out.

#9 lore raw

PATCH v2 3/3 monitor: added generation of documentation for hmp-commands-info.hx

In reply to Denis V. Lunev

From: Pavel Butsykin <[email protected]>

It will be easier if you need to add info-commands to edit only hmp-commands-info.hx, before this had to edit monitor.c and hmp-commands.hx

CC Luiz Capitulino <[email protected]>
CC Paolo Bonzini <[email protected]>
CC Peter Maydell <[email protected]>
---
 .gitignore           |   1 +
 Makefile             |   9 ++--
 hmp-commands-info.hx |   4 ++
 hmp-commands.hx      | 120 ---------------------------------------------------
 qemu-doc.texi        |   2 +
 5 files changed, 13 insertions(+), 123 deletions(-)
.gitignore +1 -0
index 61bc492..f1c881a 100644
@@ -49,6 +49,7 @@
 /qemu-ga
 /qemu-bridge-helper
 /qemu-monitor.texi
+/qemu-monitor-info.texi
 /qmp-commands.txt
 /vscclient
 /fsdev/virtfs-proxy-helper
Makefile +6 -3
index 340d9c8..768422b 100644
@@ -344,7 +344,7 @@ qemu-%.tar.bz2:
 	$(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
 
 distclean: clean
-	rm -f config-host.mak config-host.h* config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi qemu-monitor.texi
+	rm -f config-host.mak config-host.h* config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi qemu-monitor.texi qemu-monitor-info.texi
 	rm -f config-all-devices.mak config-all-disas.mak config.status
 	rm -f po/*.mo tests/qemu-iotests/common.env
 	rm -f roms/seabios/config.mak roms/vgabios/config.mak
@@ -508,13 +508,16 @@ qemu-options.texi: $(SRC_PATH)/qemu-options.hx
 qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx
 	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
 
+qemu-monitor-info.texi: $(SRC_PATH)/hmp-commands-info.hx
+	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
+
 qmp-commands.txt: $(SRC_PATH)/qmp-commands.hx
 	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -q < $< > $@,"  GEN   $@")
 
 qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
 	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
 
-qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi
+qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi
 	$(call quiet-command, \
 	  perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu.pod && \
 	  $(POD2MAN) --section=1 --center=" " --release=" " qemu.pod > $@, \
@@ -551,7 +554,7 @@ pdf: qemu-doc.pdf qemu-tech.pdf
 
 qemu-doc.dvi qemu-doc.html qemu-doc.info qemu-doc.pdf: \
 	qemu-img.texi qemu-nbd.texi qemu-options.texi \
-	qemu-monitor.texi qemu-img-cmds.texi
+	qemu-monitor.texi qemu-monitor-info.texi qemu-img-cmds.texi
 
 ifdef CONFIG_WIN32
 
hmp-commands-info.hx +4 -0
index 9ccb33f..81ae9d7 100644
@@ -6,6 +6,9 @@ HXCOMM monitor info commands
 HXCOMM HXCOMM can be used for comments, discarded from both texi and C
 
 STEXI
+@item info @var{subcommand}
+@findex info
+Show various information about the system state.
 @table @option
 ETEXI
 
@@ -708,4 +711,5 @@ ETEXI
 
 STEXI
 @end table
+@end table
 ETEXI
hmp-commands.hx +0 -120

123 lines not on this page · raw message

qemu-doc.texi +2 -0
index 94af8c0..be81687 100644
@@ -391,6 +391,8 @@ The following commands are available:
 
 @include qemu-monitor.texi
 
+@include qemu-monitor-info.texi
+
 @subsection Integer expressions
 
 The monitor understands integers expressions for every integer
Signature · 1 line
2.1.4
#10 lore raw

Re: [Qemu-devel] [PATCH 3/3] monitor: added generation of documentation for hmp-commands-info.hx

Quoted 86 lines · Denis V. Lunev

From: Pavel Butsykin <[email protected]>

It will be easier if you need to add info-commands to edit only hmp-commands-info.hx, before this had to edit monitor.c and hmp-commands.hx

CC Luiz Capitulino <[email protected]>
CC Paolo Bonzini <[email protected]>
CC Peter Maydell <[email protected]>
---
 .gitignore           |   1 +
 Makefile             |   9 ++--
 hmp-commands-info.hx |   4 ++
 hmp-commands.hx      | 120 ---------------------------------------------------
 qemu-doc.texi        |   2 +
 5 files changed, 13 insertions(+), 123 deletions(-)
.gitignore +1 -0
index 61bc492..f1c881a 100644
@@ -49,6 +49,7 @@
 /qemu-ga
 /qemu-bridge-helper
 /qemu-monitor.texi
+/qemu-monitor-info.texi
 /qmp-commands.txt
 /vscclient
 /fsdev/virtfs-proxy-helper
Makefile +6 -3
index 340d9c8..768422b 100644
@@ -344,7 +344,7 @@ qemu-%.tar.bz2:
        $(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
 
 distclean: clean
-       rm -f config-host.mak config-host.h* config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi qemu-monitor.texi
+       rm -f config-host.mak config-host.h* config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi qemu-monitor.texi qemu-monitor-info.texi
        rm -f config-all-devices.mak config-all-disas.mak config.status
        rm -f po/*.mo tests/qemu-iotests/common.env
        rm -f roms/seabios/config.mak roms/vgabios/config.mak
@@ -508,13 +508,16 @@ qemu-options.texi: $(SRC_PATH)/qemu-options.hx
 qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx
        $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
 
+qemu-monitor-info.texi: $(SRC_PATH)/hmp-commands-info.hx
+       $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
+
 qmp-commands.txt: $(SRC_PATH)/qmp-commands.hx
        $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -q < $< > $@,"  GEN   $@")
 
 qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
        $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
 
-qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi
+qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi
        $(call quiet-command, \
          perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu.pod && \
          $(POD2MAN) --section=1 --center=" " --release=" " qemu.pod > $@, \
@@ -551,7 +554,7 @@ pdf: qemu-doc.pdf qemu-tech.pdf
 
 qemu-doc.dvi qemu-doc.html qemu-doc.info qemu-doc.pdf: \
        qemu-img.texi qemu-nbd.texi qemu-options.texi \
-       qemu-monitor.texi qemu-img-cmds.texi
+       qemu-monitor.texi qemu-monitor-info.texi qemu-img-cmds.texi
 
 ifdef CONFIG_WIN32
 
hmp-commands-info.hx +3 -0
index 9ccb33f..81ae9d7 100644
@@ -6,6 +6,9 @@ HXCOMM monitor info commands
 HXCOMM HXCOMM can be used for comments, discarded from both texi and C
 
 STEXI
+@item info @var{subcommand}
+@findex info
+Show various information about the system state.
 @table @option
 ETEXI
 

hmp-commands-info.hx ETEXI · line 715

Quoted 5 lines
hmp-commands-info.hx +1 -0
@@ -708,4 +711,5 @@ ETEXI
 
 STEXI
 @end table
+@end table
 ETEXI

Where does this extra "@end table" come from?

thanks
-- PMM

#11 lore raw

Re: [Qemu-devel] [PATCH 3/3] monitor: added generation of documentation for hmp-commands-info.hx

Quoted 88 lines · Peter Maydell
Quoted 87 lines · Denis V. Lunev

From: Pavel Butsykin <[email protected]>

It will be easier if you need to add info-commands to edit only hmp-commands-info.hx, before this had to edit monitor.c and hmp-commands.hx

CC Luiz Capitulino <[email protected]>
CC Paolo Bonzini <[email protected]>
CC Peter Maydell <[email protected]>
---
  .gitignore           |   1 +
  Makefile             |   9 ++--
  hmp-commands-info.hx |   4 ++
  hmp-commands.hx      | 120 ---------------------------------------------------
  qemu-doc.texi        |   2 +
  5 files changed, 13 insertions(+), 123 deletions(-)
.gitignore +1 -0
index 61bc492..f1c881a 100644
@@ -49,6 +49,7 @@
  /qemu-ga
  /qemu-bridge-helper
  /qemu-monitor.texi
+/qemu-monitor-info.texi
  /qmp-commands.txt
  /vscclient
  /fsdev/virtfs-proxy-helper
Makefile +6 -3
index 340d9c8..768422b 100644
@@ -344,7 +344,7 @@ qemu-%.tar.bz2:
         $(SRC_PATH)/scripts/make-release "$(SRC_PATH)" "$(patsubst qemu-%.tar.bz2,%,$@)"
 
  distclean: clean
-       rm -f config-host.mak config-host.h* config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi qemu-monitor.texi
+       rm -f config-host.mak config-host.h* config-host.ld $(DOCS) qemu-options.texi qemu-img-cmds.texi qemu-monitor.texi qemu-monitor-info.texi
         rm -f config-all-devices.mak config-all-disas.mak config.status
         rm -f po/*.mo tests/qemu-iotests/common.env
         rm -f roms/seabios/config.mak roms/vgabios/config.mak
@@ -508,13 +508,16 @@ qemu-options.texi: $(SRC_PATH)/qemu-options.hx
  qemu-monitor.texi: $(SRC_PATH)/hmp-commands.hx
         $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
 
+qemu-monitor-info.texi: $(SRC_PATH)/hmp-commands-info.hx
+       $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
+
  qmp-commands.txt: $(SRC_PATH)/qmp-commands.hx
         $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -q < $< > $@,"  GEN   $@")
 
  qemu-img-cmds.texi: $(SRC_PATH)/qemu-img-cmds.hx
         $(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -t < $< > $@,"  GEN   $@")
 
-qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi
+qemu.1: qemu-doc.texi qemu-options.texi qemu-monitor.texi qemu-monitor-info.texi
         $(call quiet-command, \
           perl -Ww -- $(SRC_PATH)/scripts/texi2pod.pl $< qemu.pod && \
           $(POD2MAN) --section=1 --center=" " --release=" " qemu.pod > $@, \
@@ -551,7 +554,7 @@ pdf: qemu-doc.pdf qemu-tech.pdf
 
  qemu-doc.dvi qemu-doc.html qemu-doc.info qemu-doc.pdf: \
         qemu-img.texi qemu-nbd.texi qemu-options.texi \
-       qemu-monitor.texi qemu-img-cmds.texi
+       qemu-monitor.texi qemu-monitor-info.texi qemu-img-cmds.texi
 
  ifdef CONFIG_WIN32
 
hmp-commands-info.hx +3 -0
index 9ccb33f..81ae9d7 100644
@@ -6,6 +6,9 @@ HXCOMM monitor info commands
  HXCOMM HXCOMM can be used for comments, discarded from both texi and C
 
  STEXI
+@item info @var{subcommand}
+@findex info
+Show various information about the system state.
  @table @option
  ETEXI
 
@@ -708,4 +711,5 @@ ETEXI
 
Quoted 8 lines

hmp-commands-info.hx ETEXI · line 715

Quoted 4 lines
hmp-commands-info.hx +1 -0
  STEXI
  @end table
+@end table
  ETEXI

Where does this extra "@end table" come from?

thanks
-- PMM

This "@end table" come from hmp-commands.hx and it's necessary to close tag "@subsection Commands" from qemu-doc.texi

#12 lore raw

Re: [Qemu-devel] [PATCH 3/3] monitor: added generation of documentation for hmp-commands-info.hx

Quoted 35 lines · Pavel Butsykin
Quoted 32 lines · Peter Maydell
Quoted 22 lines · Denis V. Lunev

From: Pavel Butsykin <[email protected]>

It will be easier if you need to add info-commands to edit only hmp-commands-info.hx, before this had to edit monitor.c and hmp-commands.hx

hmp-commands-info.hx +3 -0
index 9ccb33f..81ae9d7 100644
@@ -6,6 +6,9 @@ HXCOMM monitor info commands
  HXCOMM HXCOMM can be used for comments, discarded from both texi and C
 
  STEXI
+@item info @var{subcommand}
+@findex info
+Show various information about the system state.
  @table @option
  ETEXI
 

hmp-commands-info.hx ETEXI · line 715

Quoted 5 lines
hmp-commands-info.hx +1 -0
@@ -708,4 +711,5 @@ ETEXI
 
  STEXI
  @end table
+@end table
  ETEXI

Where does this extra "@end table" come from?

Quoted 5 lines
Quoted 2 lines

thanks
-- PMM

This "@end table" come from hmp-commands.hx and it's necessary to close tag "@subsection Commands" from qemu-doc.texi

If the tag is opened in qemu-doc.texi then I think qemu-doc.texi ought to be responsible for closing it.

This may be related to a bug in the docs (as they are in master) where we close the table too early and so the 'info trace-events' and rocker related info subcommands aren't indented properly. (Also the rocker subcommands don't say "info $subcommand" the way the others do.)

thanks
-- PMM

#13 lore raw

Re: [Qemu-devel] [PATCH 3/3] monitor: added generation of documentation for hmp-commands-info.hx

Quoted 38 lines · Peter Maydell
Quoted 30 lines · Pavel Butsykin
Quoted 28 lines · Peter Maydell
Quoted 20 lines · Denis V. Lunev

From: Pavel Butsykin <[email protected]>

It will be easier if you need to add info-commands to edit only hmp-commands-info.hx, before this had to edit monitor.c and hmp-commands.hx

hmp-commands-info.hx +3 -0
index 9ccb33f..81ae9d7 100644
@@ -6,6 +6,9 @@ HXCOMM monitor info commands
   HXCOMM HXCOMM can be used for comments, discarded from both texi and C
 
   STEXI
+@item info @var{subcommand}
+@findex info
+Show various information about the system state.
   @table @option
   ETEXI
 

hmp-commands-info.hx ETEXI · line 715

Quoted 5 lines
hmp-commands-info.hx +1 -0
@@ -708,4 +711,5 @@ ETEXI
 
   STEXI
   @end table
+@end table
   ETEXI

Where does this extra "@end table" come from?

Quoted 4 lines
Quoted 2 lines

thanks
-- PMM

This "@end table" come from hmp-commands.hx and it's necessary to close tag "@subsection Commands" from qemu-doc.texi

If the tag is opened in qemu-doc.texi then I think qemu-doc.texi ought to be responsible for closing it.

Quoted 8 lines

This may be related to a bug in the docs (as they are in master) where we close the table too early and so the 'info trace-events' and rocker related info subcommands aren't indented properly. (Also the rocker subcommands don't say "info $subcommand" the way the others do.)

thanks
-- PMM

You're right, the "@subsection Commands" is not required to close :) I'll fix it, thanks.

#14 lore raw
In reply to Denis V. Lunev
Quoted 26 lines · Denis V. Lunev

The monivation of this set is simple. Recently we have proposed patch to monitor.c with specific x86 APIC HMP commands. The patchset was denied with the main motivation "No more arch specific code in monitor.c" This patchset is the first step to move arch specific code from monitor.c targets.

So, monitor.c already contains a lot of generic code, as well as the target specifics code and eventually monitor.c volume will only grow. This trend leads to a variety of fouling code ifdeffery(and combinations thereof), poor readability, and entanglement of architecture of the project. If someone wants to improve processing logic commands at the monitor, it isn't necessarily must differentiate amongst the implementation of some ARM or x86_64 specific commands, because the project already has separation of target specific code on directories.

The presented solution is not the best, but it is quite simple (PATCH doesn't add more code!) and decides the above mentioned issue. Subsequently it will not prevent the introduction of more advanced mechanism that can more effectively resolve the issue.

There is a issue with the placement of code for multiple architectures (isn't for everyone), but this code is very small. This patch is a step towards solving the issue associated with maintaining the purity of the code and structure of the project, which solves not all, but doing a little better than it is.

Quoted 9 lines

Changes from v1:
- ported to new head

CC Luiz Capitulino <[email protected]>
CC Paolo Bonzini <[email protected]>
CC Peter Maydell <[email protected]>

ping as per verbal discussion

this stuff is intrusive and become rotten very soon. Can we at least discuss it at least to come into agreement about the approach.

Den

#15 lore raw
In reply to Denis V. Lunev
Quoted 26 lines · Denis V. Lunev

The monivation of this set is simple. Recently we have proposed patch to monitor.c with specific x86 APIC HMP commands. The patchset was denied with the main motivation "No more arch specific code in monitor.c" This patchset is the first step to move arch specific code from monitor.c targets.

So, monitor.c already contains a lot of generic code, as well as the target specifics code and eventually monitor.c volume will only grow. This trend leads to a variety of fouling code ifdeffery(and combinations thereof), poor readability, and entanglement of architecture of the project. If someone wants to improve processing logic commands at the monitor, it isn't necessarily must differentiate amongst the implementation of some ARM or x86_64 specific commands, because the project already has separation of target specific code on directories.

The presented solution is not the best, but it is quite simple (PATCH doesn't add more code!) and decides the above mentioned issue. Subsequently it will not prevent the introduction of more advanced mechanism that can more effectively resolve the issue.

There is a issue with the placement of code for multiple architectures (isn't for everyone), but this code is very small. This patch is a step towards solving the issue associated with maintaining the purity of the code and structure of the project, which solves not all, but doing a little better than it is.

Quoted 9 lines

Changes from v1:
- ported to new head

CC Luiz Capitulino <[email protected]>
CC Paolo Bonzini <[email protected]>
CC Peter Maydell <[email protected]>

ping v2

#16 lore raw
Quoted 30 lines · Denis V. Lunev
Quoted 29 lines · Denis V. Lunev

The monivation of this set is simple. Recently we have proposed patch to monitor.c with specific x86 APIC HMP commands. The patchset was denied with the main motivation "No more arch specific code in monitor.c" This patchset is the first step to move arch specific code from monitor.c targets.

So, monitor.c already contains a lot of generic code, as well as the target specifics code and eventually monitor.c volume will only grow. This trend leads to a variety of fouling code ifdeffery(and combinations thereof), poor readability, and entanglement of architecture of the project. If someone wants to improve processing logic commands at the monitor, it isn't necessarily must differentiate amongst the implementation of some ARM or x86_64 specific commands, because the project already has separation of target specific code on directories.

The presented solution is not the best, but it is quite simple (PATCH doesn't add more code!) and decides the above mentioned issue. Subsequently it will not prevent the introduction of more advanced mechanism that can more effectively resolve the issue.

There is a issue with the placement of code for multiple architectures (isn't for everyone), but this code is very small. This patch is a step towards solving the issue associated with maintaining the purity of the code and structure of the project, which solves not all, but doing a little better than it is.

Changes from v1:
- ported to new head

Quoted 7 lines
Quoted 6 lines
CC Luiz Capitulino <[email protected]>
CC Paolo Bonzini <[email protected]>
CC Peter Maydell <[email protected]>

ping v2

ping v3 as per verbal discussion on KVM forum
about timeouts :)

#17 lore raw
Quoted 10 lines · Denis V. Lunev
Quoted 9 lines · Denis V. Lunev
Quoted 7 lines · Denis V. Lunev

The monivation of this set is simple. Recently we have proposed patch to monitor.c with specific x86 APIC HMP commands. The patchset was denied with the main motivation "No more arch specific code in monitor.c" This patchset is the first step to move arch specific code from monitor.c targets.

Quoted 4 lines
Quoted 1 line

ping v2

ping v3 as per verbal discussion on KVM forum
about timeouts :)

Pinging three times in a week is excessive. This is on my to-review queue, but so is a lot of other stuff.

-- PMM

#18 lore raw
Quoted 9 lines · Peter Maydell
Quoted 8 lines · Denis V. Lunev
Quoted 7 lines · Denis V. Lunev
Quoted 6 lines · Denis V. Lunev

The monivation of this set is simple. Recently we have proposed patch to monitor.c with specific x86 APIC HMP commands. The patchset was denied with the main motivation "No more arch specific code in monitor.c" This patchset is the first step to move arch specific code from monitor.c targets.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

ping v2

ping v3 as per verbal discussion on KVM forum
about timeouts :)

Pinging three times in a week is excessive. This is on my to-review queue, but so is a lot of other stuff.

-- PMM

ok. sorry for that. I'll try not to abuse you in future.

Den

P.S. Is there any public representation of your queue :) ? This may
help to avoid such misunderstandings.

#19 lore raw
In reply to Denis V. Lunev
Quoted 26 lines · Denis V. Lunev

The monivation of this set is simple. Recently we have proposed patch to monitor.c with specific x86 APIC HMP commands. The patchset was denied with the main motivation "No more arch specific code in monitor.c" This patchset is the first step to move arch specific code from monitor.c targets.

So, monitor.c already contains a lot of generic code, as well as the target specifics code and eventually monitor.c volume will only grow. This trend leads to a variety of fouling code ifdeffery(and combinations thereof), poor readability, and entanglement of architecture of the project. If someone wants to improve processing logic commands at the monitor, it isn't necessarily must differentiate amongst the implementation of some ARM or x86_64 specific commands, because the project already has separation of target specific code on directories.

The presented solution is not the best, but it is quite simple (PATCH doesn't add more code!) and decides the above mentioned issue. Subsequently it will not prevent the introduction of more advanced mechanism that can more effectively resolve the issue.

There is a issue with the placement of code for multiple architectures (isn't for everyone), but this code is very small. This patch is a step towards solving the issue associated with maintaining the purity of the code and structure of the project, which solves not all, but doing a little better than it is.

Quoted 8 lines

Changes from v1:
- ported to new head

CC Luiz Capitulino <[email protected]>
CC Paolo Bonzini <[email protected]>
CC Peter Maydell <[email protected]>

Please always include diffstats in your cover letter, to make it easier for maintainers to see at a glance how much a series touches their subsystem. git-format-patch does it right:

Pavel Butsykin (3):
hmp-commands-info: move info_cmds content out of monitor.c
monitor: remove target-specific code from monitor.c
monitor: added generation of documentation for hmp-commands-info.hx

 .gitignore                       |    1 +
 Makefile                         |    9 +-
 Makefile.target                  |    5 +-
 hmp-commands-info.hx             |  715 ++++++++++++++++++++++
 hmp-commands.hx                  |  120 ----
 include/monitor/monitor-common.h |   43 ++
 monitor.c                        | 1227 +-------------------------------------
 qemu-doc.texi                    |    2 +
 target-i386/Makefile.objs        |    2 +-
 target-i386/monitor.c            |  489 +++++++++++++++
 target-ppc/Makefile.objs         |    2 +-
 target-ppc/monitor.c             |  250 ++++++++
 target-sh4/Makefile.objs         |    1 +
 target-sh4/monitor.c             |   52 ++
 target-sparc/Makefile.objs       |    2 +-
 target-sparc/monitor.c           |  153 +++++
 target-xtensa/Makefile.objs      |    1 +
 target-xtensa/monitor.c          |   34 ++
 18 files changed, 1762 insertions(+), 1346 deletions(-)
 create mode 100644 hmp-commands-info.hx
 create mode 100644 include/monitor/monitor-common.h
 create mode 100644 target-i386/monitor.c
 create mode 100644 target-ppc/monitor.c
 create mode 100644 target-sh4/monitor.c
 create mode 100644 target-sparc/monitor.c
 create mode 100644 target-xtensa/monitor.c