All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC PATCH 00/11] Stubs cleanup
@ 2016-12-22 15:59 Paolo Bonzini
  2016-12-22 15:59 ` [Qemu-devel] [PATCH 01/11] stubs: merge all monitor stubs in one file, remove monitor_cur_is_qmp stub Paolo Bonzini
                   ` (11 more replies)
  0 siblings, 12 replies; 18+ messages in thread
From: Paolo Bonzini @ 2016-12-22 15:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehabkost

This moves out of libqemustub.a those functions which can be handled
simply by $(call lnot), like we already do for pci-stub.c or kvm-stub.c.
libqemustub.a keep the more complex cases where a small part of the
executables we build needs an implementation of a small subset of an API.

Paolo

Paolo Bonzini (11):
  stubs: merge all monitor stubs in one file, remove monitor_cur_is_qmp stub
  stubs: move smbios stubs to hw/smbios
  stubs: move acpi stubs to hw/acpi
  stubs: remove unused stub for serial_hd
  hw: move reset handlers from vl.c to hw/core
  stubs: group stubs for user-mode emulation
  stubs: group all monitor_fdset_* functions in a single file
  stubs: move vhost stubs to stubs/vhost.o
  event_notifier: cleanups around event_notifier_set_handler
  build: remove --enable-colo/--disable-colo
  stubs: remove stubs/kvm.c

 MAINTAINERS                                        |  1 +
 Makefile.target                                    |  4 +-
 configure                                          | 11 ----
 hw/Makefile.objs                                   |  2 +-
 hw/acpi/Makefile.objs                              | 12 ++--
 stubs/ipmi.c => hw/acpi/ipmi-stub.c                |  0
 hw/core/Makefile.objs                              |  2 +-
 hw/core/reset.c                                    | 72 ++++++++++++++++++++++
 hw/smbios/Makefile.objs                            | 11 +++-
 .../smbios/smbios_type_38-stub.c                   |  0
 hw/usb/ccid-card-emulated.c                        |  2 +-
 hw/virtio/Makefile.objs                            |  6 +-
 stubs/vhost.c => hw/virtio/vhost-stub.c            |  0
 hw/virtio/virtio.c                                 | 10 +--
 include/hw/hw.h                                    |  6 +-
 include/qemu/event_notifier.h                      |  3 -
 include/qemu/main-loop.h                           | 15 +++++
 include/sysemu/reset.h                             | 10 +++
 include/sysemu/sysemu.h                            |  1 -
 iohandler.c                                        |  7 +++
 migration/Makefile.objs                            |  3 +-
 stubs/Makefile.objs                                | 19 +-----
 stubs/cpus.c                                       | 11 ----
 stubs/fdset-add-fd.c                               |  8 ---
 stubs/fdset-find-fd.c                              |  8 ---
 stubs/fdset-get-fd.c                               |  8 ---
 stubs/fdset-remove-fd.c                            |  7 ---
 stubs/fdset.c                                      | 22 +++++++
 stubs/get-next-serial.c                            |  4 --
 stubs/iohandler.c                                  |  8 ---
 stubs/kvm.c                                        |  8 ---
 stubs/migration-colo.c                             | 46 --------------
 stubs/mon-is-qmp.c                                 | 10 ---
 stubs/monitor-init.c                               |  7 ---
 stubs/{get-fd.c => monitor.c}                      |  6 ++
 stubs/replay-user.c                                | 33 ----------
 stubs/reset.c                                      | 14 -----
 target/i386/hyperv.c                               |  7 ++-
 target/mips/kvm.c                                  |  5 ++
 target/ppc/kvm.c                                   |  5 ++
 target/s390x/kvm.c                                 |  5 ++
 tests/Makefile.include                             |  1 +
 user-exec-stub.c                                   | 34 ++++++++++
 util/event_notifier-posix.c                        |  9 ---
 util/event_notifier-win32.c                        | 12 ----
 vl.c                                               | 42 -------------
 46 files changed, 222 insertions(+), 295 deletions(-)
 rename stubs/ipmi.c => hw/acpi/ipmi-stub.c (100%)
 create mode 100644 hw/core/reset.c
 rename stubs/smbios_type_38.c => hw/smbios/smbios_type_38-stub.c (100%)
 rename stubs/vhost.c => hw/virtio/vhost-stub.c (100%)
 create mode 100644 include/sysemu/reset.h
 delete mode 100644 stubs/cpus.c
 delete mode 100644 stubs/fdset-add-fd.c
 delete mode 100644 stubs/fdset-find-fd.c
 delete mode 100644 stubs/fdset-get-fd.c
 delete mode 100644 stubs/fdset-remove-fd.c
 create mode 100644 stubs/fdset.c
 delete mode 100644 stubs/get-next-serial.c
 delete mode 100644 stubs/iohandler.c
 delete mode 100644 stubs/kvm.c
 delete mode 100644 stubs/migration-colo.c
 delete mode 100644 stubs/mon-is-qmp.c
 delete mode 100644 stubs/monitor-init.c
 rename stubs/{get-fd.c => monitor.c} (75%)
 delete mode 100644 stubs/replay-user.c
 delete mode 100644 stubs/reset.c
 create mode 100644 user-exec-stub.c

-- 
2.9.3

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

* [Qemu-devel] [PATCH 01/11] stubs: merge all monitor stubs in one file, remove monitor_cur_is_qmp stub
  2016-12-22 15:59 [Qemu-devel] [RFC PATCH 00/11] Stubs cleanup Paolo Bonzini
@ 2016-12-22 15:59 ` Paolo Bonzini
  2016-12-22 15:59 ` [Qemu-devel] [PATCH 02/11] stubs: move smbios stubs to hw/smbios Paolo Bonzini
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Paolo Bonzini @ 2016-12-22 15:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehabkost

monitor_cur_is_qmp was previously used by other stubs, but it's not
since 397d30e ("qemu-error: remove dependency of stubs on monitor",
2016-11-01).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 stubs/Makefile.objs           |  4 +---
 stubs/mon-is-qmp.c            | 10 ----------
 stubs/monitor-init.c          |  7 -------
 stubs/{get-fd.c => monitor.c} |  6 ++++++
 4 files changed, 7 insertions(+), 20 deletions(-)
 delete mode 100644 stubs/mon-is-qmp.c
 delete mode 100644 stubs/monitor-init.c
 rename stubs/{get-fd.c => monitor.c} (75%)

diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index 2b5bb74..9fc373e 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -15,7 +15,6 @@ stub-obj-y += fdset-find-fd.o
 stub-obj-y += fdset-get-fd.o
 stub-obj-y += fdset-remove-fd.o
 stub-obj-y += gdbstub.o
-stub-obj-y += get-fd.o
 stub-obj-y += get-next-serial.o
 stub-obj-y += get-vm-name.o
 stub-obj-y += iothread.o
@@ -23,8 +22,7 @@ stub-obj-y += iothread-lock.o
 stub-obj-y += is-daemonized.o
 stub-obj-y += machine-init-done.o
 stub-obj-y += migr-blocker.o
-stub-obj-y += mon-is-qmp.o
-stub-obj-y += monitor-init.o
+stub-obj-y += monitor.o
 stub-obj-y += notify-event.o
 stub-obj-y += qtest.o
 stub-obj-y += replay.o
diff --git a/stubs/mon-is-qmp.c b/stubs/mon-is-qmp.c
deleted file mode 100644
index a8344ce..0000000
--- a/stubs/mon-is-qmp.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#include "qemu/osdep.h"
-#include "qemu-common.h"
-#include "monitor/monitor.h"
-
-Monitor *cur_mon;
-
-bool monitor_cur_is_qmp(void)
-{
-    return false;
-}
diff --git a/stubs/monitor-init.c b/stubs/monitor-init.c
deleted file mode 100644
index de1bc7c..0000000
--- a/stubs/monitor-init.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "qemu/osdep.h"
-#include "qemu-common.h"
-#include "monitor/monitor.h"
-
-void monitor_init(CharDriverState *chr, int flags)
-{
-}
diff --git a/stubs/get-fd.c b/stubs/monitor.c
similarity index 75%
rename from stubs/get-fd.c
rename to stubs/monitor.c
index 7dfdfb5..1d574b1 100644
--- a/stubs/get-fd.c
+++ b/stubs/monitor.c
@@ -3,8 +3,14 @@
 #include "qemu-common.h"
 #include "monitor/monitor.h"
 
+Monitor *cur_mon = NULL;
+
 int monitor_get_fd(Monitor *mon, const char *name, Error **errp)
 {
     error_setg(errp, "only QEMU supports file descriptor passing");
     return -1;
 }
+
+void monitor_init(CharDriverState *chr, int flags)
+{
+}
-- 
2.9.3

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

