mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-27 05:20:50 +00:00
qapi: introduce x-query-rdma QMP command
This is a counterpart to the HMP "info rdma" command. It is being added with an "x-" prefix because this QMP command is intended as an adhoc debugging tool and will thus not be modelled in QAPI as fully structured data, nor will it have long term guaranteed stability. The existing HMP command is rewritten to call the QMP command. Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
fc30920731
commit
8dbbca5c05
@ -185,7 +185,7 @@ ERST
|
||||
.args_type = "",
|
||||
.params = "",
|
||||
.help = "show RDMA state",
|
||||
.cmd = hmp_info_rdma,
|
||||
.cmd_info_hrt = qmp_x_query_rdma,
|
||||
},
|
||||
|
||||
SRST
|
||||
|
@ -27,57 +27,57 @@
|
||||
#define PG_DIR_SZ { TARGET_PAGE_SIZE / sizeof(__u64) }
|
||||
#define PG_TBL_SZ { TARGET_PAGE_SIZE / sizeof(__u64) }
|
||||
|
||||
void rdma_dump_device_counters(Monitor *mon, RdmaDeviceResources *dev_res)
|
||||
void rdma_format_device_counters(RdmaDeviceResources *dev_res, GString *buf)
|
||||
{
|
||||
monitor_printf(mon, "\ttx : %" PRId64 "\n",
|
||||
g_string_append_printf(buf, "\ttx : %" PRId64 "\n",
|
||||
dev_res->stats.tx);
|
||||
monitor_printf(mon, "\ttx_len : %" PRId64 "\n",
|
||||
g_string_append_printf(buf, "\ttx_len : %" PRId64 "\n",
|
||||
dev_res->stats.tx_len);
|
||||
monitor_printf(mon, "\ttx_err : %" PRId64 "\n",
|
||||
g_string_append_printf(buf, "\ttx_err : %" PRId64 "\n",
|
||||
dev_res->stats.tx_err);
|
||||
monitor_printf(mon, "\trx_bufs : %" PRId64 "\n",
|
||||
g_string_append_printf(buf, "\trx_bufs : %" PRId64 "\n",
|
||||
dev_res->stats.rx_bufs);
|
||||
monitor_printf(mon, "\trx_srq : %" PRId64 "\n",
|
||||
g_string_append_printf(buf, "\trx_srq : %" PRId64 "\n",
|
||||
dev_res->stats.rx_srq);
|
||||
monitor_printf(mon, "\trx_bufs_len : %" PRId64 "\n",
|
||||
g_string_append_printf(buf, "\trx_bufs_len : %" PRId64 "\n",
|
||||
dev_res->stats.rx_bufs_len);
|
||||
monitor_printf(mon, "\trx_bufs_err : %" PRId64 "\n",
|
||||
g_string_append_printf(buf, "\trx_bufs_err : %" PRId64 "\n",
|
||||
dev_res->stats.rx_bufs_err);
|
||||
monitor_printf(mon, "\tcomps : %" PRId64 "\n",
|
||||
g_string_append_printf(buf, "\tcomps : %" PRId64 "\n",
|
||||
dev_res->stats.completions);
|
||||
monitor_printf(mon, "\tmissing_comps : %" PRId32 "\n",
|
||||
g_string_append_printf(buf, "\tmissing_comps : %" PRId32 "\n",
|
||||
dev_res->stats.missing_cqe);
|
||||
monitor_printf(mon, "\tpoll_cq (bk) : %" PRId64 "\n",
|
||||
g_string_append_printf(buf, "\tpoll_cq (bk) : %" PRId64 "\n",
|
||||
dev_res->stats.poll_cq_from_bk);
|
||||
monitor_printf(mon, "\tpoll_cq_ppoll_to : %" PRId64 "\n",
|
||||
g_string_append_printf(buf, "\tpoll_cq_ppoll_to : %" PRId64 "\n",
|
||||
dev_res->stats.poll_cq_ppoll_to);
|
||||
monitor_printf(mon, "\tpoll_cq (fe) : %" PRId64 "\n",
|
||||
g_string_append_printf(buf, "\tpoll_cq (fe) : %" PRId64 "\n",
|
||||
dev_res->stats.poll_cq_from_guest);
|
||||
monitor_printf(mon, "\tpoll_cq_empty : %" PRId64 "\n",
|
||||
g_string_append_printf(buf, "\tpoll_cq_empty : %" PRId64 "\n",
|
||||
dev_res->stats.poll_cq_from_guest_empty);
|
||||
monitor_printf(mon, "\tmad_tx : %" PRId64 "\n",
|
||||
g_string_append_printf(buf, "\tmad_tx : %" PRId64 "\n",
|
||||
dev_res->stats.mad_tx);
|
||||
monitor_printf(mon, "\tmad_tx_err : %" PRId64 "\n",
|
||||
g_string_append_printf(buf, "\tmad_tx_err : %" PRId64 "\n",
|
||||
dev_res->stats.mad_tx_err);
|
||||
monitor_printf(mon, "\tmad_rx : %" PRId64 "\n",
|
||||
g_string_append_printf(buf, "\tmad_rx : %" PRId64 "\n",
|
||||
dev_res->stats.mad_rx);
|
||||
monitor_printf(mon, "\tmad_rx_err : %" PRId64 "\n",
|
||||
g_string_append_printf(buf, "\tmad_rx_err : %" PRId64 "\n",
|
||||
dev_res->stats.mad_rx_err);
|
||||
monitor_printf(mon, "\tmad_rx_bufs : %" PRId64 "\n",
|
||||
g_string_append_printf(buf, "\tmad_rx_bufs : %" PRId64 "\n",
|
||||
dev_res->stats.mad_rx_bufs);
|
||||
monitor_printf(mon, "\tmad_rx_bufs_err : %" PRId64 "\n",
|
||||
g_string_append_printf(buf, "\tmad_rx_bufs_err : %" PRId64 "\n",
|
||||
dev_res->stats.mad_rx_bufs_err);
|
||||
monitor_printf(mon, "\tPDs : %" PRId32 "\n",
|
||||
g_string_append_printf(buf, "\tPDs : %" PRId32 "\n",
|
||||
dev_res->pd_tbl.used);
|
||||
monitor_printf(mon, "\tMRs : %" PRId32 "\n",
|
||||
g_string_append_printf(buf, "\tMRs : %" PRId32 "\n",
|
||||
dev_res->mr_tbl.used);
|
||||
monitor_printf(mon, "\tUCs : %" PRId32 "\n",
|
||||
g_string_append_printf(buf, "\tUCs : %" PRId32 "\n",
|
||||
dev_res->uc_tbl.used);
|
||||
monitor_printf(mon, "\tQPs : %" PRId32 "\n",
|
||||
g_string_append_printf(buf, "\tQPs : %" PRId32 "\n",
|
||||
dev_res->qp_tbl.used);
|
||||
monitor_printf(mon, "\tCQs : %" PRId32 "\n",
|
||||
g_string_append_printf(buf, "\tCQs : %" PRId32 "\n",
|
||||
dev_res->cq_tbl.used);
|
||||
monitor_printf(mon, "\tCEQ_CTXs : %" PRId32 "\n",
|
||||
g_string_append_printf(buf, "\tCEQ_CTXs : %" PRId32 "\n",
|
||||
dev_res->cqe_ctx_tbl.used);
|
||||
}
|
||||
|
||||
|
@ -92,6 +92,6 @@ static inline union ibv_gid *rdma_rm_get_gid(RdmaDeviceResources *dev_res,
|
||||
{
|
||||
return &dev_res->port.gid_tbl[sgid_idx].gid;
|
||||
}
|
||||
void rdma_dump_device_counters(Monitor *mon, RdmaDeviceResources *dev_res);
|
||||
void rdma_format_device_counters(RdmaDeviceResources *dev_res, GString *buf);
|
||||
|
||||
#endif
|
||||
|
@ -58,24 +58,25 @@ static Property pvrdma_dev_properties[] = {
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
static void pvrdma_print_statistics(Monitor *mon, RdmaProvider *obj)
|
||||
static void pvrdma_format_statistics(RdmaProvider *obj, GString *buf)
|
||||
{
|
||||
PVRDMADev *dev = PVRDMA_DEV(obj);
|
||||
PCIDevice *pdev = PCI_DEVICE(dev);
|
||||
|
||||
monitor_printf(mon, "%s, %x.%x\n", pdev->name, PCI_SLOT(pdev->devfn),
|
||||
g_string_append_printf(buf, "%s, %x.%x\n",
|
||||
pdev->name, PCI_SLOT(pdev->devfn),
|
||||
PCI_FUNC(pdev->devfn));
|
||||
monitor_printf(mon, "\tcommands : %" PRId64 "\n",
|
||||
g_string_append_printf(buf, "\tcommands : %" PRId64 "\n",
|
||||
dev->stats.commands);
|
||||
monitor_printf(mon, "\tregs_reads : %" PRId64 "\n",
|
||||
g_string_append_printf(buf, "\tregs_reads : %" PRId64 "\n",
|
||||
dev->stats.regs_reads);
|
||||
monitor_printf(mon, "\tregs_writes : %" PRId64 "\n",
|
||||
g_string_append_printf(buf, "\tregs_writes : %" PRId64 "\n",
|
||||
dev->stats.regs_writes);
|
||||
monitor_printf(mon, "\tuar_writes : %" PRId64 "\n",
|
||||
g_string_append_printf(buf, "\tuar_writes : %" PRId64 "\n",
|
||||
dev->stats.uar_writes);
|
||||
monitor_printf(mon, "\tinterrupts : %" PRId64 "\n",
|
||||
g_string_append_printf(buf, "\tinterrupts : %" PRId64 "\n",
|
||||
dev->stats.interrupts);
|
||||
rdma_dump_device_counters(mon, &dev->rdma_dev_res);
|
||||
rdma_format_device_counters(&dev->rdma_dev_res, buf);
|
||||
}
|
||||
|
||||
static void free_dev_ring(PCIDevice *pci_dev, PvrdmaRing *ring,
|
||||
@ -699,7 +700,7 @@ static void pvrdma_class_init(ObjectClass *klass, void *data)
|
||||
device_class_set_props(dc, pvrdma_dev_properties);
|
||||
set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
|
||||
|
||||
ir->print_statistics = pvrdma_print_statistics;
|
||||
ir->format_statistics = pvrdma_format_statistics;
|
||||
}
|
||||
|
||||
static const TypeInfo pvrdma_info = {
|
||||
|
@ -31,7 +31,7 @@ typedef struct RdmaProvider RdmaProvider;
|
||||
struct RdmaProviderClass {
|
||||
InterfaceClass parent;
|
||||
|
||||
void (*print_statistics)(Monitor *mon, RdmaProvider *obj);
|
||||
void (*format_statistics)(RdmaProvider *obj, GString *buf);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -54,7 +54,6 @@
|
||||
#include "qemu/error-report.h"
|
||||
#include "exec/ramlist.h"
|
||||
#include "hw/intc/intc.h"
|
||||
#include "hw/rdma/rdma.h"
|
||||
#include "migration/snapshot.h"
|
||||
#include "migration/misc.h"
|
||||
|
||||
@ -850,32 +849,6 @@ void hmp_info_pic(Monitor *mon, const QDict *qdict)
|
||||
hmp_info_pic_foreach, mon);
|
||||
}
|
||||
|
||||
static int hmp_info_rdma_foreach(Object *obj, void *opaque)
|
||||
{
|
||||
RdmaProvider *rdma;
|
||||
RdmaProviderClass *k;
|
||||
Monitor *mon = opaque;
|
||||
|
||||
if (object_dynamic_cast(obj, INTERFACE_RDMA_PROVIDER)) {
|
||||
rdma = RDMA_PROVIDER(obj);
|
||||
k = RDMA_PROVIDER_GET_CLASS(obj);
|
||||
if (k->print_statistics) {
|
||||
k->print_statistics(mon, rdma);
|
||||
} else {
|
||||
monitor_printf(mon, "RDMA statistics not available for %s.\n",
|
||||
object_get_typename(obj));
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void hmp_info_rdma(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
object_child_foreach_recursive(object_get_root(),
|
||||
hmp_info_rdma_foreach, mon);
|
||||
}
|
||||
|
||||
void hmp_info_pci(Monitor *mon, const QDict *qdict)
|
||||
{
|
||||
PciInfoList *info_list, *info;
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "hw/mem/memory-device.h"
|
||||
#include "hw/acpi/acpi_dev_interface.h"
|
||||
#include "hw/rdma/rdma.h"
|
||||
|
||||
NameInfo *qmp_query_name(Error **errp)
|
||||
{
|
||||
@ -382,3 +383,34 @@ HumanReadableText *qmp_x_query_profile(Error **errp)
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int qmp_x_query_rdma_foreach(Object *obj, void *opaque)
|
||||
{
|
||||
RdmaProvider *rdma;
|
||||
RdmaProviderClass *k;
|
||||
GString *buf = opaque;
|
||||
|
||||
if (object_dynamic_cast(obj, INTERFACE_RDMA_PROVIDER)) {
|
||||
rdma = RDMA_PROVIDER(obj);
|
||||
k = RDMA_PROVIDER_GET_CLASS(obj);
|
||||
if (k->format_statistics) {
|
||||
k->format_statistics(rdma, buf);
|
||||
} else {
|
||||
g_string_append_printf(buf,
|
||||
"RDMA statistics not available for %s.\n",
|
||||
object_get_typename(obj));
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
HumanReadableText *qmp_x_query_rdma(Error **errp)
|
||||
{
|
||||
g_autoptr(GString) buf = g_string_new("");
|
||||
|
||||
object_child_foreach_recursive(object_get_root(),
|
||||
qmp_x_query_rdma_foreach, buf);
|
||||
|
||||
return human_readable_text_from_str(buf);
|
||||
}
|
||||
|
@ -1436,6 +1436,18 @@
|
||||
{ 'command': 'x-query-profile',
|
||||
'returns': 'HumanReadableText' }
|
||||
|
||||
##
|
||||
# @x-query-rdma:
|
||||
#
|
||||
# Query RDMA state
|
||||
#
|
||||
# Returns: RDMA state
|
||||
#
|
||||
# Since: 6.2
|
||||
##
|
||||
{ 'command': 'x-query-rdma',
|
||||
'returns': 'HumanReadableText' }
|
||||
|
||||
##
|
||||
# @x-query-roms:
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user