1 Star 0 Fork 126

wanglmb/qemu

forked from src-openEuler/qemu 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
feature-Add-log-for-each-modules.patch 9.21 KB
一键复制 编辑 原始数据 按行查看 历史
imxcc 提交于 2022-02-12 12:48 . Update with openeuler !235
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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wanglmb/qemu.git
git@gitee.com:wanglmb/qemu.git
wanglmb
qemu
qemu
master

搜索帮助