* [Qemu-devel] [PATCH 02/11] stubs: move smbios stubs to hw/smbios
  2016-12-22 15:59 [Qemu-devel] [RFC PATCH 00/11] Stubs cleanup Paolo Bonzini
  2016-12-22 15:59 ` [Qemu-devel] [PATCH 01/11] stubs: merge all monitor stubs in one file, remove monitor_cur_is_qmp stub Paolo Bonzini
@ 2016-12-22 15:59 ` Paolo Bonzini
  2016-12-22 15:59 ` [Qemu-devel] [PATCH 03/11] stubs: move acpi stubs to hw/acpi Paolo Bonzini
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Paolo Bonzini @ 2016-12-22 15:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehabkost

No need to include them in libqemustub.a, since only system emulators
need them.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/smbios/Makefile.objs                                   | 11 ++++++++---
 stubs/smbios_type_38.c => hw/smbios/smbios_type_38-stub.c |  0
 stubs/Makefile.objs                                       |  1 -
 3 files changed, 8 insertions(+), 4 deletions(-)
 rename stubs/smbios_type_38.c => hw/smbios/smbios_type_38-stub.c (100%)

diff --git a/hw/smbios/Makefile.objs b/hw/smbios/Makefile.objs
index ee0712b..23bb2ba 100644
--- a/hw/smbios/Makefile.objs
+++ b/hw/smbios/Makefile.objs
@@ -1,5 +1,10 @@
-common-obj-$(CONFIG_SMBIOS) += smbios.o
-common-obj-$(call land,$(CONFIG_SMBIOS),$(CONFIG_IPMI)) += smbios_type_38.o
+ifeq ($(CONFIG_SMBIOS),y)
+common-obj-y += smbios.o
+common-obj-$(CONFIG_IPMI) += smbios_type_38.o
+common-obj-$(call lnot,$(CONFIG_IPMI)) += smbios_type_38-stub.o
+else
+common-obj-y += smbios-stub.o
+endif
 
-common-obj-$(call lnot,$(CONFIG_SMBIOS)) += smbios-stub.o
 common-obj-$(CONFIG_ALL) += smbios-stub.o
+common-obj-$(CONFIG_ALL) += smbios_type_38-stub.o
diff --git a/stubs/smbios_type_38.c b/hw/smbios/smbios_type_38-stub.c
similarity index 100%
rename from stubs/smbios_type_38.c
rename to hw/smbios/smbios_type_38-stub.c
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index 9fc373e..13c5d45 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -44,7 +44,6 @@ stub-obj-y += target-monitor-defs.o
 stub-obj-y += target-get-monitor-def.o
 stub-obj-y += vhost.o
 stub-obj-y += iohandler.o
-stub-obj-y += smbios_type_38.o
 stub-obj-y += ipmi.o
 stub-obj-y += pc_madt_cpu_entry.o
 stub-obj-y += migration-colo.o
-- 
2.9.3

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

* [Qemu-devel] [PATCH 03/11] stubs: move acpi stubs to hw/acpi
  2016-12-22 15:59 [Qemu-devel] [RFC PATCH 00/11] Stubs cleanup Paolo Bonzini
  2016-12-22 15:59 ` [Qemu-devel] [PATCH 01/11] stubs: merge all monitor stubs in one file, remove monitor_cur_is_qmp stub Paolo Bonzini
  2016-12-22 15:59 ` [Qemu-devel] [PATCH 02/11] stubs: move smbios stubs to hw/smbios Paolo Bonzini
@ 2016-12-22 15:59 ` Paolo Bonzini
  2016-12-22 15:59 ` [Qemu-devel] [PATCH 04/11] stubs: remove unused stub for serial_hd Paolo Bonzini
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Paolo Bonzini @ 2016-12-22 15:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehabkost

No need to include them in libqemustub.a, since only system emulators
need them.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/acpi/Makefile.objs               | 12 ++++++++----
 stubs/ipmi.c => hw/acpi/ipmi-stub.c |  0
 stubs/Makefile.objs                 |  1 -
 3 files changed, 8 insertions(+), 5 deletions(-)
 rename stubs/ipmi.c => hw/acpi/ipmi-stub.c (100%)

diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs
index 489e63b..9a42e61 100644
--- a/hw/acpi/Makefile.objs
+++ b/hw/acpi/Makefile.objs
@@ -4,7 +4,11 @@ common-obj-$(CONFIG_ACPI_CPU_HOTPLUG) += cpu_hotplug.o
 common-obj-$(CONFIG_ACPI_MEMORY_HOTPLUG) += memory_hotplug.o memory_hotplug_acpi_table.o
 common-obj-$(CONFIG_ACPI_CPU_HOTPLUG) += cpu.o
 common-obj-$(CONFIG_ACPI_NVDIMM) += nvdimm.o
-common-obj-$(CONFIG_ACPI) += acpi_interface.o
-common-obj-$(CONFIG_ACPI) += bios-linker-loader.o
-common-obj-$(CONFIG_ACPI) += aml-build.o
-common-obj-$(call land,$(CONFIG_ACPI),$(CONFIG_IPMI)) += ipmi.o
+
+common-obj-y += acpi_interface.o
+common-obj-y += bios-linker-loader.o
+common-obj-y += aml-build.o
+
+common-obj-$(CONFIG_IPMI) += ipmi.o
+common-obj-$(call lnot,$(CONFIG_IPMI)) += ipmi-stub.o
+common-obj-$(CONFIG_ALL) += ipmi-stub.o
diff --git a/stubs/ipmi.c b/hw/acpi/ipmi-stub.c
similarity index 100%
rename from stubs/ipmi.c
rename to hw/acpi/ipmi-stub.c
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index 13c5d45..c4df915 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -44,6 +44,5 @@ stub-obj-y += target-monitor-defs.o
 stub-obj-y += target-get-monitor-def.o
 stub-obj-y += vhost.o
 stub-obj-y += iohandler.o
-stub-obj-y += ipmi.o
 stub-obj-y += pc_madt_cpu_entry.o
 stub-obj-y += migration-colo.o
-- 
2.9.3

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

* [Qemu-devel] [PATCH 04/11] stubs: remove unused stub for serial_hd
  2016-12-22 15:59 [Qemu-devel] [RFC PATCH 00/11] Stubs cleanup Paolo Bonzini
                   ` (2 preceding siblings ...)
  2016-12-22 15:59 ` [Qemu-devel] [PATCH 03/11] stubs: move acpi stubs to hw/acpi Paolo Bonzini
@ 2016-12-22 15:59 ` Paolo Bonzini
  2016-12-22 15:59 ` [Qemu-devel] [PATCH 05/11] hw: move reset handlers from vl.c to hw/core Paolo Bonzini
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Paolo Bonzini @ 2016-12-22 15:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehabkost

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 stubs/Makefile.objs     | 1 -
 stubs/get-next-serial.c | 4 ----
 2 files changed, 5 deletions(-)
 delete mode 100644 stubs/get-next-serial.c

diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index c4df915..5b3e7c6 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -15,7 +15,6 @@ stub-obj-y += fdset-find-fd.o
 stub-obj-y += fdset-get-fd.o
 stub-obj-y += fdset-remove-fd.o
 stub-obj-y += gdbstub.o
-stub-obj-y += get-next-serial.o
 stub-obj-y += get-vm-name.o
 stub-obj-y += iothread.o
 stub-obj-y += iothread-lock.o
diff --git a/stubs/get-next-serial.c b/stubs/get-next-serial.c
deleted file mode 100644
index 6ff6a6d..0000000
--- a/stubs/get-next-serial.c
+++ /dev/null
@@ -1,4 +0,0 @@
-#include "qemu/osdep.h"
-#include "qemu-common.h"
-
-CharDriverState *serial_hds[0];
-- 
2.9.3

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

* [Qemu-devel] [PATCH 05/11] hw: move reset handlers from vl.c to hw/core
  2016-12-22 15:59 [Qemu-devel] [RFC PATCH 00/11] Stubs cleanup Paolo Bonzini
                   ` (3 preceding siblings ...)
  2016-12-22 15:59 ` [Qemu-devel] [PATCH 04/11] stubs: remove unused stub for serial_hd Paolo Bonzini
@ 2016-12-22 15:59 ` Paolo Bonzini
  2016-12-22 15:59 ` [Qemu-devel] [PATCH 06/11] stubs: group stubs for user-mode emulation Paolo Bonzini
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Paolo Bonzini @ 2016-12-22 15:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehabkost

They are small, it is not worth stubbing them.  Just include them
in user-mode emulators and unit tests as well.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/core/Makefile.objs   |  2 +-
 hw/core/reset.c         | 72 +++++++++++++++++++++++++++++++++++++++++++++++++
 include/hw/hw.h         |  6 +----
 include/sysemu/reset.h  | 10 +++++++
 include/sysemu/sysemu.h |  1 -
 stubs/Makefile.objs     |  1 -
 stubs/reset.c           | 14 ----------
 tests/Makefile.include  |  1 +
 vl.c                    | 42 -----------------------------
 9 files changed, 85 insertions(+), 64 deletions(-)
 create mode 100644 hw/core/reset.c
 create mode 100644 include/sysemu/reset.h
 delete mode 100644 stubs/reset.c

diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs
index a4c94e5..833fd46 100644
--- a/hw/core/Makefile.objs
+++ b/hw/core/Makefile.objs
@@ -1,6 +1,6 @@
 # core qdev-related obj files, also used by *-user:
 common-obj-y += qdev.o qdev-properties.o
-common-obj-y += bus.o
+common-obj-y += bus.o reset.o
 common-obj-y += fw-path-provider.o
 # irq.o needed for qdev GPIO handling:
 common-obj-y += irq.o
diff --git a/hw/core/reset.c b/hw/core/reset.c
new file mode 100644
index 0000000..84c8869
--- /dev/null
+++ b/hw/core/reset.c
@@ -0,0 +1,72 @@
+/*
+ *  Reset handlers.
+ *
+ * Copyright (c) 2003-2008 Fabrice Bellard
+ * Copyright (c) 2016 Red Hat, Inc.
+ *
+ * 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 "qemu/osdep.h"
+#include "qemu/queue.h"
+#include "sysemu/reset.h"
+
+/* reset/shutdown handler */
+
+typedef struct QEMUResetEntry {
+    QTAILQ_ENTRY(QEMUResetEntry) entry;
+    QEMUResetHandler *func;
+    void *opaque;
+} QEMUResetEntry;
+
+static QTAILQ_HEAD(reset_handlers, QEMUResetEntry) reset_handlers =
+    QTAILQ_HEAD_INITIALIZER(reset_handlers);
+
+void qemu_register_reset(QEMUResetHandler *func, void *opaque)
+{
+    QEMUResetEntry *re = g_malloc0(sizeof(QEMUResetEntry));
+
+    re->func = func;
+    re->opaque = opaque;
+    QTAILQ_INSERT_TAIL(&reset_handlers, re, entry);
+}
+
+void qemu_unregister_reset(QEMUResetHandler *func, void *opaque)
+{
+    QEMUResetEntry *re;
+
+    QTAILQ_FOREACH(re, &reset_handlers, entry) {
+        if (re->func == func && re->opaque == opaque) {
+            QTAILQ_REMOVE(&reset_handlers, re, entry);
+            g_free(re);
+            return;
+        }
+    }
+}
+
+void qemu_devices_reset(void)
+{
+    QEMUResetEntry *re, *nre;
+
+    /* reset all devices */
+    QTAILQ_FOREACH_SAFE(re, &reset_handlers, entry, nre) {
+        re->func(re->opaque);
+    }
+}
+
diff --git a/include/hw/hw.h b/include/hw/hw.h
index 3669ebd..e22d4ce 100644
--- a/include/hw/hw.h
+++ b/include/hw/hw.h
@@ -12,11 +12,7 @@
 #include "hw/irq.h"
 #include "migration/vmstate.h"
 #include "qemu/module.h"
-
-typedef void QEMUResetHandler(void *opaque);
-
-void qemu_register_reset(QEMUResetHandler *func, void *opaque);
-void qemu_unregister_reset(QEMUResetHandler *func, void *opaque);
+#include "sysemu/reset.h"
 
 void QEMU_NORETURN hw_error(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
 
diff --git a/include/sysemu/reset.h b/include/sysemu/reset.h
new file mode 100644
index 0000000..0b0d6d7
--- /dev/null
+++ b/include/sysemu/reset.h
@@ -0,0 +1,10 @@
+#ifndef QEMU_SYSEMU_RESET_H
+#define QEMU_SYSEMU_RESET_H
+
+typedef void QEMUResetHandler(void *opaque);
+
+void qemu_register_reset(QEMUResetHandler *func, void *opaque);
+void qemu_unregister_reset(QEMUResetHandler *func, void *opaque);
+void qemu_devices_reset(void);
+
+#endif
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 66c6f15..a194411 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -63,7 +63,6 @@ void qemu_system_vmstop_request_prepare(void);
 int qemu_shutdown_requested_get(void);
 int qemu_reset_requested_get(void);
 void qemu_system_killed(int signal, pid_t pid);
-void qemu_devices_reset(void);
 void qemu_system_reset(bool report);
 void qemu_system_guest_panicked(void);
 size_t qemu_target_page_bits(void);
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index 5b3e7c6..c89a9da 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -26,7 +26,6 @@ stub-obj-y += notify-event.o
 stub-obj-y += qtest.o
 stub-obj-y += replay.o
 stub-obj-y += replay-user.o
-stub-obj-y += reset.o
 stub-obj-y += runstate-check.o
 stub-obj-y += set-fd-handler.o
 stub-obj-y += slirp.o
diff --git a/stubs/reset.c b/stubs/reset.c
deleted file mode 100644
index 5d47711..0000000
--- a/stubs/reset.c
+++ /dev/null
@@ -1,14 +0,0 @@
-#include "qemu/osdep.h"
-#include "hw/hw.h"
-
-/* Stub functions for binaries that never call qemu_devices_reset(),
- * and don't need to keep track of the reset handler list.
- */
-
-void qemu_register_reset(QEMUResetHandler *func, void *opaque)
-{
-}
-
-void qemu_unregister_reset(QEMUResetHandler *func, void *opaque)
-{
-}
diff --git a/tests/Makefile.include b/tests/Makefile.include
index e98d3b6..c0c4846 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -515,6 +515,7 @@ tests/test-qdev-global-props$(EXESUF): tests/test-qdev-global-props.o \
 	hw/core/bus.o \
 	hw/core/irq.o \
 	hw/core/fw-path-provider.o \
+	hw/core/reset.o \
 	$(test-qapi-obj-y)
 tests/test-vmstate$(EXESUF): tests/test-vmstate.o \
 	migration/vmstate.o migration/qemu-file.o \
diff --git a/vl.c b/vl.c
index bdeade0..5185073 100644
--- a/vl.c
+++ b/vl.c
@@ -1635,16 +1635,6 @@ void vm_state_notify(int running, RunState state)
     }
 }
 
-/* reset/shutdown handler */
-
-typedef struct QEMUResetEntry {
-    QTAILQ_ENTRY(QEMUResetEntry) entry;
-    QEMUResetHandler *func;
-    void *opaque;
-} QEMUResetEntry;
-
-static QTAILQ_HEAD(reset_handlers, QEMUResetEntry) reset_handlers =
-    QTAILQ_HEAD_INITIALIZER(reset_handlers);
 static int reset_requested;
 static int shutdown_requested, shutdown_signal = -1;
 static pid_t shutdown_pid;
@@ -1734,38 +1724,6 @@ static int qemu_debug_requested(void)
     return r;
 }
 
-void qemu_register_reset(QEMUResetHandler *func, void *opaque)
-{
-    QEMUResetEntry *re = g_malloc0(sizeof(QEMUResetEntry));
-
-    re->func = func;
-    re->opaque = opaque;
-    QTAILQ_INSERT_TAIL(&reset_handlers, re, entry);
-}
-
-void qemu_unregister_reset(QEMUResetHandler *func, void *opaque)
-{
-    QEMUResetEntry *re;
-
-    QTAILQ_FOREACH(re, &reset_handlers, entry) {
-        if (re->func == func && re->opaque == opaque) {
-            QTAILQ_REMOVE(&reset_handlers, re, entry);
-            g_free(re);
-            return;
-        }
-    }
-}
-
-void qemu_devices_reset(void)
-{
-    QEMUResetEntry *re, *nre;
-
-    /* reset all devices */
-    QTAILQ_FOREACH_SAFE(re, &reset_handlers, entry, nre) {
-        re->func(re->opaque);
-    }
-}
-
 void qemu_system_reset(bool report)
 {
     MachineClass *mc;
-- 
2.9.3

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

* [Qemu-devel] [PATCH 06/11] stubs: group stubs for user-mode emulation
  2016-12-22 15:59 [Qemu-devel] [RFC PATCH 00/11] Stubs cleanup Paolo Bonzini
                   ` (4 preceding siblings ...)
  2016-12-22 15:59 ` [Qemu-devel] [PATCH 05/11] hw: move reset handlers from vl.c to hw/core Paolo Bonzini
@ 2016-12-22 15:59 ` Paolo Bonzini
  2016-12-22 15:59 ` [Qemu-devel] [PATCH 07/11] stubs: group all monitor_fdset_* functions in a single file Paolo Bonzini
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Paolo Bonzini @ 2016-12-22 15:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehabkost

Some stubs are used for user-mode emulation only; they are not
needed by tools.  Move them out of stubs/.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 MAINTAINERS         |  1 +
 Makefile.target     |  4 ++--
 stubs/Makefile.objs |  2 --
 stubs/cpus.c        | 11 -----------
 stubs/replay-user.c | 33 ---------------------------------
 user-exec-stub.c    | 34 ++++++++++++++++++++++++++++++++++
 6 files changed, 37 insertions(+), 48 deletions(-)
 delete mode 100644 stubs/cpus.c
 delete mode 100644 stubs/replay-user.c
 create mode 100644 user-exec-stub.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 585cd5a..ac04e79 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1496,6 +1496,7 @@ M: Riku Voipio <riku.voipio@iki.fi>
 S: Maintained
 F: thunk.c
 F: user-exec.c
+F: user-exec-stub.c
 
 BSD user
 S: Orphan
diff --git a/Makefile.target b/Makefile.target
index 8ae82cb..9e8edd9 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -115,7 +115,7 @@ QEMU_CFLAGS+=-I$(SRC_PATH)/linux-user/$(TARGET_ABI_DIR) \
              -I$(SRC_PATH)/linux-user
 
 obj-y += linux-user/
-obj-y += gdbstub.o thunk.o user-exec.o
+obj-y += gdbstub.o thunk.o user-exec.o user-exec-stub.o
 
 endif #CONFIG_LINUX_USER
 
@@ -128,7 +128,7 @@ QEMU_CFLAGS+=-I$(SRC_PATH)/bsd-user -I$(SRC_PATH)/bsd-user/$(TARGET_ABI_DIR) \
 			 -I$(SRC_PATH)/bsd-user/$(HOST_VARIANT_DIR)
 
 obj-y += bsd-user/
-obj-y += gdbstub.o user-exec.o
+obj-y += gdbstub.o user-exec.o user-exec-stub.o
 
 endif #CONFIG_BSD_USER
 
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index c89a9da..1eec1fb 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -25,7 +25,6 @@ stub-obj-y += monitor.o
 stub-obj-y += notify-event.o
 stub-obj-y += qtest.o
 stub-obj-y += replay.o
-stub-obj-y += replay-user.o
 stub-obj-y += runstate-check.o
 stub-obj-y += set-fd-handler.o
 stub-obj-y += slirp.o
@@ -35,7 +34,6 @@ stub-obj-y += uuid.o
 stub-obj-y += vm-stop.o
 stub-obj-y += vmstate.o
 stub-obj-$(CONFIG_WIN32) += fd-register.o
-stub-obj-y += cpus.o
 stub-obj-y += kvm.o
 stub-obj-y += qmp_pc_dimm_device_list.o
 stub-obj-y += target-monitor-defs.o
diff --git a/stubs/cpus.c b/stubs/cpus.c
deleted file mode 100644
index e192722..0000000
--- a/stubs/cpus.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#include "qemu/osdep.h"
-#include "qemu-common.h"
-#include "qom/cpu.h"
-
-void cpu_resume(CPUState *cpu)
-{
-}
-
-void qemu_init_vcpu(CPUState *cpu)
-{
-}
diff --git a/stubs/replay-user.c b/stubs/replay-user.c
deleted file mode 100644
index b29e7eb..0000000
--- a/stubs/replay-user.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * replay.c
- *
- * Copyright (c) 2010-2015 Institute for System Programming
- *                         of the Russian Academy of Sciences.
- *
- * This work is licensed under the terms of the GNU GPL, version 2 or later.
- * See the COPYING file in the top-level directory.
- *
- */
-
-#include "qemu/osdep.h"
-#include "sysemu/replay.h"
-
-bool replay_exception(void)
-{
-    return true;
-}
-
-bool replay_has_exception(void)
-{
-    return false;
-}
-
-bool replay_interrupt(void)
-{
-    return true;
-}
-
-bool replay_has_interrupt(void)
-{
-    return false;
-}
diff --git a/user-exec-stub.c b/user-exec-stub.c
new file mode 100644
index 0000000..dbcf1ad
--- /dev/null
+++ b/user-exec-stub.c
@@ -0,0 +1,34 @@
+#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "qom/cpu.h"
+#include "sysemu/replay.h"
+
+void cpu_resume(CPUState *cpu)
+{
+}
+
+void qemu_init_vcpu(CPUState *cpu)
+{
+}
+
+/* User mode emulation does not support record/replay yet.  */
+
+bool replay_exception(void)
+{
+    return true;
+}
+
+bool replay_has_exception(void)
+{
+    return false;
+}
+
+bool replay_interrupt(void)
+{
+    return true;
+}
+
+bool replay_has_interrupt(void)
+{
+    return false;
+}
-- 
2.9.3

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

* [Qemu-devel] [PATCH 07/11] stubs: group all monitor_fdset_* functions in a single file
  2016-12-22 15:59 [Qemu-devel] [RFC PATCH 00/11] Stubs cleanup Paolo Bonzini
                   ` (5 preceding siblings ...)
  2016-12-22 15:59 ` [Qemu-devel] [PATCH 06/11] stubs: group stubs for user-mode emulation Paolo Bonzini
@ 2016-12-22 15:59 ` Paolo Bonzini
  2016-12-22 15:59 ` [Qemu-devel] [PATCH 08/11] stubs: move vhost stubs to stubs/vhost.o Paolo Bonzini
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Paolo Bonzini @ 2016-12-22 15:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehabkost

It makes little sense to implement only one of them, so avoid
proliferation of stubs files.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 stubs/Makefile.objs     |  5 +----
 stubs/fdset-add-fd.c    |  8 --------
 stubs/fdset-find-fd.c   |  8 --------
 stubs/fdset-get-fd.c    |  8 --------
 stubs/fdset-remove-fd.c |  7 -------
 stubs/fdset.c           | 22 ++++++++++++++++++++++
 6 files changed, 23 insertions(+), 35 deletions(-)
 delete mode 100644 stubs/fdset-add-fd.c
 delete mode 100644 stubs/fdset-find-fd.c
 delete mode 100644 stubs/fdset-get-fd.c
 delete mode 100644 stubs/fdset-remove-fd.c
 create mode 100644 stubs/fdset.c

diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index 1eec1fb..40b4e15 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -10,10 +10,7 @@ stub-obj-y += cpu-get-clock.o
 stub-obj-y += cpu-get-icount.o
 stub-obj-y += dump.o
 stub-obj-y += error-printf.o
-stub-obj-y += fdset-add-fd.o
-stub-obj-y += fdset-find-fd.o
-stub-obj-y += fdset-get-fd.o
-stub-obj-y += fdset-remove-fd.o
+stub-obj-y += fdset.o
 stub-obj-y += gdbstub.o
 stub-obj-y += get-vm-name.o
 stub-obj-y += iothread.o
diff --git a/stubs/fdset-add-fd.c b/stubs/fdset-add-fd.c
deleted file mode 100644
index bf9e60a..0000000
--- a/stubs/fdset-add-fd.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "qemu/osdep.h"
-#include "qemu-common.h"
-#include "monitor/monitor.h"
-
-int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd)
-{
-    return -1;
-}
diff --git a/stubs/fdset-find-fd.c b/stubs/fdset-find-fd.c
deleted file mode 100644
index 1d9caf3..0000000
--- a/stubs/fdset-find-fd.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "qemu/osdep.h"
-#include "qemu-common.h"
-#include "monitor/monitor.h"
-
-int monitor_fdset_dup_fd_find(int dup_fd)
-{
-    return -1;
-}
diff --git a/stubs/fdset-get-fd.c b/stubs/fdset-get-fd.c
deleted file mode 100644
index 5325044..0000000
--- a/stubs/fdset-get-fd.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "qemu/osdep.h"
-#include "qemu-common.h"
-#include "monitor/monitor.h"
-
-int monitor_fdset_get_fd(int64_t fdset_id, int flags)
-{
-    return -1;
-}
diff --git a/stubs/fdset-remove-fd.c b/stubs/fdset-remove-fd.c
deleted file mode 100644
index 47ea297..0000000
--- a/stubs/fdset-remove-fd.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "qemu/osdep.h"
-#include "qemu-common.h"
-#include "monitor/monitor.h"
-
-void monitor_fdset_dup_fd_remove(int dupfd)
-{
-}
diff --git a/stubs/fdset.c b/stubs/fdset.c
new file mode 100644
index 0000000..6020cf2
--- /dev/null
+++ b/stubs/fdset.c
@@ -0,0 +1,22 @@
+#include "qemu/osdep.h"
+#include "qemu-common.h"
+#include "monitor/monitor.h"
+
+int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd)
+{
+    return -1;
+}
+
+int monitor_fdset_dup_fd_find(int dup_fd)
+{
+    return -1;
+}
+
+int monitor_fdset_get_fd(int64_t fdset_id, int flags)
+{
+    return -1;
+}
+
+void monitor_fdset_dup_fd_remove(int dupfd)
+{
+}
-- 
2.9.3

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

* [Qemu-devel] [PATCH 08/11] stubs: move vhost stubs to stubs/vhost.o
  2016-12-22 15:59 [Qemu-devel] [RFC PATCH 00/11] Stubs cleanup Paolo Bonzini
                   ` (6 preceding siblings ...)
  2016-12-22 15:59 ` [Qemu-devel] [PATCH 07/11] stubs: group all monitor_fdset_* functions in a single file Paolo Bonzini
@ 2016-12-22 15:59 ` Paolo Bonzini
  2016-12-22 15:59 ` [Qemu-devel] [PATCH 09/11] event_notifier: cleanups around event_notifier_set_handler Paolo Bonzini
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Paolo Bonzini @ 2016-12-22 15:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehabkost

No need to include them in libqemustub.a, since only system emulators
need them.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/Makefile.objs                        | 2 +-
 hw/virtio/Makefile.objs                 | 6 +++++-
 stubs/vhost.c => hw/virtio/vhost-stub.c | 0
 stubs/Makefile.objs                     | 1 -
 4 files changed, 6 insertions(+), 3 deletions(-)
 rename stubs/vhost.c => hw/virtio/vhost-stub.c (100%)

diff --git a/hw/Makefile.objs b/hw/Makefile.objs
index 2a73ae5..7be399e 100644
--- a/hw/Makefile.objs
+++ b/hw/Makefile.objs
@@ -29,7 +29,7 @@ devices-dirs-$(CONFIG_SOFTMMU) += timer/
 devices-dirs-$(CONFIG_TPM) += tpm/
 devices-dirs-$(CONFIG_SOFTMMU) += usb/
 devices-dirs-$(CONFIG_SOFTMMU) += vfio/
-devices-dirs-$(CONFIG_VIRTIO) += virtio/
+devices-dirs-$(CONFIG_SOFTMMU) += virtio/
 devices-dirs-$(CONFIG_SOFTMMU) += watchdog/
 devices-dirs-$(CONFIG_SOFTMMU) += xen/
 devices-dirs-$(CONFIG_MEM_HOTPLUG) += mem/
diff --git a/hw/virtio/Makefile.objs b/hw/virtio/Makefile.objs
index 95c4c30..765d363 100644
--- a/hw/virtio/Makefile.objs
+++ b/hw/virtio/Makefile.objs
@@ -1,3 +1,4 @@
+ifeq ($(CONFIG_VIRTIO),y)
 common-obj-y += virtio-rng.o
 common-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o
 common-obj-y += virtio-bus.o
@@ -5,7 +6,10 @@ common-obj-y += virtio-mmio.o
 
 obj-y += virtio.o virtio-balloon.o 
 obj-$(CONFIG_LINUX) += vhost.o vhost-backend.o vhost-user.o
-
 obj-$(CONFIG_VHOST_VSOCK) += vhost-vsock.o
 obj-y += virtio-crypto.o
 obj-$(CONFIG_VIRTIO_PCI) += virtio-crypto-pci.o
+endif
+
+common-obj-$(call lnot,$(CONFIG_LINUX)) += vhost-stub.o
+common-obj-$(CONFIG_ALL) += vhost-stub.o
diff --git a/stubs/vhost.c b/hw/virtio/vhost-stub.c
similarity index 100%
rename from stubs/vhost.c
rename to hw/virtio/vhost-stub.c
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index 40b4e15..0b642d7 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -35,7 +35,6 @@ stub-obj-y += kvm.o
 stub-obj-y += qmp_pc_dimm_device_list.o
 stub-obj-y += target-monitor-defs.o
 stub-obj-y += target-get-monitor-def.o
-stub-obj-y += vhost.o
 stub-obj-y += iohandler.o
 stub-obj-y += pc_madt_cpu_entry.o
 stub-obj-y += migration-colo.o
-- 
2.9.3

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

* [Qemu-devel] [PATCH 09/11] event_notifier: cleanups around event_notifier_set_handler
  2016-12-22 15:59 [Qemu-devel] [RFC PATCH 00/11] Stubs cleanup Paolo Bonzini
                   ` (7 preceding siblings ...)
  2016-12-22 15:59 ` [Qemu-devel] [PATCH 08/11] stubs: move vhost stubs to stubs/vhost.o Paolo Bonzini
@ 2016-12-22 15:59 ` Paolo Bonzini
  2016-12-22 15:59 ` [Qemu-devel] [PATCH 10/11] build: remove --enable-colo/--disable-colo Paolo Bonzini
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 18+ messages in thread
From: Paolo Bonzini @ 2016-12-22 15:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehabkost

EventNotifiers are already supported by AioContext, so reuse that
in iohandler.c and remove the useless is_external argument.  Since the
iohandler AioContext is never used for block devices, aio_disable_external
is never called on it.  This lets us remove stubs/iohandler.c.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/usb/ccid-card-emulated.c   |  2 +-
 hw/virtio/virtio.c            | 10 +++++-----
 include/qemu/event_notifier.h |  3 ---
 include/qemu/main-loop.h      | 15 +++++++++++++++
 iohandler.c                   |  7 +++++++
 stubs/Makefile.objs           |  1 -
 stubs/iohandler.c             |  8 --------
 target/i386/hyperv.c          |  7 ++++---
 util/event_notifier-posix.c   |  9 ---------
 util/event_notifier-win32.c   | 12 ------------
 10 files changed, 32 insertions(+), 42 deletions(-)
 delete mode 100644 stubs/iohandler.c

diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c
index eceb5f3..9962786 100644
--- a/hw/usb/ccid-card-emulated.c
+++ b/hw/usb/ccid-card-emulated.c
@@ -407,7 +407,7 @@ static int init_event_notifier(EmulatedState *card)
         DPRINTF(card, 2, "event notifier creation failed\n");
         return -1;
     }
-    event_notifier_set_handler(&card->notifier, false, card_event_handler);
+    event_notifier_set_handler(&card->notifier, card_event_handler);
     return 0;
 }
 
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 4b1e289..42ed8e6 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -2174,10 +2174,10 @@ void virtio_queue_set_guest_notifier_fd_handler(VirtQueue *vq, bool assign,
                                                 bool with_irqfd)
 {
     if (assign && !with_irqfd) {
-        event_notifier_set_handler(&vq->guest_notifier, false,
+        event_notifier_set_handler(&vq->guest_notifier,
                                    virtio_queue_guest_notifier_read);
     } else {
-        event_notifier_set_handler(&vq->guest_notifier, false, NULL);
+        event_notifier_set_handler(&vq->guest_notifier, NULL);
     }
     if (!assign) {
         /* Test and clear notifier before closing it,
@@ -2351,7 +2351,7 @@ static int virtio_device_start_ioeventfd_impl(VirtIODevice *vdev)
             err = r;
             goto assign_error;
         }
-        event_notifier_set_handler(&vq->host_notifier, true,
+        event_notifier_set_handler(&vq->host_notifier,
                                    virtio_queue_host_notifier_read);
     }
 
@@ -2372,7 +2372,7 @@ assign_error:
             continue;
         }
 
-        event_notifier_set_handler(&vq->host_notifier, true, NULL);
+        event_notifier_set_handler(&vq->host_notifier, NULL);
         r = virtio_bus_set_host_notifier(qbus, n, false);
         assert(r >= 0);
     }
@@ -2398,7 +2398,7 @@ static void virtio_device_stop_ioeventfd_impl(VirtIODevice *vdev)
         if (!virtio_queue_get_num(vdev, n)) {
             continue;
         }
-        event_notifier_set_handler(&vq->host_notifier, true, NULL);
+        event_notifier_set_handler(&vq->host_notifier, NULL);
         r = virtio_bus_set_host_notifier(qbus, n, false);
         assert(r >= 0);
     }
diff --git a/include/qemu/event_notifier.h b/include/qemu/event_notifier.h
index e326990..599c99f 100644
--- a/include/qemu/event_notifier.h
+++ b/include/qemu/event_notifier.h
@@ -34,9 +34,6 @@ int event_notifier_init(EventNotifier *, int active);
 void event_notifier_cleanup(EventNotifier *);
 int event_notifier_set(EventNotifier *);
 int event_notifier_test_and_clear(EventNotifier *);
-int event_notifier_set_handler(EventNotifier *,
-                               bool is_external,
-                               EventNotifierHandler *);
 
 #ifdef CONFIG_POSIX
 void event_notifier_init_fd(EventNotifier *, int fd);
diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h
index a9d4f23..d7e24af 100644
--- a/include/qemu/main-loop.h
+++ b/include/qemu/main-loop.h
@@ -203,6 +203,21 @@ void qemu_set_fd_handler(int fd,
                          IOHandler *fd_write,
                          void *opaque);
 
+
+/**
+ * event_notifier_set_handler: Register an EventNotifier with the main loop
+ *
+ * This function tells the main loop to wake up whenever the
+ * #EventNotifier was set.
+ *
+ * @e: The #EventNotifier to be observed.
+ *
+ * @handler: A level-triggered callback that is fired when @e
+ * has been set.  @e is passed to it as a parameter.
+ */
+void event_notifier_set_handler(EventNotifier *e,
+                                EventNotifierHandler *handler);
+
 GSource *iohandler_get_g_source(void);
 AioContext *iohandler_get_aio_context(void);
 #ifdef CONFIG_POSIX
diff --git a/iohandler.c b/iohandler.c
index f2fc8a9..ae371e0 100644
--- a/iohandler.c
+++ b/iohandler.c
@@ -66,6 +66,13 @@ void qemu_set_fd_handler(int fd,
                        fd_read, fd_write, opaque);
 }
 
+void event_notifier_set_handler(EventNotifier *e,
+                                EventNotifierHandler *handler)
+{
+    iohandler_init();
+    aio_set_event_notifier(iohandler_get_aio_context(), e, false, handler);
+}
+
 /* reaping of zombies.  right now we're not passing the status to
    anyone, but it would be possible to add a callback.  */
 #ifndef _WIN32
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index 0b642d7..e863d9a 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -35,6 +35,5 @@ stub-obj-y += kvm.o
 stub-obj-y += qmp_pc_dimm_device_list.o
 stub-obj-y += target-monitor-defs.o
 stub-obj-y += target-get-monitor-def.o
-stub-obj-y += iohandler.o
 stub-obj-y += pc_madt_cpu_entry.o
 stub-obj-y += migration-colo.o
diff --git a/stubs/iohandler.c b/stubs/iohandler.c
deleted file mode 100644
index 22b0ee5..0000000
--- a/stubs/iohandler.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "qemu/osdep.h"
-#include "qemu-common.h"
-#include "qemu/main-loop.h"
-
-AioContext *iohandler_get_aio_context(void)
-{
-    abort();
-}
diff --git a/target/i386/hyperv.c b/target/i386/hyperv.c
index 39a230f..8545574 100644
--- a/target/i386/hyperv.c
+++ b/target/i386/hyperv.c
@@ -12,6 +12,7 @@
  */
 
 #include "qemu/osdep.h"
+#include "qemu/main-loop.h"
 #include "hyperv.h"
 #include "standard-headers/asm-x86/hyperv.h"
 
@@ -88,7 +89,7 @@ HvSintRoute *kvm_hv_sint_route_create(uint32_t vcpu_id, uint32_t sint,
         goto err_sint_set_notifier;
     }
 
-    event_notifier_set_handler(&sint_route->sint_ack_notifier, false,
+    event_notifier_set_handler(&sint_route->sint_ack_notifier,
                                kvm_hv_sint_ack_handler);
 
     gsi = kvm_irqchip_add_hv_sint_route(kvm_state, vcpu_id, sint);
@@ -112,7 +113,7 @@ HvSintRoute *kvm_hv_sint_route_create(uint32_t vcpu_id, uint32_t sint,
 err_irqfd:
     kvm_irqchip_release_virq(kvm_state, gsi);
 err_gsi:
-    event_notifier_set_handler(&sint_route->sint_ack_notifier, false, NULL);
+    event_notifier_set_handler(&sint_route->sint_ack_notifier, NULL);
     event_notifier_cleanup(&sint_route->sint_ack_notifier);
 err_sint_set_notifier:
     event_notifier_cleanup(&sint_route->sint_set_notifier);
@@ -128,7 +129,7 @@ void kvm_hv_sint_route_destroy(HvSintRoute *sint_route)
                                           &sint_route->sint_set_notifier,
                                           sint_route->gsi);
     kvm_irqchip_release_virq(kvm_state, sint_route->gsi);
-    event_notifier_set_handler(&sint_route->sint_ack_notifier, false, NULL);
+    event_notifier_set_handler(&sint_route->sint_ack_notifier, NULL);
     event_notifier_cleanup(&sint_route->sint_ack_notifier);
     event_notifier_cleanup(&sint_route->sint_set_notifier);
     g_free(sint_route);
diff --git a/util/event_notifier-posix.c b/util/event_notifier-posix.c
index c1f0d79..7e40252 100644
--- a/util/event_notifier-posix.c
+++ b/util/event_notifier-posix.c
@@ -90,15 +90,6 @@ int event_notifier_get_fd(const EventNotifier *e)
     return e->rfd;
 }
 
-int event_notifier_set_handler(EventNotifier *e,
-                               bool is_external,
-                               EventNotifierHandler *handler)
-{
-    aio_set_fd_handler(iohandler_get_aio_context(), e->rfd, is_external,
-                       (IOHandler *)handler, NULL, e);
-    return 0;
-}
-
 int event_notifier_set(EventNotifier *e)
 {
     static const uint64_t value = 1;
diff --git a/util/event_notifier-win32.c b/util/event_notifier-win32.c
index de87df0..519fb59 100644
--- a/util/event_notifier-win32.c
+++ b/util/event_notifier-win32.c
@@ -32,18 +32,6 @@ HANDLE event_notifier_get_handle(EventNotifier *e)
     return e->event;
 }
 
-int event_notifier_set_handler(EventNotifier *e,
-                               bool is_external,
-                               EventNotifierHandler *handler)
-{
-    if (handler) {
-        return qemu_add_wait_object(e->event, (IOHandler *)handler, e);
-    } else {
-        qemu_del_wait_object(e->event, (IOHandler *)handler, e);
-        return 0;
-    }
-}
-
 int event_notifier_set(EventNotifier *e)
 {
     SetEvent(e->event);
-- 
2.9.3

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

* [Qemu-devel] [PATCH 10/11] build: remove --enable-colo/--disable-colo
  2016-12-22 15:59 [Qemu-devel] [RFC PATCH 00/11] Stubs cleanup Paolo Bonzini
                   ` (8 preceding siblings ...)
  2016-12-22 15:59 ` [Qemu-devel] [PATCH 09/11] event_notifier: cleanups around event_notifier_set_handler Paolo Bonzini
@ 2016-12-22 15:59 ` Paolo Bonzini
  2016-12-22 15:59 ` [Qemu-devel] [PATCH 11/11] stubs: remove stubs/kvm.c Paolo Bonzini
  2016-12-22 17:30 ` [Qemu-devel] [RFC PATCH 00/11] Stubs cleanup Peter Maydell
  11 siblings, 0 replies; 18+ messages in thread
