From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA0A7C433E0 for ; Tue, 9 Feb 2021 15:59:48 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3310264E6F for ; Tue, 9 Feb 2021 15:59:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3310264E6F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=goodmis.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/aTnh4ikiiwwjZNJBZsgQQI2oIXZhWk49RAG4lnD+jg=; b=EG1DwtL5UQPOO5dCkcOYuVRhV asEl58AE7eGXu2rVQAVG1nQIXk+xBwUVeJ/Fa0lo0Ki+5EATGt9lHwXSRvoUGMDfHwMQazLjRBXjA NiVnvcjoXFr42IkxtDH+fvoB2tzhdIWURw3OoYVdRNRKMzSotKbqSrFAJyGj8jtnZSVGXXP45vPTb dENzIXARw1jD8Ar3iLEWqOxscZGNUEHtLDMFE/0HGVAOdPF9ddpi2mdG5Tb4TVYawZgu0pq4IzLtG O6Kdz17N0xiFsQvgNHo9zowoJikI6h8bjQORoLIBQ1MXZ6IRKO1uZFhJHKsELbepXx+aGUD2mDuC4 3k4HiJWew==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l9VPa-0003dJ-1H; Tue, 09 Feb 2021 15:58:46 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l9VPV-0003cY-F5 for linux-arm-kernel@lists.infradead.org; Tue, 09 Feb 2021 15:58:44 +0000 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C677664E8A; Tue, 9 Feb 2021 15:58:39 +0000 (UTC) Date: Tue, 9 Feb 2021 10:58:38 -0500 From: Steven Rostedt To: Jisheng Zhang Subject: Re: [PATCH] tee: optee: add invoke_fn tracepoints Message-ID: <20210209105838.5fcb31ac@gandalf.local.home> In-Reply-To: <20210209190215.337b3d0f@xhacker.debian> References: <20210209190215.337b3d0f@xhacker.debian> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210209_105841_658675_086F2C7C X-CRM114-Status: GOOD ( 22.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: op-tee@lists.trustedfirmware.org, Jens Wiklander , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, 9 Feb 2021 19:02:15 +0800 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 > --- > drivers/tee/optee/call.c | 4 ++ > drivers/tee/optee/optee_trace.h | 65 +++++++++++++++++++++++++++++++++ > 2 files changed, 69 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..9dbab10e7ac3 100644 > --- a/drivers/tee/optee/call.c > +++ b/drivers/tee/optee/call.c > @@ -12,6 +12,8 @@ > #include > #include > #include > +#define CREATE_TRACE_POINTS > +#include "optee_trace.h" > #include "optee_private.h" > #include "optee_smc.h" > > @@ -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..f209df7004c2 > --- /dev/null > +++ b/drivers/tee/optee/optee_trace.h > @@ -0,0 +1,65 @@ > +/* 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" > + > +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; > + memcpy(__entry->args, param, sizeof(__entry->args)); I wonder if you should add a: BUILD_BUG_ON(sizeof(param) < sizeof(__entry->args)); here. > + ), > + > + 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; > + memcpy(__entry->rets, res, sizeof(__entry->rets)); and a: BUILD_BUG_ON(sizeof(res) < sizeof(__entry->rets)); here Just to make sure that the size of what is being copied, is not smaller than the amount being copied. -- Steve > + ), > + > + 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel