Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2186281pxb; Tue, 23 Feb 2021 00:06:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJzx5eNiZ9qHyeDjPPT/jm5Sjvu+5hbnhFgwwjv5R1bHEJNRpJBTlie7guq7HUoG4Y2+dOvH X-Received: by 2002:a17:906:3b48:: with SMTP id h8mr17478176ejf.477.1614067584087; Tue, 23 Feb 2021 00:06:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614067584; cv=none; d=google.com; s=arc-20160816; b=eMAM6BOPGBKv361Lrw/oxvSCect1VHBjQEojhBkvSE0kW6ngZXwhHkPOL+faSdkjQH i5BPIcDgHqGN0334jC3svG4vx7ncwUt1mkzw4ImHAIPxel1i5dYNHBK3INBzXai785xj AVr3B9yssKAS+zjSBC/ve83ZuRLgiv2UTQhZakNCD3jImE+PJVsiNgK4kbTmEpJENNuY zq4CovKpXstUgHWdKZ16Bz+qncOiEFsYNIPhNH8NBXLAtNZeao6ibAT+Q4ZqMYOAOf9f 9mmyjrT4tewRinJaXqHUl9gKjmYUZV4ySf4t8TLL/eiBtnUlkGHUtWV4WcxDMoHGr5dl KBWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=cZyNLjSL1B6qwkY7yL9AfgZbdVB6v/72Ioh+4lurV0s=; b=cNLflC60zBCGb971GOHGPbRUFyYGi3iKEd0he1aV+/koUefi3d4tLc7Py4FXDGcm2Y 8Z4K3p4Z1tXDkk/0m7WyeLoteu+gELomDzpoudrzoCGnPcss5GwYQWRvJoiE80u2wUtK tF0Dwl9tznL3yas+I6oWH054Cgzr3iQs7HDkWkg2WIhuyOhmSzEjW1PmDW9P3MFlHwP5 u/XgAIZ4CNcVYTJshFI89Err379SZfHiQGu1sYcD8q0ac0vfphx4hg3tYHd3HVWqRUcW e1uCbu5LDu6PLgIFdvrICv92abs8p8bOQqm2Vdsg6ajtp9CBYep5QyQd+AgnKFXCCNnS O9UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JUYmbOYH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f17si13409347edw.291.2021.02.23.00.05.54; Tue, 23 Feb 2021 00:06:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JUYmbOYH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232000AbhBWIAP (ORCPT + 99 others); Tue, 23 Feb 2021 03:00:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229961AbhBWIAO (ORCPT ); Tue, 23 Feb 2021 03:00:14 -0500 Received: from mail-ot1-x32a.google.com (mail-ot1-x32a.google.com [IPv6:2607:f8b0:4864:20::32a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2784C061574 for ; Mon, 22 Feb 2021 23:59:33 -0800 (PST) Received: by mail-ot1-x32a.google.com with SMTP id b16so14748368otq.1 for ; Mon, 22 Feb 2021 23:59:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cZyNLjSL1B6qwkY7yL9AfgZbdVB6v/72Ioh+4lurV0s=; b=JUYmbOYHkcAy8+cvIRRK9zxSqq+6gCJmpzOC0XY716RSoI9Bp2T1BZPmfPzdpjG5FK cgqz+A1qv1Niz0w48pyesI6ZDue9oKjILx4F3hoNIySoZeM7cZIn5PVI+/f6BNdpLGpD KtHegHNJLztezNRR3YnMq/fPibdEyLTOgbWOnutH18zyFVKzEVP1sw8HbTJDlapqQEFY uKY0YE++Et0NflCn11zWcCCO3vDkeRelDEcuCVWwiW44nDQxqrZVXeYsVMArRwPVe5PJ qC9XrFcQHBmDe6g7OeKf8juWaqe4kJ40sChNbBpa+N1ecS2r4itZMbZCI8ZotXniLWOI HSSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cZyNLjSL1B6qwkY7yL9AfgZbdVB6v/72Ioh+4lurV0s=; b=WSeKuc3q6mkUHqGgyOUAxP6fD3q6ng2/7mESGfz5T0S2dTDQpjQycc+ztvDBZPVMz8 aHi+M7yWQkqqT5fcAt1oqcGJ8CqT4Be6+75RFTv6+qgTJpEWlp7jER4ABnwco8418PjK dDV7WGkIgsb8VFBfV15MlnzFK52Uw+9xVsKj56QT5bUjl2V+iSPXetsVU+9lLD9v+0cL McTttXibhlcW6b5s11K9UdeUH8cFmNJvw5SYnBwCFuXKS1hTr1FnlaHcM5WemxTI5Tgh dhFsEJT7IAVlPK29kEq/uwfglgghRWW17t/qdYYdO8wTBoVLdpv8yqOAWql4ocpPx0P9 13/g== X-Gm-Message-State: AOAM533DFPhQSSwxe6HtLEmDRkENG8ouuHWU6JRJ6icYQOIRqmrufGGo SFj19wV2TMnv3AexJY+9GFvfqcclaKoe70qaQ9wV5Q== X-Received: by 2002:a05:6830:1352:: with SMTP id r18mr6620863otq.283.1614067173106; Mon, 22 Feb 2021 23:59:33 -0800 (PST) MIME-Version: 1.0 References: <20210210144409.36ecdaed@xhacker.debian> In-Reply-To: <20210210144409.36ecdaed@xhacker.debian> From: Jens Wiklander Date: Tue, 23 Feb 2021 08:59:22 +0100 Message-ID: Subject: Re: [PATCH] tee: optee: add invoke_fn tracepoints To: Jisheng Zhang Cc: "Steven Rostedt (VMware)" , Linux Kernel Mailing List , op-tee@lists.trustedfirmware.org, Linux ARM Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jisheng, On Wed, Feb 10, 2021 at 7:44 AM Jisheng Zhang wrote: > > Add tracepoints to retrieve information about the invoke_fn. This would > help to measure how many invoke_fn are triggered and how long it takes > to complete one invoke_fn call. > > Signed-off-by: Jisheng Zhang > --- > > Since v1: > - add BUILD_BUG_ON() macro usage to make sure that the size of what is being > copied, is not smaller than the amount being copied. Thank Steve. > - move optee_trace.h to keep include headers sorted > > drivers/tee/optee/call.c | 4 ++ > drivers/tee/optee/optee_trace.h | 67 +++++++++++++++++++++++++++++++++ > 2 files changed, 71 insertions(+) > create mode 100644 drivers/tee/optee/optee_trace.h > > diff --git a/drivers/tee/optee/call.c b/drivers/tee/optee/call.c > index 780d7c4fd756..0da6fe50f1af 100644 > --- a/drivers/tee/optee/call.c > +++ b/drivers/tee/optee/call.c > @@ -14,6 +14,8 @@ > #include > #include "optee_private.h" > #include "optee_smc.h" > +#define CREATE_TRACE_POINTS > +#include "optee_trace.h" > > struct optee_call_waiter { > struct list_head list_node; > @@ -138,9 +140,11 @@ u32 optee_do_call_with_arg(struct tee_context *ctx, phys_addr_t parg) > while (true) { > struct arm_smccc_res res; > > + trace_optee_invoke_fn_begin(¶m); > optee->invoke_fn(param.a0, param.a1, param.a2, param.a3, > param.a4, param.a5, param.a6, param.a7, > &res); > + trace_optee_invoke_fn_end(¶m, &res); > > if (res.a0 == OPTEE_SMC_RETURN_ETHREAD_LIMIT) { > /* > diff --git a/drivers/tee/optee/optee_trace.h b/drivers/tee/optee/optee_trace.h > new file mode 100644 > index 000000000000..7c954eefa4bf > --- /dev/null > +++ b/drivers/tee/optee/optee_trace.h > @@ -0,0 +1,67 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +/* > + * optee trace points > + * > + * Copyright (C) 2021 Synaptics Incorporated > + * Author: Jisheng Zhang > + */ > + > +#undef TRACE_SYSTEM > +#define TRACE_SYSTEM optee > + > +#if !defined(_TRACE_OPTEE_H) || defined(TRACE_HEADER_MULTI_READ) > +#define _TRACE_OPTEE_H > + > +#include > +#include > +#include "optee_private.h" > + Checkpatch has some complaints below. Is that something that could be fixed or is this so far from regular C-syntax that we don't care? Thanks, Jens > +TRACE_EVENT(optee_invoke_fn_begin, > + TP_PROTO(struct optee_rpc_param *param), > + TP_ARGS(param), > + > + TP_STRUCT__entry( > + __field(void *, param) > + __array(u32, args, 8) > + ), > + > + TP_fast_assign( > + __entry->param = param; > + BUILD_BUG_ON(sizeof(*param) < sizeof(__entry->args)); > + memcpy(__entry->args, param, sizeof(__entry->args)); > + ), > + > + TP_printk("param=%p (%x, %x, %x, %x, %x, %x, %x, %x)", __entry->param, > + __entry->args[0], __entry->args[1], __entry->args[2], > + __entry->args[3], __entry->args[4], __entry->args[5], > + __entry->args[6], __entry->args[7]) > +); > + > +TRACE_EVENT(optee_invoke_fn_end, > + TP_PROTO(struct optee_rpc_param *param, struct arm_smccc_res *res), > + TP_ARGS(param, res), > + > + TP_STRUCT__entry( > + __field(void *, param) > + __array(unsigned long, rets, 4) > + ), > + > + TP_fast_assign( > + __entry->param = param; > + BUILD_BUG_ON(sizeof(*res) < sizeof(__entry->rets)); > + memcpy(__entry->rets, res, sizeof(__entry->rets)); > + ), > + > + TP_printk("param=%p ret (%lx, %lx, %lx, %lx)", __entry->param, > + __entry->rets[0], __entry->rets[1], __entry->rets[2], > + __entry->rets[3]) > +); > +#endif /* _TRACE_OPTEE_H */ > + > +#undef TRACE_INCLUDE_PATH > +#define TRACE_INCLUDE_PATH . > +#undef TRACE_INCLUDE_FILE > +#define TRACE_INCLUDE_FILE optee_trace > + > +/* This part must be outside protection */ > +#include > -- > 2.30.0 >