All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tobias Waldekranz <tobias@waldekranz.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: davem@davemloft.net, jiri@resnulli.us, ivecera@redhat.com,
	netdev@vger.kernel.org, roopa@nvidia.com, razor@blackwall.org,
	bridge@lists.linux.dev, rostedt@goodmis.org, mhiramat@kernel.org,
	linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v2 net-next 2/5] net: switchdev: Add helpers to display switchdev objects as strings
Date: Fri, 02 Feb 2024 08:48:39 +0100	[thread overview]
Message-ID: <87zfwjs3vs.fsf@waldekranz.com> (raw)
In-Reply-To: <20240201204940.5f5b6e85@kernel.org>

On tor, feb 01, 2024 at 20:49, Jakub Kicinski <kuba@kernel.org> wrote:
> On Tue, 30 Jan 2024 21:19:34 +0100 Tobias Waldekranz wrote:
>> Useful both in error messages and in tracepoints.
>
> Are you printing things together into one big string?
> Seems like leaving a lot of features on the table.
> trace point events can be filtered, not to mention attaching
> to them with bpftrace. 

My thinking was that __entry->msg was mostly for use by the tracepoint's
printf, and that if you are using some dynamic tracer, __entry->info
points to the verbatim notification which you can use to apply arbitrary
filtering.

> There's also a built-in way to show traces how to convert numerical ids
> to strings for the basic output - __print_symbolic().
> None of that can help here?

Originally, I did use it to display the `val` argument to the
tracepoint, but the problem with that macro is that it wants the mapping
table as an inline list of tuples, and the list must _not_ include a
trailing comma. This means that SWITCHDEV_TYPE_MAPPER can't use the
trailing-comment-after-the-last-item trick, which introduced an
asymmetry with the other mappers that I did not like.

At first, I thought about adding some variant of __print_symbolic that
would take a pointer to an existing table instead. Then I realized that
I would still need some separate stringer helper to put together the
rest of the printed message from the TLV-ish layout of
switchdev_notifier_info.

At that point, it seems more reasonable to just collect all logic of
turning switchdev related structs into strings in one place - with the
added benefit that drivers could use them to log richer error messages.

  reply	other threads:[~2024-02-02  7:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-30 20:19 [PATCH v2 net-next 0/5] net: switchdev: Tracepoints Tobias Waldekranz
2024-01-30 20:19 ` [PATCH v2 net-next 1/5] net: switchdev: Wrap enums in mapper macros Tobias Waldekranz
2024-01-30 20:19 ` [PATCH v2 net-next 2/5] net: switchdev: Add helpers to display switchdev objects as strings Tobias Waldekranz
2024-02-02  4:49   ` Jakub Kicinski
2024-02-02  7:48     ` Tobias Waldekranz [this message]
2024-02-02 18:34       ` Jakub Kicinski
2024-01-30 20:19 ` [PATCH v2 net-next 3/5] net: switchdev: Relay all replay messages through a central function Tobias Waldekranz
2024-01-30 20:19 ` [PATCH v2 net-next 4/5] net: switchdev: Prepare deferred notifications before enqueuing them Tobias Waldekranz
2024-01-30 20:19 ` [PATCH v2 net-next 5/5] net: switchdev: Add tracepoints Tobias Waldekranz
2024-02-02  4:44 ` [PATCH v2 net-next 0/5] net: switchdev: Tracepoints Jakub Kicinski
2024-02-02  7:21   ` Tobias Waldekranz
2024-02-02 18:32     ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zfwjs3vs.fsf@waldekranz.com \
    --to=tobias@waldekranz.com \
    --cc=bridge@lists.linux.dev \
    --cc=davem@davemloft.net \
    --cc=ivecera@redhat.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=razor@blackwall.org \
    --cc=roopa@nvidia.com \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.