Update with openeuler !235

Signed-off-by: imxcc <xingchaochao@huawei.com>
This commit is contained in:
imxcc 2022-02-12 12:48:27 +00:00 committed by yezengruan
parent e6f6fe87dd
commit 6e7dfc22ee
4 changed files with 495 additions and 1 deletions

View File

@ -0,0 +1,262 @@
From 1a0b974a0aaff667a76972403c28c66416c2947b Mon Sep 17 00:00:00 2001
From: "wangxinxin.wang@huawei.com" <wangxinxin.wang@huawei.com>
Date: Tue, 27 Jun 2017 17:42:23 +0800
Subject: [PATCH 2/3] feature: Add log for each modules
add log for each modules.
Signed-off-by: miaoyubo <miaoyubo@huawei.com>
Signed-off-by: Jingyi Wang <wangjingyi11@huawei.com>
---
accel/kvm/kvm-all.c | 5 ++++-
hw/char/virtio-serial-bus.c | 5 +++++
hw/pci/pci.c | 1 +
hw/usb/bus.c | 6 ++++++
hw/usb/host-libusb.c | 5 +++++
hw/virtio/virtio-scsi-pci.c | 3 +++
monitor/monitor.c | 1 +
monitor/qmp-cmds.c | 3 +++
os-posix.c | 1 +
qapi/qmp-dispatch.c | 15 +++++++++++++++
softmmu/qdev-monitor.c | 5 +++++
11 files changed, 49 insertions(+), 1 deletion(-)
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index b128d311c2..8a98446b7c 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -1751,7 +1751,10 @@ void kvm_irqchip_commit_routes(KVMState *s)
s->irq_routes->flags = 0;
trace_kvm_irqchip_commit_routes();
ret = kvm_vm_ioctl(s, KVM_SET_GSI_ROUTING, s->irq_routes);
- assert(ret == 0);
+ if (ret < 0) {
+ error_report("Set GSI routing failed: %m");
+ abort();
+ }
}
static void kvm_add_routing_entry(KVMState *s,
diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
index f01ec2137c..edb7a44ee9 100644
--- a/hw/char/virtio-serial-bus.c
+++ b/hw/char/virtio-serial-bus.c
@@ -257,6 +257,8 @@ static size_t send_control_event(VirtIOSerial *vser, uint32_t port_id,
virtio_stw_p(vdev, &cpkt.value, value);
trace_virtio_serial_send_control_event(port_id, event, value);
+ qemu_log("virtio serial port %d send control message"
+ " event = %d, value = %d\n", port_id, event, value);
return send_control_msg(vser, &cpkt, sizeof(cpkt));
}
@@ -364,6 +366,9 @@ static void handle_control_message(VirtIOSerial *vser, void *buf, size_t len)
cpkt.value = virtio_lduw_p(vdev, &gcpkt->value);
trace_virtio_serial_handle_control_message(cpkt.event, cpkt.value);
+ qemu_log("virtio serial port '%u' handle control message"
+ " event = %d, value = %d\n",
+ virtio_ldl_p(vdev, &gcpkt->id), cpkt.event, cpkt.value);
if (cpkt.event == VIRTIO_CONSOLE_DEVICE_READY) {
if (!cpkt.value) {
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 850735fc46..0743dc7c42 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -2411,6 +2411,7 @@ static void pci_add_option_rom(PCIDevice *pdev, bool is_default_rom,
} else {
snprintf(name, sizeof(name), "%s.rom", object_get_typename(OBJECT(pdev)));
}
+ qemu_log("add rom file: %s\n", name);
pdev->has_rom = true;
memory_region_init_rom(&pdev->rom, OBJECT(pdev), name, pdev->romsize, &error_fatal);
ptr = memory_region_get_ram_ptr(&pdev->rom);
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index 92d6ed5626..20cd9b6e6f 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -536,6 +536,10 @@ void usb_check_attach(USBDevice *dev, Error **errp)
bus->qbus.name, port->path, portspeed);
return;
}
+
+ qemu_log("attach usb device \"%s\" (%s speed) to VM bus \"%s\", "
+ "port \"%s\" (%s speed)\n", dev->product_desc, devspeed,
+ bus->qbus.name, port->path, portspeed);
}
void usb_device_attach(USBDevice *dev, Error **errp)
@@ -564,6 +568,8 @@ int usb_device_detach(USBDevice *dev)
usb_detach(port);
dev->attached = false;
+ qemu_log("detach usb device \"%s\" from VM bus \"%s\", port \"%s\"\n",
+ dev->product_desc, bus->qbus.name, port->path);
return 0;
}
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index 8f521ad586..3394b04f50 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -992,6 +992,8 @@ static int usb_host_open(USBHostDevice *s, libusb_device *dev, int hostfd)
rc = libusb_open(dev, &s->dh);
if (rc != 0) {
+ qemu_log("libusb open usb device bus %d, device %d failed\n",
+ bus_num, addr);
goto fail;
}
} else {
@@ -1019,6 +1021,7 @@ static int usb_host_open(USBHostDevice *s, libusb_device *dev, int hostfd)
libusb_get_device_descriptor(dev, &s->ddesc);
usb_host_get_port(s->dev, s->port, sizeof(s->port));
+ qemu_log("open a host usb device on bus %d, device %d\n", bus_num, addr);
usb_ep_init(udev);
usb_host_ep_update(s);
@@ -1146,6 +1149,8 @@ static int usb_host_close(USBHostDevice *s)
usb_device_detach(udev);
}
+ qemu_log("begin to reset the usb device, bus : %d, device : %d\n",
+ s->bus_num, s->addr);
usb_host_release_interfaces(s);
libusb_reset_device(s->dh);
usb_host_attach_kernel(s);
diff --git a/hw/virtio/virtio-scsi-pci.c b/hw/virtio/virtio-scsi-pci.c
index 97fab74236..498f9e2c98 100644
--- a/hw/virtio/virtio-scsi-pci.c
+++ b/hw/virtio/virtio-scsi-pci.c
@@ -18,6 +18,7 @@
#include "hw/qdev-properties.h"
#include "hw/virtio/virtio-scsi.h"
#include "qemu/module.h"
+#include "qemu/log.h"
#include "virtio-pci.h"
#include "qom/object.h"
@@ -51,6 +52,8 @@ static void virtio_scsi_pci_realize(VirtIOPCIProxy *vpci_dev, Error **errp)
VirtIOSCSIConf *conf = &dev->vdev.parent_obj.conf;
char *bus_name;
+ qemu_log("virtio scsi HBA %s begin to initialize.\n",
+ !proxy->id ? "NULL" : proxy->id);
if (conf->num_queues == VIRTIO_SCSI_AUTO_NUM_QUEUES) {
conf->num_queues =
virtio_pci_optimal_num_queues(VIRTIO_SCSI_VQ_NUM_FIXED);
diff --git a/monitor/monitor.c b/monitor/monitor.c
index 621e79eb66..28206bedc4 100644
--- a/monitor/monitor.c
+++ b/monitor/monitor.c
@@ -23,6 +23,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "monitor-internal.h"
#include "qapi/error.h"
#include "qapi/opts-visitor.h"
diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
index 98868cee03..d71beace6a 100644
--- a/monitor/qmp-cmds.c
+++ b/monitor/qmp-cmds.c
@@ -21,6 +21,7 @@
#include "sysemu/sysemu.h"
#include "qemu/config-file.h"
#include "qemu/uuid.h"
+#include "qemu/log.h"
#include "chardev/char.h"
#include "ui/qemu-spice.h"
#include "ui/console.h"
@@ -150,8 +151,10 @@ void qmp_cont(Error **errp)
}
if (runstate_check(RUN_STATE_INMIGRATE)) {
+ qemu_log("qmp cont is received in migration\n");
autostart = 1;
} else {
+ qemu_log("qmp cont is received and vm is started\n");
vm_start();
}
}
diff --git a/os-posix.c b/os-posix.c
index ae6c9f2a5e..306c442bc8 100644
--- a/os-posix.c
+++ b/os-posix.c
@@ -322,6 +322,7 @@ int os_mlock(void)
#ifdef HAVE_MLOCKALL
int ret = 0;
+ qemu_log("do mlockall\n");
ret = mlockall(MCL_CURRENT | MCL_FUTURE);
if (ret < 0) {
error_report("mlockall: %s", strerror(errno));
diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c
index bb005594d3..392ddb097c 100644
--- a/qapi/qmp-dispatch.c
+++ b/qapi/qmp-dispatch.c
@@ -26,6 +26,7 @@
#include "qemu/coroutine.h"
#include "qemu/main-loop.h"
#include "qemu/log.h"
+#include "qapi/qmp/qstring.h"
Visitor *qobject_input_visitor_new_qmp(QObject *obj)
{
@@ -221,6 +222,20 @@ QDict *qmp_dispatch(const QmpCommandList *cmds, QObject *request,
assert(!(oob && qemu_in_coroutine()));
assert(monitor_cur() == NULL);
+
+ json = qobject_to_json(QOBJECT(args));
+ if (json) {
+ if ((strcmp(command, "query-block-jobs") != 0)
+ && (strcmp(command, "query-migrate") != 0)
+ && (strcmp(command, "query-blockstats") != 0)
+ && (strcmp(command, "query-balloon") != 0)
+ && (strcmp(command, "set_password") != 0)) {
+ qemu_log("qmp_cmd_name: %s, arguments: %s\n",
+ command, json->str);
+ }
+ g_string_free(json, true);
+ }
+
if (!!(cmd->options & QCO_COROUTINE) == qemu_in_coroutine()) {
monitor_set_cur(qemu_coroutine_self(), cur_mon);
cmd->fn(args, &ret, &err);
diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c
index 4a20f5dbd7..05e1d88d99 100644
--- a/softmmu/qdev-monitor.c
+++ b/softmmu/qdev-monitor.c
@@ -636,6 +636,7 @@ DeviceState *qdev_device_add_from_qdict(const QDict *opts,
if (path != NULL) {
bus = qbus_find(path, errp);
if (!bus) {
+ qemu_log("can not find bus for %s\n", driver);
return NULL;
}
if (!object_dynamic_cast(OBJECT(bus), dc->bus_type)) {
@@ -706,6 +707,8 @@ DeviceState *qdev_device_add_from_qdict(const QDict *opts,
object_set_properties_from_keyval(&dev->parent_obj, dev->opts, from_json,
errp);
if (*errp) {
+ qemu_log("the bus %s -driver %s set property failed\n",
+ bus ? bus->name : "None", driver);
goto err_del_dev;
}
qemu_log("add qdev %s:%s success\n", driver, dev->id ? dev->id : "none");
@@ -730,6 +733,8 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp)
ret = qdev_device_add_from_qdict(qdict, false, errp);
if (ret) {
+ qemu_log("add qdev %s:%s success\n", qemu_opt_get(opts, "driver"),
+ qemu_opts_id(opts) ? qemu_opts_id(opts) : "none");
qemu_opts_del(opts);
}
qobject_unref(qdict);
--
2.30.0

View File

@ -0,0 +1,157 @@
From afbf800fa1f5e104a5edf116db4956289990ebe1 Mon Sep 17 00:00:00 2001
From: "wangxinxin.wang@huawei.com" <wangxinxin.wang@huawei.com>
Date: Thu, 22 Jun 2017 08:30:04 +0800
Subject: [PATCH 3/3] feature: Add logs for vm start and destroy
Add QEMU_LOG for vm start and destroy
Signed-off-by: miaoyubo <miaoyubo@huawei.com>
Signed-off-by: Jingyi Wang <wangjingyi11@huawei.com>
---
hw/acpi/core.c | 4 ++++
hw/core/reset.c | 2 ++
softmmu/main.c | 2 ++
softmmu/runstate.c | 2 ++
softmmu/vl.c | 6 ++++++
5 files changed, 16 insertions(+)
diff --git a/hw/acpi/core.c b/hw/acpi/core.c
index 1e004d0078..eb631caa91 100644
--- a/hw/acpi/core.c
+++ b/hw/acpi/core.c
@@ -24,6 +24,7 @@
#include "hw/acpi/acpi.h"
#include "hw/nvram/fw_cfg.h"
#include "qemu/config-file.h"
+#include "qemu/log.h"
#include "qapi/error.h"
#include "qapi/opts-visitor.h"
#include "qapi/qapi-events-run-state.h"
@@ -560,13 +561,16 @@ static void acpi_pm1_cnt_write(ACPIREGS *ar, uint16_t val)
uint16_t sus_typ = (val >> 10) & 7;
switch (sus_typ) {
case 0: /* soft power off */
+ qemu_log("VM will be soft power off\n");
qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
break;
case 1:
+ qemu_log("VM will be suspend state\n");
qemu_system_suspend_request();
break;
default:
if (sus_typ == ar->pm1.cnt.s4_val) { /* S4 request */
+ qemu_log("VM will be S4 state\n");
qapi_event_send_suspend_disk();
qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN);
}
diff --git a/hw/core/reset.c b/hw/core/reset.c
index 9c477f2bf5..e923723d38 100644
--- a/hw/core/reset.c
+++ b/hw/core/reset.c
@@ -25,6 +25,7 @@
#include "qemu/osdep.h"
#include "qemu/queue.h"
+#include "qemu/log.h"
#include "sysemu/reset.h"
/* reset/shutdown handler */
@@ -64,6 +65,7 @@ void qemu_devices_reset(void)
{
QEMUResetEntry *re, *nre;
+ qemu_log("reset all devices\n");
/* reset all devices */
QTAILQ_FOREACH_SAFE(re, &reset_handlers, entry, nre) {
re->func(re->opaque);
diff --git a/softmmu/main.c b/softmmu/main.c
index 639c67ff48..0acb41bd30 100644
--- a/softmmu/main.c
+++ b/softmmu/main.c
@@ -23,6 +23,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/log.h"
#include "qemu-common.h"
#include "sysemu/sysemu.h"
@@ -47,6 +48,7 @@ int main(int argc, char **argv)
int main(int argc, char **argv, char **envp)
{
qemu_init(argc, argv, envp);
+ qemu_log("qemu enter main_loop\n");
qemu_main_loop();
qemu_cleanup();
diff --git a/softmmu/runstate.c b/softmmu/runstate.c
index 5736d908db..52fc3b7d6f 100644
--- a/softmmu/runstate.c
+++ b/softmmu/runstate.c
@@ -708,9 +708,11 @@ static bool main_loop_should_exit(void)
}
if (qemu_powerdown_requested()) {
qemu_system_powerdown();
+ qemu_log("domain is power down by outside operation\n");
}
if (qemu_vmstop_requested(&r)) {
vm_stop(r);
+ qemu_log("domain is stopped by outside operation\n");
}
return false;
}
diff --git a/softmmu/vl.c b/softmmu/vl.c
index d9e4c619d3..d8996f3d6e 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -26,6 +26,7 @@
#include "qemu-common.h"
#include "qemu/datadir.h"
#include "qemu/units.h"
+#include "qemu/log.h"
#include "exec/cpu-common.h"
#include "hw/qdev-properties.h"
#include "qapi/compat-policy.h"
@@ -2680,6 +2681,7 @@ static void qemu_create_cli_devices(void)
}
/* init generic devices */
+ qemu_log("device init start\n");
rom_set_order_override(FW_CFG_ORDER_OVERRIDE_DEVICE);
qemu_opts_foreach(qemu_find_opts("device"),
device_init_func, NULL, &error_fatal);
@@ -2819,6 +2821,7 @@ void qemu_init(int argc, char **argv, char **envp)
qemu_init_subsystems();
+ qemu_log("qemu pid is %d, options parsing start\n", getpid());
/* first pass of option parsing */
optind = 1;
while (optind < argc) {
@@ -3027,6 +3030,7 @@ void qemu_init(int argc, char **argv, char **envp)
exit(0);
break;
case QEMU_OPTION_m:
+ qemu_log("memory options parse start\n");
opts = qemu_opts_parse_noisily(qemu_find_opts("memory"),
optarg, true);
if (!opts) {
@@ -3744,6 +3748,7 @@ void qemu_init(int argc, char **argv, char **envp)
*/
machine_class = MACHINE_GET_CLASS(current_machine);
+ qemu_log("configure accelerator %s start\n", machine_class->name);
if (!qtest_enabled() && machine_class->deprecation_reason) {
error_report("Machine type '%s' is deprecated: %s",
machine_class->name, machine_class->deprecation_reason);
@@ -3757,6 +3762,7 @@ void qemu_init(int argc, char **argv, char **envp)
qemu_create_late_backends();
+ qemu_log("machine init start\n");
/* parse features once if machine provides default cpu_type */
current_machine->cpu_type = machine_class->default_cpu_type;
if (cpu_option) {
--
2.30.0

View File

@ -0,0 +1,67 @@
From 2d3abbcc8f6c6db582d931ba194b26dd7148849f Mon Sep 17 00:00:00 2001
From: "wanghaibin.wang" <wanghaibin.wang@huawei.com>
Date: Mon, 16 Oct 2017 18:01:59 +0800
Subject: [PATCH 1/3] log: Add log at boot & cpu init for aarch64
Add log at boot & cpu init for aarch64
Signed-off-by: miaoyubo <miaoyubo@huawei.com>
Signed-off-by: Jingyi Wang <wangjingyi11@huawei.com>
---
hw/arm/boot.c | 4 ++++
hw/arm/virt.c | 3 +++
2 files changed, 7 insertions(+)
diff --git a/hw/arm/boot.c b/hw/arm/boot.c
index 74ad397b1f..21024f7999 100644
--- a/hw/arm/boot.c
+++ b/hw/arm/boot.c
@@ -12,6 +12,7 @@
#include "qemu/datadir.h"
#include "qemu/error-report.h"
#include "qapi/error.h"
+#include "qemu/log.h"
#include <libfdt.h>
#include "hw/arm/boot.h"
#include "hw/arm/linux-boot-if.h"
@@ -1317,6 +1318,9 @@ void arm_load_kernel(ARMCPU *cpu, MachineState *ms, struct arm_boot_info *info)
* doesn't support secure.
*/
assert(!(info->secure_board_setup && kvm_enabled()));
+
+ qemu_log("load the kernel\n");
+
info->kernel_filename = ms->kernel_filename;
info->kernel_cmdline = ms->kernel_cmdline;
info->initrd_filename = ms->initrd_filename;
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
index 0538d258fa..47e98f09e8 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -33,6 +33,7 @@
#include "qemu/datadir.h"
#include "qemu/units.h"
#include "qemu/option.h"
+#include "qemu/log.h"
#include "monitor/qdev.h"
#include "qapi/error.h"
#include "hw/sysbus.h"
@@ -971,6 +972,7 @@ static void virt_powerdown_req(Notifier *n, void *opaque)
{
VirtMachineState *s = container_of(n, VirtMachineState, powerdown_notifier);
+ qemu_log("send powerdown to vm.\n");
if (s->acpi_dev) {
acpi_send_event(s->acpi_dev, ACPI_POWER_DOWN_STATUS);
} else {
@@ -2072,6 +2074,7 @@ static void machvirt_init(MachineState *machine)
}
create_fdt(vms);
+ qemu_log("cpu init start\n");
possible_cpus = mc->possible_cpu_arch_ids(machine);
assert(possible_cpus->len == max_cpus);
--
2.30.0

View File

@ -1,6 +1,6 @@
Name: qemu
Version: 6.2.0
Release: 12
Release: 13
Epoch: 2
Summary: QEMU is a generic and open source machine emulator and virtualizer
License: GPLv2 and BSD and MIT and CC-BY-SA-4.0
@ -137,6 +137,9 @@ Patch0124: vfio-Add-vfio_prereg_listener_global_log_start-stop-.patch
Patch0125: hw-arm-smmuv3-Post-load-stage-1-configurations-to-th.patch
Patch0126: vfio-common-Fix-incorrect-address-alignment-in-vfio_.patch
Patch0127: vfio-common-Add-address-alignment-check-in-vfio_list.patch
Patch0128: log-Add-log-at-boot-cpu-init-for-aarch64.patch
Patch0129: feature-Add-log-for-each-modules.patch
Patch0130: feature-Add-logs-for-vm-start-and-destroy.patch
BuildRequires: flex
BuildRequires: gcc
@ -581,6 +584,11 @@ getent passwd qemu >/dev/null || \
%endif
%changelog
* Sat Feb 12 2022 Chen Qun <kuhn.chenqun@huawei.com>
- log: Add log at boot & cpu init for aarch64
- feature: Add log for each modules
- feature: Add logs for vm start and destroy
* Sat Feb 12 2022 Chen Qun <kuhn.chenqun@huawei.com>
- linux-headers: update against 5.10 and manual clear vfio dirty log series
- vfio: Maintain DMA mapping range for the container