lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 3 Oct 2022 12:29:07 -0400
From:   Steven Rostedt <rostedt@...dmis.org>
To:     Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>
Cc:     Wim Van Sebroeck <wim@...ux-watchdog.org>,
        Guenter Roeck <linux@...ck-us.net>,
        Ingo Molnar <mingo@...hat.com>, linux-watchdog@...r.kernel.org,
        linux-kernel@...r.kernel.org, kernel@...gutronix.de
Subject: Re: [PATCH] watchdog: Add tracing events for the most usual
 watchdog events

On Fri, 30 Sep 2022 16:49:35 +0200
Uwe Kleine-König <u.kleine-koenig@...gutronix.de> wrote:


> --- /dev/null
> +++ b/include/trace/events/watchdog.h
> @@ -0,0 +1,92 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +#undef TRACE_SYSTEM
> +#define TRACE_SYSTEM watchdog
> +
> +#if !defined(_TRACE_WATCHDOG_H) || defined(TRACE_HEADER_MULTI_READ)
> +#define _TRACE_WATCHDOG_H
> +
> +#include <linux/watchdog.h>
> +#include <linux/tracepoint.h>
> +
> +TRACE_EVENT(watchdog_start,
> +
> +	TP_PROTO(struct watchdog_device *wdd, int err),
> +
> +	TP_ARGS(wdd, err),
> +
> +	TP_STRUCT__entry(
> +		__field(int, id)
> +		__field(int, err)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->id = wdd->id;
> +		__entry->err = err;
> +	),
> +
> +	TP_printk("watchdog%d err=%d", __entry->id, __entry->err)
> +);
> +

[..]

> +
> +TRACE_EVENT(watchdog_ping,
> +
> +	TP_PROTO(struct watchdog_device *wdd, int err),
> +
> +	TP_ARGS(wdd, err),
> +
> +	TP_STRUCT__entry(
> +		__field(int, id)
> +		__field(int, err)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->id = wdd->id;
> +		__entry->err = err;
> +	),
> +
> +	TP_printk("watchdog%d err=%d", __entry->id, __entry->err)
> +);
> +
> +TRACE_EVENT(watchdog_stop,
> +
> +	TP_PROTO(struct watchdog_device *wdd, int err),
> +
> +	TP_ARGS(wdd, err),
> +
> +	TP_STRUCT__entry(
> +		__field(int, id)
> +		__field(int, err)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->id = wdd->id;
> +		__entry->err = err;
> +	),
> +
> +	TP_printk("watchdog%d err=%d", __entry->id, __entry->err)
> +);

These three events are identical. Please replace them with:

DECLARE_EVENT_CLASS(watchdog_template,

	TP_PROTO(struct watchdog_device *wdd, int err),

	TP_ARGS(wdd, err),

	TP_STRUCT__entry(
		__field(int, id)
		__field(int, err)
	),

	TP_fast_assign(
		__entry->id = wdd->id;
		__entry->err = err;
	),

	TP_printk("watchdog%d err=%d", __entry->id, __entry->err)
);

DEFINE_EVENT(watchdog_template, watchdog_start,
	TP_PROTO(struct watchdog_device *wdd, int err),
	TP_ARGS(wdd, err));

DEFINE_EVENT(watchdog_template, watchdog_ping,
	TP_PROTO(struct watchdog_device *wdd, int err),
	TP_ARGS(wdd, err));

DEFINE_EVENT(watchdog_template, watchdog_stop,
	TP_PROTO(struct watchdog_device *wdd, int err),
	TP_ARGS(wdd, err));


Each TRACE_EVENT() is defined as
  DECLARE_EVENT_CLASS(..)
  DEFINE_EVENT(..)

Where the DECLARE_EVENT_CLASS takes up most of the memory (5KB worth), and
each DEFINE_EVENT() takes up just around 500 bytes to implement.

Using multiple DEFINE_EVENTS() can save 10KB from the above.

-- Steve


> +
> +#endif /* !defined(_TRACE_WATCHDOG_H) || defined(TRACE_HEADER_MULTI_READ) */
> +
> +/* This part must be outside protection */
> +#include <trace/define_trace.h>
> 
> base-commit: 568035b01cfb107af8d2e4bd2fb9aea22cf5b868

Powered by blists - more mailing lists