mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
s390/ap: Introduce new AP nqap and dqap trace events
Introduce two new AP bus related tracepoint events: - There is a tracepoint s390_ap_nqap event immediately after a request has been pushed into the AP firmware queue with the NQAP AP command. - The other tracepoint s390_ap_dqap event fires immediately after a reply has been pulled out of the AP firmware queue via DQAP AP command. Both events are triggered unconditional and may need filtering. Filtering can be done based on the status value which is part of the nqap and dqap trace. So for example a echo "!(status & 0x00ff0000)" >.../s390_ap_dqap/filter filters out all trace events which have a response_code != 0 leaving just the successful nqap and dqap invocations. The idea of these two trace events focuses on performance to measure the runtime of a crypto request/reply as close as possible at the firmware level. In combination with the two zcrypt tracepoints (see the zcrypt.h trace event definition file) this gives measurement data about the runtime of a request/reply within the zcrpyt and AP bus layer. However, with having the status of these AP commands in hand also other usage may be possible. Signed-off-by: Harald Freudenberger <freude@linux.ibm.com> Reviewed-by: Holger Dengler <dengler@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
This commit is contained in:
committed by
Heiko Carstens
parent
7f124d78d4
commit
9c11918040
87
arch/s390/include/asm/trace/ap.h
Normal file
87
arch/s390/include/asm/trace/ap.h
Normal file
@@ -0,0 +1,87 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
/*
|
||||
* Tracepoint definitions for s390 ap bus related trace events
|
||||
*
|
||||
* There are two AP bus related tracepoint events defined here:
|
||||
* There is a tracepoint s390_ap_nqap event immediately after a request
|
||||
* has been pushed into the AP firmware queue with the NQAP AP command.
|
||||
* The other tracepoint s390_ap_dqap event fires immediately after a
|
||||
* reply has been pulled out of the AP firmware queue via DQAP AP command.
|
||||
* The idea of these two trace events focuses on performance to measure
|
||||
* the runtime of a crypto request/reply as close as possible at the
|
||||
* firmware level. In combination with the two zcrypt tracepoints (see the
|
||||
* zcrypt.h trace event definition file) this gives measurement data about
|
||||
* the runtime of a request/reply within the zcrpyt and AP bus layer.
|
||||
*/
|
||||
|
||||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM s390
|
||||
|
||||
#if !defined(_TRACE_S390_AP_H) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define _TRACE_S390_AP_H
|
||||
|
||||
#include <linux/tracepoint.h>
|
||||
|
||||
DECLARE_EVENT_CLASS(s390_ap_nqapdqap_template,
|
||||
TP_PROTO(u16 card, u16 dom, u32 status, u64 psmid),
|
||||
TP_ARGS(card, dom, status, psmid),
|
||||
TP_STRUCT__entry(
|
||||
__field(u16, card)
|
||||
__field(u16, dom)
|
||||
__field(u32, status)
|
||||
__field(u64, psmid)),
|
||||
TP_fast_assign(
|
||||
__entry->card = card;
|
||||
__entry->dom = dom;
|
||||
__entry->status = status;
|
||||
__entry->psmid = psmid;),
|
||||
TP_printk("card=%u dom=%u status=0x%08x psmid=0x%016lx",
|
||||
(unsigned short)__entry->card,
|
||||
(unsigned short)__entry->dom,
|
||||
(unsigned int)__entry->status,
|
||||
(unsigned long)__entry->psmid)
|
||||
);
|
||||
|
||||
/**
|
||||
* trace_s390_ap_nqap - ap msg nqap tracepoint function
|
||||
* @card: Crypto card number addressed.
|
||||
* @dom: Domain within the crypto card addressed.
|
||||
* @status: AP queue status (GR1 on return of nqap).
|
||||
* @psmid: Unique id identifying this request/reply.
|
||||
*
|
||||
* Called immediately after a request has been enqueued into
|
||||
* the AP firmware queue with the NQAP command.
|
||||
*/
|
||||
DEFINE_EVENT(s390_ap_nqapdqap_template,
|
||||
s390_ap_nqap,
|
||||
TP_PROTO(u16 card, u16 dom, u32 status, u64 psmid),
|
||||
TP_ARGS(card, dom, status, psmid)
|
||||
);
|
||||
|
||||
/**
|
||||
* trace_s390_ap_dqap - ap msg dqap tracepoint function
|
||||
* @card: Crypto card number addressed.
|
||||
* @dom: Domain within the crypto card addressed.
|
||||
* @status: AP queue status (GR1 on return of dqap).
|
||||
* @psmid: Unique id identifying this request/reply.
|
||||
*
|
||||
* Called immediately after a reply has been dequeued from
|
||||
* the AP firmware queue with the DQAP command.
|
||||
*/
|
||||
DEFINE_EVENT(s390_ap_nqapdqap_template,
|
||||
s390_ap_dqap,
|
||||
TP_PROTO(u16 card, u16 dom, u32 status, u64 psmid),
|
||||
TP_ARGS(card, dom, status, psmid)
|
||||
);
|
||||
|
||||
#endif /* _TRACE_S390_AP_H */
|
||||
|
||||
/* This part must be outside protection */
|
||||
|
||||
#undef TRACE_INCLUDE_PATH
|
||||
#undef TRACE_INCLUDE_FILE
|
||||
|
||||
#define TRACE_INCLUDE_PATH asm/trace
|
||||
#define TRACE_INCLUDE_FILE ap
|
||||
|
||||
#include <trace/define_trace.h>
|
||||
@@ -14,9 +14,15 @@
|
||||
#include <linux/slab.h>
|
||||
#include <asm/facility.h>
|
||||
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include <asm/trace/ap.h>
|
||||
|
||||
#include "ap_bus.h"
|
||||
#include "ap_debug.h"
|
||||
|
||||
EXPORT_TRACEPOINT_SYMBOL(s390_ap_nqap);
|
||||
EXPORT_TRACEPOINT_SYMBOL(s390_ap_dqap);
|
||||
|
||||
static void __ap_flush_queue(struct ap_queue *aq);
|
||||
|
||||
/*
|
||||
@@ -98,9 +104,17 @@ static inline struct ap_queue_status
|
||||
__ap_send(ap_qid_t qid, unsigned long psmid, void *msg, size_t msglen,
|
||||
int special)
|
||||
{
|
||||
struct ap_queue_status status;
|
||||
|
||||
if (special)
|
||||
qid |= 0x400000UL;
|
||||
return ap_nqap(qid, psmid, msg, msglen);
|
||||
|
||||
status = ap_nqap(qid, psmid, msg, msglen);
|
||||
|
||||
trace_s390_ap_nqap(AP_QID_CARD(qid), AP_QID_QUEUE(qid),
|
||||
status.value, psmid);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/* State machine definitions and helpers */
|
||||
@@ -140,6 +154,9 @@ static struct ap_queue_status ap_sm_recv(struct ap_queue *aq)
|
||||
parts++;
|
||||
} while (status.response_code == 0xFF && resgr0 != 0);
|
||||
|
||||
trace_s390_ap_dqap(AP_QID_CARD(aq->qid), AP_QID_QUEUE(aq->qid),
|
||||
status.value, aq->reply->psmid);
|
||||
|
||||
switch (status.response_code) {
|
||||
case AP_RESPONSE_NORMAL:
|
||||
print_hex_dump_debug("aprpl: ", DUMP_PREFIX_ADDRESS, 16, 1,
|
||||
|
||||
Reference in New Issue
Block a user