From nobody Tue Jun 30 08:12:00 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BFDDC433F5 for ; Sat, 22 Jan 2022 00:13:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230052AbiAVANr (ORCPT ); Fri, 21 Jan 2022 19:13:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229951AbiAVANp (ORCPT ); Fri, 21 Jan 2022 19:13:45 -0500 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 979C3C06173B for ; Fri, 21 Jan 2022 16:13:45 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id g9-20020a17090a67c900b001b4f1d71e4fso10398388pjm.4 for ; Fri, 21 Jan 2022 16:13:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=IXTMdXv8lFf4FOkEhwBgmSX3gJaS9QGnq6wiUqWC7ik=; b=Z7KcFb4RDbFQGTVywLff8/IPX3ONqQ1krFZY1nAiPEDGWDIXs+6KjifdFMtoYTAFra U3PkbqscOPnNbSyM7FTojLUgQcje6KBs6lpLGy9lraSPj904CZq+w/vWvPxswjs9PJzu 6Ln6RwwIrB22FoOeb2VxWMEAfWTFsr25iUVI8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=IXTMdXv8lFf4FOkEhwBgmSX3gJaS9QGnq6wiUqWC7ik=; b=UV2yyyz5zmX9Clmqpb8qwMNSv8/yuvT42pnUCpAv39pJIb3MiVePR9agoYFdzh3nR0 p/Qt03HzcK1v7E9/NMBSNmUq50IWTfGnqMc6KHTVXgualfYuU7QhYFO5tmL4+xCOGXbe p7Tjf3LI7Ye8lZs0AB300gaAXr7TolElh/iX0KptMaAMtFk7AYishfyp7rG5OYhj7068 9gcxZhFRFCc/+BeS5Zkwaj5PO3lRatu9hUCivoFymZ1n+FdL11BDCILEawJ3DzLGyHYm wz7AdinJkCUSaOpWzr/u9Fx6Ok2+sZItT6B+EJzbLqIBxgN7jcN8D2C4aCXzNgwKlhEI xh6A== X-Gm-Message-State: AOAM533Hs0d70xIaTU9gik7LeKeb7fb2plIkmgqxh4fBdGenevJTsLNf hbtu0TV7IfowQwihpbHeV5mIig== X-Google-Smtp-Source: ABdhPJzRJQXVuUCrD7VANcU+1dl4A3fS0FL9JRD2nbR2AVNLlTErZ6ZOhwaR+qeugLKnYMGFZAr4zQ== X-Received: by 2002:a17:90a:4a82:: with SMTP id f2mr2945291pjh.127.1642810424955; Fri, 21 Jan 2022 16:13:44 -0800 (PST) Received: from localhost ([2620:15c:202:201:7f3c:22b1:29ba:4ce6]) by smtp.gmail.com with UTF8SMTPSA id c13sm8396103pfv.58.2022.01.21.16.13.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 21 Jan 2022 16:13:44 -0800 (PST) From: Gwendal Grignou To: bleung@chromium.org, groeck@chromium.org Cc: linux-kernel@vger.kernel.org, Gwendal Grignou , stable@vger.kernel.org Subject: [PATCH v2] platform: chrome: Split trace include file Date: Fri, 21 Jan 2022 16:13:01 -0800 Message-Id: <20220122001301.640337-1-gwendal@chromium.org> X-Mailer: git-send-email 2.35.0.rc0.227.g00780c9af4-goog MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" cros_ec_trace.h defined 5 tracing events, 2 for cros_ec_proto and 3 for cros_ec_sensorhub_ring. These 2 files are in different kernel modules, the traces are defined twice in the kernel which leads to problem enabling only some traces. Move sensorhub traces from cros_ec_trace.h to cros_ec_sensorhub_trace.h and enable them only in cros_ec_sensorhub kernel module. Check we can now enable any single traces: without this patch, we can only enable all sensorhub traces or none. Fixes: d453ceb65 ("platform/chrome: sensorhub: Add trace events for sample") Signed-off-by: Gwendal Grignou Cc: stable@vger.kernel.org --- Changes since v1: CC to stable, define the bug scope. drivers/platform/chrome/Makefile | 3 +- .../platform/chrome/cros_ec_sensorhub_ring.c | 3 +- .../platform/chrome/cros_ec_sensorhub_trace.h | 123 ++++++++++++++++++ drivers/platform/chrome/cros_ec_trace.h | 95 -------------- 4 files changed, 127 insertions(+), 97 deletions(-) create mode 100644 drivers/platform/chrome/cros_ec_sensorhub_trace.h diff --git a/drivers/platform/chrome/Makefile b/drivers/platform/chrome/Mak= efile index f901d2e43166c3..88cbc434c06b22 100644 --- a/drivers/platform/chrome/Makefile +++ b/drivers/platform/chrome/Makefile @@ -2,6 +2,7 @@ =20 # tell define_trace.h where to find the cros ec trace header CFLAGS_cros_ec_trace.o:=3D -I$(src) +CFLAGS_cros_ec_sensorhub_ring.o:=3D -I$(src) =20 obj-$(CONFIG_CHROMEOS_LAPTOP) +=3D chromeos_laptop.o obj-$(CONFIG_CHROMEOS_PSTORE) +=3D chromeos_pstore.o @@ -20,7 +21,7 @@ obj-$(CONFIG_CROS_EC_CHARDEV) +=3D cros_ec_chardev.o obj-$(CONFIG_CROS_EC_LIGHTBAR) +=3D cros_ec_lightbar.o obj-$(CONFIG_CROS_EC_VBC) +=3D cros_ec_vbc.o obj-$(CONFIG_CROS_EC_DEBUGFS) +=3D cros_ec_debugfs.o -cros-ec-sensorhub-objs :=3D cros_ec_sensorhub.o cros_ec_sensorhub_ring.o= cros_ec_trace.o +cros-ec-sensorhub-objs :=3D cros_ec_sensorhub.o cros_ec_sensorhub_ring.o obj-$(CONFIG_CROS_EC_SENSORHUB) +=3D cros-ec-sensorhub.o obj-$(CONFIG_CROS_EC_SYSFS) +=3D cros_ec_sysfs.o obj-$(CONFIG_CROS_USBPD_LOGGER) +=3D cros_usbpd_logger.o diff --git a/drivers/platform/chrome/cros_ec_sensorhub_ring.c b/drivers/pla= tform/chrome/cros_ec_sensorhub_ring.c index 98e37080f76091..71948dade0e2ae 100644 --- a/drivers/platform/chrome/cros_ec_sensorhub_ring.c +++ b/drivers/platform/chrome/cros_ec_sensorhub_ring.c @@ -17,7 +17,8 @@ #include #include =20 -#include "cros_ec_trace.h" +#define CREATE_TRACE_POINTS +#include "cros_ec_sensorhub_trace.h" =20 /* Precision of fixed point for the m values from the filter */ #define M_PRECISION BIT(23) diff --git a/drivers/platform/chrome/cros_ec_sensorhub_trace.h b/drivers/pl= atform/chrome/cros_ec_sensorhub_trace.h new file mode 100644 index 00000000000000..57d9b478596927 --- /dev/null +++ b/drivers/platform/chrome/cros_ec_sensorhub_trace.h @@ -0,0 +1,123 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Trace events for the ChromeOS Sensorhub kernel module + * + * Copyright 2021 Google LLC. + */ + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM cros_ec + +#if !defined(_CROS_EC_SENSORHUB_TRACE_H_) || defined(TRACE_HEADER_MULTI_RE= AD) +#define _CROS_EC_SENSORHUB_TRACE_H_ + +#include +#include + +#include + +TRACE_EVENT(cros_ec_sensorhub_timestamp, + TP_PROTO(u32 ec_sample_timestamp, u32 ec_fifo_timestamp, s64 fifo_tim= estamp, + s64 current_timestamp, s64 current_time), + TP_ARGS(ec_sample_timestamp, ec_fifo_timestamp, fifo_timestamp, current_t= imestamp, + current_time), + TP_STRUCT__entry( + __field(u32, ec_sample_timestamp) + __field(u32, ec_fifo_timestamp) + __field(s64, fifo_timestamp) + __field(s64, current_timestamp) + __field(s64, current_time) + __field(s64, delta) + ), + TP_fast_assign( + __entry->ec_sample_timestamp =3D ec_sample_timestamp; + __entry->ec_fifo_timestamp =3D ec_fifo_timestamp; + __entry->fifo_timestamp =3D fifo_timestamp; + __entry->current_timestamp =3D current_timestamp; + __entry->current_time =3D current_time; + __entry->delta =3D current_timestamp - current_time; + ), + TP_printk("ec_ts: %9u, ec_fifo_ts: %9u, fifo_ts: %12lld, curr_ts: %12lld,= curr_time: %12lld, delta %12lld", + __entry->ec_sample_timestamp, + __entry->ec_fifo_timestamp, + __entry->fifo_timestamp, + __entry->current_timestamp, + __entry->current_time, + __entry->delta + ) +); + +TRACE_EVENT(cros_ec_sensorhub_data, + TP_PROTO(u32 ec_sensor_num, u32 ec_fifo_timestamp, s64 fifo_timestamp, + s64 current_timestamp, s64 current_time), + TP_ARGS(ec_sensor_num, ec_fifo_timestamp, fifo_timestamp, current_timesta= mp, current_time), + TP_STRUCT__entry( + __field(u32, ec_sensor_num) + __field(u32, ec_fifo_timestamp) + __field(s64, fifo_timestamp) + __field(s64, current_timestamp) + __field(s64, current_time) + __field(s64, delta) + ), + TP_fast_assign( + __entry->ec_sensor_num =3D ec_sensor_num; + __entry->ec_fifo_timestamp =3D ec_fifo_timestamp; + __entry->fifo_timestamp =3D fifo_timestamp; + __entry->current_timestamp =3D current_timestamp; + __entry->current_time =3D current_time; + __entry->delta =3D current_timestamp - current_time; + ), + TP_printk("ec_num: %4u, ec_fifo_ts: %9u, fifo_ts: %12lld, curr_ts: %12lld= , curr_time: %12lld, delta %12lld", + __entry->ec_sensor_num, + __entry->ec_fifo_timestamp, + __entry->fifo_timestamp, + __entry->current_timestamp, + __entry->current_time, + __entry->delta + ) +); + +TRACE_EVENT(cros_ec_sensorhub_filter, + TP_PROTO(struct cros_ec_sensors_ts_filter_state *state, s64 dx, s64 d= y), + TP_ARGS(state, dx, dy), + TP_STRUCT__entry( + __field(s64, dx) + __field(s64, dy) + __field(s64, median_m) + __field(s64, median_error) + __field(s64, history_len) + __field(s64, x) + __field(s64, y) + ), + TP_fast_assign( + __entry->dx =3D dx; + __entry->dy =3D dy; + __entry->median_m =3D state->median_m; + __entry->median_error =3D state->median_error; + __entry->history_len =3D state->history_len; + __entry->x =3D state->x_offset; + __entry->y =3D state->y_offset; + ), + TP_printk("dx: %12lld. dy: %12lld median_m: %12lld median_error: %12lld l= en: %lld x: %12lld y: %12lld", + __entry->dx, + __entry->dy, + __entry->median_m, + __entry->median_error, + __entry->history_len, + __entry->x, + __entry->y + ) +); + + +#endif /* _CROS_EC_SENSORHUB_TRACE_H_ */ + +/* this part must be outside header guard */ + +#undef TRACE_INCLUDE_PATH +#define TRACE_INCLUDE_PATH . + +#undef TRACE_INCLUDE_FILE +#define TRACE_INCLUDE_FILE cros_ec_sensorhub_trace + +#include diff --git a/drivers/platform/chrome/cros_ec_trace.h b/drivers/platform/chr= ome/cros_ec_trace.h index 7e7cfc98657a4a..9bb5cd2c98b8b4 100644 --- a/drivers/platform/chrome/cros_ec_trace.h +++ b/drivers/platform/chrome/cros_ec_trace.h @@ -15,7 +15,6 @@ #include #include #include -#include =20 #include =20 @@ -71,100 +70,6 @@ TRACE_EVENT(cros_ec_request_done, __entry->retval) ); =20 -TRACE_EVENT(cros_ec_sensorhub_timestamp, - TP_PROTO(u32 ec_sample_timestamp, u32 ec_fifo_timestamp, s64 fifo_tim= estamp, - s64 current_timestamp, s64 current_time), - TP_ARGS(ec_sample_timestamp, ec_fifo_timestamp, fifo_timestamp, current_t= imestamp, - current_time), - TP_STRUCT__entry( - __field(u32, ec_sample_timestamp) - __field(u32, ec_fifo_timestamp) - __field(s64, fifo_timestamp) - __field(s64, current_timestamp) - __field(s64, current_time) - __field(s64, delta) - ), - TP_fast_assign( - __entry->ec_sample_timestamp =3D ec_sample_timestamp; - __entry->ec_fifo_timestamp =3D ec_fifo_timestamp; - __entry->fifo_timestamp =3D fifo_timestamp; - __entry->current_timestamp =3D current_timestamp; - __entry->current_time =3D current_time; - __entry->delta =3D current_timestamp - current_time; - ), - TP_printk("ec_ts: %9u, ec_fifo_ts: %9u, fifo_ts: %12lld, curr_ts: %12lld,= curr_time: %12lld, delta %12lld", - __entry->ec_sample_timestamp, - __entry->ec_fifo_timestamp, - __entry->fifo_timestamp, - __entry->current_timestamp, - __entry->current_time, - __entry->delta - ) -); - -TRACE_EVENT(cros_ec_sensorhub_data, - TP_PROTO(u32 ec_sensor_num, u32 ec_fifo_timestamp, s64 fifo_timestamp, - s64 current_timestamp, s64 current_time), - TP_ARGS(ec_sensor_num, ec_fifo_timestamp, fifo_timestamp, current_timesta= mp, current_time), - TP_STRUCT__entry( - __field(u32, ec_sensor_num) - __field(u32, ec_fifo_timestamp) - __field(s64, fifo_timestamp) - __field(s64, current_timestamp) - __field(s64, current_time) - __field(s64, delta) - ), - TP_fast_assign( - __entry->ec_sensor_num =3D ec_sensor_num; - __entry->ec_fifo_timestamp =3D ec_fifo_timestamp; - __entry->fifo_timestamp =3D fifo_timestamp; - __entry->current_timestamp =3D current_timestamp; - __entry->current_time =3D current_time; - __entry->delta =3D current_timestamp - current_time; - ), - TP_printk("ec_num: %4u, ec_fifo_ts: %9u, fifo_ts: %12lld, curr_ts: %12lld= , curr_time: %12lld, delta %12lld", - __entry->ec_sensor_num, - __entry->ec_fifo_timestamp, - __entry->fifo_timestamp, - __entry->current_timestamp, - __entry->current_time, - __entry->delta - ) -); - -TRACE_EVENT(cros_ec_sensorhub_filter, - TP_PROTO(struct cros_ec_sensors_ts_filter_state *state, s64 dx, s64 d= y), - TP_ARGS(state, dx, dy), - TP_STRUCT__entry( - __field(s64, dx) - __field(s64, dy) - __field(s64, median_m) - __field(s64, median_error) - __field(s64, history_len) - __field(s64, x) - __field(s64, y) - ), - TP_fast_assign( - __entry->dx =3D dx; - __entry->dy =3D dy; - __entry->median_m =3D state->median_m; - __entry->median_error =3D state->median_error; - __entry->history_len =3D state->history_len; - __entry->x =3D state->x_offset; - __entry->y =3D state->y_offset; - ), - TP_printk("dx: %12lld. dy: %12lld median_m: %12lld median_error: %12lld l= en: %lld x: %12lld y: %12lld", - __entry->dx, - __entry->dy, - __entry->median_m, - __entry->median_error, - __entry->history_len, - __entry->x, - __entry->y - ) -); - - #endif /* _CROS_EC_TRACE_H_ */ =20 /* this part must be outside header guard */ --=20 2.35.0.rc0.227.g00780c9af4-goog