From: Paolo Bonzini @ 2016-12-22 15:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehabkost

No need to provide this knob, just enable COLO unconditionally.
Remove the configure option as well as stubs/migration-colo.c.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure               | 11 -----------
 migration/Makefile.objs |  3 +--
 stubs/Makefile.objs     |  1 -
 stubs/migration-colo.c  | 46 ----------------------------------------------
 4 files changed, 1 insertion(+), 60 deletions(-)
 delete mode 100644 stubs/migration-colo.c

diff --git a/configure b/configure
index 7dec6cd..f635cbe 100755
--- a/configure
+++ b/configure
@@ -228,7 +228,6 @@ vhost_net="no"
 vhost_scsi="no"
 vhost_vsock="no"
 kvm="no"
-colo="yes"
 rdma=""
 gprof="no"
 debug_tcg="no"
@@ -919,10 +918,6 @@ for opt do
   ;;
   --enable-kvm) kvm="yes"
   ;;
-  --disable-colo) colo="no"
-  ;;
-  --enable-colo) colo="yes"
-  ;;
   --disable-tcg-interpreter) tcg_interpreter="no"
   ;;
   --enable-tcg-interpreter) tcg_interpreter="yes"
diff --git a/configure b/configure
index f635cbe..dba3397 100755
--- a/configure
+++ b/configure
@@ -1366,7 +1366,6 @@ disabled with --disable-FEATURE, default is enabled if available:
   fdt             fdt device tree
   bluez           bluez stack connectivity
   kvm             KVM acceleration support
-  colo            COarse-grain LOck-stepping VM for Non-stop Service
   rdma            RDMA-based migration support
   vde             support for vde network
   netmap          support for netmap network
@@ -5043,7 +5042,6 @@ echo "Linux AIO support $linux_aio"
 echo "ATTR/XATTR support $attr"
 echo "Install blobs     $blobs"
 echo "KVM support       $kvm"
-echo "COLO support      $colo"
 echo "RDMA support      $rdma"
 echo "TCG interpreter   $tcg_interpreter"
 echo "fdt support       $fdt"
@@ -5684,10 +5679,6 @@ if have_backend "syslog"; then
 fi
 echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
 
-if test "$colo" = "yes"; then
-  echo "CONFIG_COLO=y" >> $config_host_mak
-fi
-
 if test "$rdma" = "yes" ; then
   echo "CONFIG_RDMA=y" >> $config_host_mak
 fi
diff --git a/migration/Makefile.objs b/migration/Makefile.objs
index 3f3e237..480dd49 100644
--- a/migration/Makefile.objs
+++ b/migration/Makefile.objs
@@ -1,7 +1,6 @@
 common-obj-y += migration.o socket.o fd.o exec.o
 common-obj-y += tls.o
-common-obj-y += colo-comm.o
-common-obj-$(CONFIG_COLO) += colo.o colo-failover.o
+common-obj-y += colo-comm.o colo.o colo-failover.o
 common-obj-y += vmstate.o
 common-obj-y += qemu-file.o
 common-obj-y += qemu-file-channel.o
diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index e863d9a..a7d3b72 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -36,4 +36,3 @@ stub-obj-y += qmp_pc_dimm_device_list.o
 stub-obj-y += target-monitor-defs.o
 stub-obj-y += target-get-monitor-def.o
 stub-obj-y += pc_madt_cpu_entry.o
-stub-obj-y += migration-colo.o
diff --git a/stubs/migration-colo.c b/stubs/migration-colo.c
deleted file mode 100644
index 7811764..0000000
--- a/stubs/migration-colo.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * COarse-grain LOck-stepping Virtual Machines for Non-stop Service (COLO)
- * (a.k.a. Fault Tolerance or Continuous Replication)
- *
- * Copyright (c) 2016 HUAWEI TECHNOLOGIES CO., LTD.
- * Copyright (c) 2016 FUJITSU LIMITED
- * Copyright (c) 2016 Intel Corporation
- *
- * This work is licensed under the terms of the GNU GPL, version 2 or
- * later.  See the COPYING file in the top-level directory.
- */
-
-#include "qemu/osdep.h"
-#include "migration/colo.h"
-#include "qmp-commands.h"
-
-bool colo_supported(void)
-{
-    return false;
-}
-
-bool migration_in_colo_state(void)
-{
-    return false;
-}
-
-bool migration_incoming_in_colo_state(void)
-{
-    return false;
-}
-
-void migrate_start_colo_process(MigrationState *s)
-{
-}
-
-void *colo_process_incoming_thread(void *opaque)
-{
-    return NULL;
-}
-
-void qmp_x_colo_lost_heartbeat(Error **errp)
-{
-    error_setg(errp, "COLO is not supported, please rerun configure"
-                     " with --enable-colo option in order to support"
-                     " COLO feature");
-}
-- 
2.9.3

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

* [Qemu-devel] [PATCH 11/11] stubs: remove stubs/kvm.c
  2016-12-22 15:59 [Qemu-devel] [RFC PATCH 00/11] Stubs cleanup Paolo Bonzini
                   ` (9 preceding siblings ...)
  2016-12-22 15:59 ` [Qemu-devel] [PATCH 10/11] build: remove --enable-colo/--disable-colo Paolo Bonzini
@ 2016-12-22 15:59 ` Paolo Bonzini
  2016-12-22 17:30 ` [Qemu-devel] [RFC PATCH 00/11] Stubs cleanup Peter Maydell
  11 siblings, 0 replies; 18+ messages in thread
From: Paolo Bonzini @ 2016-12-22 15:59 UTC (permalink / raw)
  To: qemu-devel; +Cc: ehabkost

This has a single function, just move it to the other target/*/kvm.c files.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 stubs/Makefile.objs | 1 -
 stubs/kvm.c         | 8 --------
 target/mips/kvm.c   | 5 +++++
 target/ppc/kvm.c    | 5 +++++
 target/s390x/kvm.c  | 5 +++++
 5 files changed, 15 insertions(+), 9 deletions(-)
 delete mode 100644 stubs/kvm.c

diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs
index a7d3b72..a187295 100644
--- a/stubs/Makefile.objs
+++ b/stubs/Makefile.objs
@@ -31,7 +31,6 @@ stub-obj-y += uuid.o
 stub-obj-y += vm-stop.o
 stub-obj-y += vmstate.o
 stub-obj-$(CONFIG_WIN32) += fd-register.o
-stub-obj-y += kvm.o
 stub-obj-y += qmp_pc_dimm_device_list.o
 stub-obj-y += target-monitor-defs.o
 stub-obj-y += target-get-monitor-def.o
diff --git a/stubs/kvm.c b/stubs/kvm.c
deleted file mode 100644
index ddd6204..0000000
--- a/stubs/kvm.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "qemu/osdep.h"
-#include "qemu-common.h"
-#include "sysemu/kvm.h"
-
-int kvm_arch_irqchip_create(MachineState *ms, KVMState *s)
-{
-    return 0;
-}
diff --git a/target/mips/kvm.c b/target/mips/kvm.c
index dcf5fbb..998c341 100644
--- a/target/mips/kvm.c
+++ b/target/mips/kvm.c
@@ -55,6 +55,11 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
     return 0;
 }
 
+int kvm_arch_irqchip_create(MachineState *ms, KVMState *s)
+{
+    return 0;
+}
+
 int kvm_arch_init_vcpu(CPUState *cs)
 {
     MIPSCPU *cpu = MIPS_CPU(cs);
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 9c4834c..6c53a6d 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -145,6 +145,11 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
     return 0;
 }
 
+int kvm_arch_irqchip_create(MachineState *ms, KVMState *s)
+{
+    return 0;
+}
+
 static int kvm_arch_sync_sregs(PowerPCCPU *cpu)
 {
     CPUPPCState *cenv = &cpu->env;
diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
index 97afe02..e938954 100644
--- a/target/s390x/kvm.c
+++ b/target/s390x/kvm.c
@@ -294,6 +294,11 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
     return 0;
 }
 
+int kvm_arch_irqchip_create(MachineState *ms, KVMState *s)
+{
+    return 0;
+}
+
 unsigned long kvm_arch_vcpu_id(CPUState *cpu)
 {
     return cpu->cpu_index;
-- 
2.9.3

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

* Re: [Qemu-devel] [RFC PATCH 00/11] Stubs cleanup
  2016-12-22 15:59 [Qemu-devel] [RFC PATCH 00/11] Stubs cleanup Paolo Bonzini
                   ` (10 preceding siblings ...)
  2016-12-22 15:59 ` [Qemu-devel] [PATCH 11/11] stubs: remove stubs/kvm.c Paolo Bonzini
@ 2016-12-22 17:30 ` Peter Maydell
  2016-12-22 17:32   ` Paolo Bonzini
  11 siblings, 1 reply; 18+ messages in thread
From: Peter Maydell @ 2016-12-22 17:30 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: QEMU Developers, Eduardo Habkost

On 22 December 2016 at 15:59, Paolo Bonzini <pbonzini@redhat.com> wrote:
> This moves out of libqemustub.a those functions which can be handled
> simply by $(call lnot), like we already do for pci-stub.c or kvm-stub.c.
> libqemustub.a keep the more complex cases where a small part of the
> executables we build needs an implementation of a small subset of an API.

So why is doing it this way round better? (I don't have a strong
opinion here, but you don't really give a rationale for this change.)

thanks
-- PMM

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

* Re: [Qemu-devel] [RFC PATCH 00/11] Stubs cleanup
  2016-12-22 17:30 ` [Qemu-devel] [RFC PATCH 00/11] Stubs cleanup Peter Maydell
@ 2016-12-22 17:32   ` Paolo Bonzini
  2016-12-22 17:42     ` Eduardo Habkost
  0 siblings, 1 reply; 18+ messages in thread
From: Paolo Bonzini @ 2016-12-22 17:32 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers, Eduardo Habkost



On 22/12/2016 18:30, Peter Maydell wrote:
> On 22 December 2016 at 15:59, Paolo Bonzini <pbonzini@redhat.com> wrote:
>> This moves out of libqemustub.a those functions which can be handled
>> simply by $(call lnot), like we already do for pci-stub.c or kvm-stub.c.
>> libqemustub.a keep the more complex cases where a small part of the
>> executables we build needs an implementation of a small subset of an API.
> 
> So why is doing it this way round better? (I don't have a strong
> opinion here, but you don't really give a rationale for this change.)

I don't really have a strong opinion here either, hence the RFC.
However, one advantage is that it keeps things visible to the right
maintainer.

Paolo

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

* Re: [Qemu-devel] [RFC PATCH 00/11] Stubs cleanup
  2016-12-22 17:32   ` Paolo Bonzini
@ 2016-12-22 17:42     ` Eduardo Habkost
  2016-12-22 17:45       ` Paolo Bonzini
  0 siblings, 1 reply; 18+ messages in thread
From: Eduardo Habkost @ 2016-12-22 17:42 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Peter Maydell, QEMU Developers

On Thu, Dec 22, 2016 at 06:32:24PM +0100, Paolo Bonzini wrote:
> 
> 
> On 22/12/2016 18:30, Peter Maydell wrote:
> > On 22 December 2016 at 15:59, Paolo Bonzini <pbonzini@redhat.com> wrote:
> >> This moves out of libqemustub.a those functions which can be handled
> >> simply by $(call lnot), like we already do for pci-stub.c or kvm-stub.c.
> >> libqemustub.a keep the more complex cases where a small part of the
> >> executables we build needs an implementation of a small subset of an API.
> > 
> > So why is doing it this way round better? (I don't have a strong
> > opinion here, but you don't really give a rationale for this change.)
> 
> I don't really have a strong opinion here either, hence the RFC.
> However, one advantage is that it keeps things visible to the right
> maintainer.

Can't we just move the files to subdirectories where they are
visible to the maintainers, but keep using stub-obj-y/libqemustub
to build/link them?

I find libqemustub/stub-obj-y much easier to use than manually
setting obj-$(call lnot ...).

-- 
Eduardo

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

* Re: [Qemu-devel] [RFC PATCH 00/11] Stubs cleanup
  2016-12-22 17:42     ` Eduardo Habkost
@ 2016-12-22 17:45       ` Paolo Bonzini
  2016-12-23  9:02         ` Markus Armbruster
  0 siblings, 1 reply; 18+ messages in thread
From: Paolo Bonzini @ 2016-12-22 17:45 UTC (permalink / raw)
  To: Eduardo Habkost; +Cc: Peter Maydell, QEMU Developers, Fam Zheng



On 22/12/2016 18:42, Eduardo Habkost wrote:
> On Thu, Dec 22, 2016 at 06:32:24PM +0100, Paolo Bonzini wrote:
>>
>>
>> On 22/12/2016 18:30, Peter Maydell wrote:
>>> On 22 December 2016 at 15:59, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>>> This moves out of libqemustub.a those functions which can be handled
>>>> simply by $(call lnot), like we already do for pci-stub.c or kvm-stub.c.
>>>> libqemustub.a keep the more complex cases where a small part of the
>>>> executables we build needs an implementation of a small subset of an API.
>>>
>>> So why is doing it this way round better? (I don't have a strong
>>> opinion here, but you don't really give a rationale for this change.)
>>
>> I don't really have a strong opinion here either, hence the RFC.
>> However, one advantage is that it keeps things visible to the right
>> maintainer.
> 
> Can't we just move the files to subdirectories where they are
> visible to the maintainers, but keep using stub-obj-y/libqemustub
> to build/link them?
> 
> I find libqemustub/stub-obj-y much easier to use than manually
> setting obj-$(call lnot ...).

Yes, that would work too.  It's a pity that we cannot just use weak
symbols, as that would work fine with obj-y.

It would be a bit ugly to have to add "stub-obj-y += foo/" in the parent
directory.  But maybe we can replace that with a "subdir-y += foo/" and
just do a single recursion for all variables.  Fam, you did the current
implementation of unnest-vars, what do you think?  Would it also be simpler?

Paolo

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

* Re: [Qemu-devel] [RFC PATCH 00/11] Stubs cleanup
  2016-12-22 17:45       ` Paolo Bonzini
@ 2016-12-23  9:02         ` Markus Armbruster
  2016-12-23  9:18           ` Paolo Bonzini
  0 siblings, 1 reply; 18+ messages in thread
From: Markus Armbruster @ 2016-12-23  9:02 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Eduardo Habkost, Peter Maydell, Fam Zheng, QEMU Developers

Paolo Bonzini <pbonzini@redhat.com> writes:

> On 22/12/2016 18:42, Eduardo Habkost wrote:
>> On Thu, Dec 22, 2016 at 06:32:24PM +0100, Paolo Bonzini wrote:
>>>
>>>
>>> On 22/12/2016 18:30, Peter Maydell wrote:
>>>> On 22 December 2016 at 15:59, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>>>> This moves out of libqemustub.a those functions which can be handled
>>>>> simply by $(call lnot), like we already do for pci-stub.c or kvm-stub.c.
>>>>> libqemustub.a keep the more complex cases where a small part of the
>>>>> executables we build needs an implementation of a small subset of an API.
>>>>
>>>> So why is doing it this way round better? (I don't have a strong
>>>> opinion here, but you don't really give a rationale for this change.)
>>>
>>> I don't really have a strong opinion here either, hence the RFC.
>>> However, one advantage is that it keeps things visible to the right
>>> maintainer.
>> 
>> Can't we just move the files to subdirectories where they are
>> visible to the maintainers, but keep using stub-obj-y/libqemustub
>> to build/link them?
>> 
>> I find libqemustub/stub-obj-y much easier to use than manually
>> setting obj-$(call lnot ...).
>
> Yes, that would work too.  It's a pity that we cannot just use weak
> symbols, as that would work fine with obj-y.

Can you explain again why we can't use weak symbols?

[...]

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

* Re: [Qemu-devel] [RFC PATCH 00/11] Stubs cleanup
  2016-12-23  9:02         ` Markus Armbruster
@ 2016-12-23  9:18           ` Paolo Bonzini
  0 siblings, 0 replies; 18+ messages in thread
From: Paolo Bonzini @ 2016-12-23  9:18 UTC (permalink / raw)
  To: Markus Armbruster
  Cc: Eduardo Habkost, Peter Maydell, Fam Zheng, QEMU Developers



----- Original Message -----
> From: "Markus Armbruster" <armbru@redhat.com>
> To: "Paolo Bonzini" <pbonzini@redhat.com>
> Cc: "Eduardo Habkost" <ehabkost@redhat.com>, "Peter Maydell" <peter.maydell@linaro.org>, "Fam Zheng"
> <famz@redhat.com>, "QEMU Developers" <qemu-devel@nongnu.org>
> Sent: Friday, December 23, 2016 10:02:33 AM
> Subject: Re: [Qemu-devel] [RFC PATCH 00/11] Stubs cleanup
> 
> Paolo Bonzini <pbonzini@redhat.com> writes:
> 
> > On 22/12/2016 18:42, Eduardo Habkost wrote:
> >> On Thu, Dec 22, 2016 at 06:32:24PM +0100, Paolo Bonzini wrote:
> >>>
> >>>
> >>> On 22/12/2016 18:30, Peter Maydell wrote:
> >>>> On 22 December 2016 at 15:59, Paolo Bonzini <pbonzini@redhat.com> wrote:
> >>>>> This moves out of libqemustub.a those functions which can be handled
> >>>>> simply by $(call lnot), like we already do for pci-stub.c or
> >>>>> kvm-stub.c.
> >>>>> libqemustub.a keep the more complex cases where a small part of the
> >>>>> executables we build needs an implementation of a small subset of an
> >>>>> API.
> >>>>
> >>>> So why is doing it this way round better? (I don't have a strong
> >>>> opinion here, but you don't really give a rationale for this change.)
> >>>
> >>> I don't really have a strong opinion here either, hence the RFC.
> >>> However, one advantage is that it keeps things visible to the right
> >>> maintainer.
> >> 
> >> Can't we just move the files to subdirectories where they are
> >> visible to the maintainers, but keep using stub-obj-y/libqemustub
> >> to build/link them?
> >> 
> >> I find libqemustub/stub-obj-y much easier to use than manually
> >> setting obj-$(call lnot ...).
> >
> > Yes, that would work too.  It's a pity that we cannot just use weak
> > symbols, as that would work fine with obj-y.
> 
> Can you explain again why we can't use weak symbols?

Because Windows and OS X don't have full support for weak symbols.
At least as I understand it, OS X only supports "weak import" of
a symbol from a library, where if a symbol is missing _in the library_
it resolves to NULL in the program.  It doesn't support replacing a
weak definition of a function with a strong definition of the same,
and that's why we use a static library.

Paolo

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

end of thread, other threads:[~2016-12-23  9:18 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-22 15:59 [Qemu-devel] [RFC PATCH 00/11] Stubs cleanup Paolo Bonzini
2016-12-22 15:59 ` [Qemu-devel] [PATCH 01/11] stubs: merge all monitor stubs in one file, remove monitor_cur_is_qmp stub Paolo Bonzini
2016-12-22 15:59 ` [Qemu-devel] [PATCH 02/11] stubs: move smbios stubs to hw/smbios Paolo Bonzini
2016-12-22 15:59 ` [Qemu-devel] [PATCH 03/11] stubs: move acpi stubs to hw/acpi Paolo Bonzini
2016-12-22 15:59 ` [Qemu-devel] [PATCH 04/11] stubs: remove unused stub for serial_hd Paolo Bonzini
2016-12-22 15:59 ` [Qemu-devel] [PATCH 05/11] hw: move reset handlers from vl.c to hw/core Paolo Bonzini
2016-12-22 15:59 ` [Qemu-devel] [PATCH 06/11] stubs: group stubs for user-mode emulation Paolo Bonzini
2016-12-22 15:59 ` [Qemu-devel] [PATCH 07/11] stubs: group all monitor_fdset_* functions in a single file Paolo Bonzini
2016-12-22 15:59 ` [Qemu-devel] [PATCH 08/11] stubs: move vhost stubs to stubs/vhost.o Paolo Bonzini
2016-12-22 15:59 ` [Qemu-devel] [PATCH 09/11] event_notifier: cleanups around event_notifier_set_handler Paolo Bonzini
2016-12-22 15:59 ` [Qemu-devel] [PATCH 10/11] build: remove --enable-colo/--disable-colo Paolo Bonzini
2016-12-22 15:59 ` [Qemu-devel] [PATCH 11/11] stubs: remove stubs/kvm.c Paolo Bonzini
2016-12-22 17:30 ` [Qemu-devel] [RFC PATCH 00/11] Stubs cleanup Peter Maydell
2016-12-22 17:32   ` Paolo Bonzini
2016-12-22 17:42     ` Eduardo Habkost
2016-12-22 17:45       ` Paolo Bonzini
2016-12-23  9:02         ` Markus Armbruster
2016-12-23  9:18           ` Paolo Bonzini

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.