Skip to content

Commit

Permalink
Merge tag 'vfio-ccw-20191111' of https://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/kernel/git/kvms390/vfio-ccw into features

enhance tracing in vfio-ccw

* tag 'vfio-ccw-20191111' of https://git.kernel.org/pub/scm/linux/kernel/git/kvms390/vfio-ccw:
  vfio-ccw: Rework the io_fctl trace
  vfio-ccw: Add a trace for asynchronous requests
  vfio-ccw: Trace the FSM jumptable
  vfio-ccw: Refactor how the traces are built

Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
  • Loading branch information
Vasily Gorbik committed Nov 12, 2019
2 parents 544f1d6 + 8529888 commit 4ff4ba1
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 14 deletions.
4 changes: 2 additions & 2 deletions drivers/s390/cio/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# The following is required for define_trace.h to find ./trace.h
CFLAGS_trace.o := -I$(src)
CFLAGS_vfio_ccw_fsm.o := -I$(src)
CFLAGS_vfio_ccw_trace.o := -I$(src)

obj-y += airq.o blacklist.o chsc.o cio.o css.o chp.o idset.o isc.o \
fcx.o itcw.o crw.o ccwreq.o trace.o ioasm.o
Expand All @@ -21,5 +21,5 @@ qdio-objs := qdio_main.o qdio_thinint.o qdio_debug.o qdio_setup.o
obj-$(CONFIG_QDIO) += qdio.o

vfio_ccw-objs += vfio_ccw_drv.o vfio_ccw_cp.o vfio_ccw_ops.o vfio_ccw_fsm.o \
vfio_ccw_async.o
vfio_ccw_async.o vfio_ccw_trace.o
obj-$(CONFIG_VFIO_CCW) += vfio_ccw.o
1 change: 1 addition & 0 deletions drivers/s390/cio/vfio_ccw_cp.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <asm/scsw.h>

#include "orb.h"
#include "vfio_ccw_trace.h"

/*
* Max length for ccw chain.
Expand Down
11 changes: 6 additions & 5 deletions drivers/s390/cio/vfio_ccw_fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
#include "ioasm.h"
#include "vfio_ccw_private.h"

#define CREATE_TRACE_POINTS
#include "vfio_ccw_trace.h"

static int fsm_io_helper(struct vfio_ccw_private *private)
{
struct subchannel *sch;
Expand Down Expand Up @@ -321,8 +318,8 @@ static void fsm_io_request(struct vfio_ccw_private *private,
}

err_out:
trace_vfio_ccw_io_fctl(scsw->cmd.fctl, schid,
io_region->ret_code, errstr);
trace_vfio_ccw_fsm_io_request(scsw->cmd.fctl, schid,
io_region->ret_code, errstr);
}

/*
Expand All @@ -344,6 +341,10 @@ static void fsm_async_request(struct vfio_ccw_private *private,
/* should not happen? */
cmd_region->ret_code = -EINVAL;
}

trace_vfio_ccw_fsm_async_request(get_schid(private),
cmd_region->command,
cmd_region->ret_code);
}

/*
Expand Down
1 change: 1 addition & 0 deletions drivers/s390/cio/vfio_ccw_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ extern fsm_func_t *vfio_ccw_jumptable[NR_VFIO_CCW_STATES][NR_VFIO_CCW_EVENTS];
static inline void vfio_ccw_fsm_event(struct vfio_ccw_private *private,
int event)
{
trace_vfio_ccw_fsm_event(private->sch->schid, private->state, event);
vfio_ccw_jumptable[private->state][event](private, event);
}

Expand Down
14 changes: 14 additions & 0 deletions drivers/s390/cio/vfio_ccw_trace.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Tracepoint definitions for vfio_ccw
*
* Copyright IBM Corp. 2019
* Author(s): Eric Farman <farman@linux.ibm.com>
*/

#define CREATE_TRACE_POINTS
#include "vfio_ccw_trace.h"

EXPORT_TRACEPOINT_SYMBOL(vfio_ccw_fsm_async_request);
EXPORT_TRACEPOINT_SYMBOL(vfio_ccw_fsm_event);
EXPORT_TRACEPOINT_SYMBOL(vfio_ccw_fsm_io_request);
76 changes: 69 additions & 7 deletions drivers/s390/cio/vfio_ccw_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* Halil Pasic <pasic@linux.vnet.ibm.com>
*/

#include "cio.h"

#undef TRACE_SYSTEM
#define TRACE_SYSTEM vfio_ccw

Expand All @@ -15,28 +17,88 @@

#include <linux/tracepoint.h>

TRACE_EVENT(vfio_ccw_io_fctl,
TRACE_EVENT(vfio_ccw_fsm_async_request,
TP_PROTO(struct subchannel_id schid,
int command,
int errno),
TP_ARGS(schid, command, errno),

TP_STRUCT__entry(
__field(u8, cssid)
__field(u8, ssid)
__field(u16, sch_no)
__field(int, command)
__field(int, errno)
),

TP_fast_assign(
__entry->cssid = schid.cssid;
__entry->ssid = schid.ssid;
__entry->sch_no = schid.sch_no;
__entry->command = command;
__entry->errno = errno;
),

TP_printk("schid=%x.%x.%04x command=0x%x errno=%d",
__entry->cssid,
__entry->ssid,
__entry->sch_no,
__entry->command,
__entry->errno)
);

TRACE_EVENT(vfio_ccw_fsm_event,
TP_PROTO(struct subchannel_id schid, int state, int event),
TP_ARGS(schid, state, event),

TP_STRUCT__entry(
__field(u8, cssid)
__field(u8, ssid)
__field(u16, schno)
__field(int, state)
__field(int, event)
),

TP_fast_assign(
__entry->cssid = schid.cssid;
__entry->ssid = schid.ssid;
__entry->schno = schid.sch_no;
__entry->state = state;
__entry->event = event;
),

TP_printk("schid=%x.%x.%04x state=%d event=%d",
__entry->cssid, __entry->ssid, __entry->schno,
__entry->state,
__entry->event)
);

TRACE_EVENT(vfio_ccw_fsm_io_request,
TP_PROTO(int fctl, struct subchannel_id schid, int errno, char *errstr),
TP_ARGS(fctl, schid, errno, errstr),

TP_STRUCT__entry(
__field(u8, cssid)
__field(u8, ssid)
__field(u16, sch_no)
__field(int, fctl)
__field_struct(struct subchannel_id, schid)
__field(int, errno)
__field(char*, errstr)
),

TP_fast_assign(
__entry->cssid = schid.cssid;
__entry->ssid = schid.ssid;
__entry->sch_no = schid.sch_no;
__entry->fctl = fctl;
__entry->schid = schid;
__entry->errno = errno;
__entry->errstr = errstr;
),

TP_printk("schid=%x.%x.%04x fctl=%x errno=%d info=%s",
__entry->schid.cssid,
__entry->schid.ssid,
__entry->schid.sch_no,
TP_printk("schid=%x.%x.%04x fctl=0x%x errno=%d info=%s",
__entry->cssid,
__entry->ssid,
__entry->sch_no,
__entry->fctl,
__entry->errno,
__entry->errstr)
Expand Down

0 comments on commit 4ff4ba1

Please sign in to comment.