mptcp.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Geliang Tang <geliangtang@gmail.com>, mptcp@lists.linux.dev
Subject: Re: [MPTCP][PATCH v3 mptcp-next 1/4] mptcp: add tracepoint in mptcp_subflow_get_send
Date: Tue, 30 Mar 2021 15:51:40 +0200	[thread overview]
Message-ID: <b0cbe100fd42007cf3798911da4c4c932c991b4d.camel@redhat.com> (raw)
In-Reply-To: <c69ce9cc277fd134a5254dee68436f6035ab594e.1617095554.git.geliangtang@gmail.com>

On Tue, 2021-03-30 at 17:16 +0800, Geliang Tang wrote:
> This patch added a tracepoint in the packet scheduler function
> mptcp_subflow_get_send().
> 
> Suggested-by: Paolo Abeni <pabeni@redhat.com>
> Signed-off-by: Geliang Tang <geliangtang@gmail.com>
> ---
>  include/trace/events/mptcp.h | 45 ++++++++++++++++++++++++++++++++++++
>  net/mptcp/protocol.c         |  7 ++++++
>  2 files changed, 52 insertions(+)
>  create mode 100644 include/trace/events/mptcp.h
> 
> diff --git a/include/trace/events/mptcp.h b/include/trace/events/mptcp.h
> new file mode 100644
> index 000000000000..80c9498b4ad9
> --- /dev/null
> +++ b/include/trace/events/mptcp.h
> @@ -0,0 +1,45 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#undef TRACE_SYSTEM
> +#define TRACE_SYSTEM mptcp
> +
> +#if !defined(_TRACE_MPTCP_H) || defined(TRACE_HEADER_MULTI_READ)
> +#define _TRACE_MPTCP_H
> +
> +#include <linux/tracepoint.h>
> +
> +TRACE_EVENT(mptcp_subflow_get_send,
> +
> +	TP_PROTO(bool active, bool free, u32 snd_wnd,
> +		 u32 pace, u8 backup, u64 ratio),
> +
> +	TP_ARGS(active, free, snd_wnd,
> +		pace, backup, ratio),
> +
> +	TP_STRUCT__entry(
> +		__field(bool, active)
> +		__field(bool, free)
> +		__field(u32, snd_wnd)
> +		__field(u32, pace)
> +		__field(u8, backup)
> +		__field(u64, ratio)
> +	),
> +
> +	TP_fast_assign(
> +		__entry->active = active;
> +		__entry->free = free;
> +		__entry->snd_wnd = snd_wnd;
> +		__entry->pace = pace;
> +		__entry->backup = backup;
> +		__entry->ratio = ratio;
> +	),
> +
> +	TP_printk("active=%d free=%d snd_wnd=%u pace=%u backup=%u ratio=%llu",
> +		  __entry->active, __entry->free, __entry->snd_wnd,
> +		  __entry->pace, __entry->backup,
> +		  __entry->ratio)
> +);
> +
> +#endif /* _TRACE_MPTCP_H */
> +
> +/* This part must be outside protection */
> +#include <trace/define_trace.h>
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 9d7e7e13fba8..eb64d373a7ee 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -25,6 +25,9 @@
>  #include "protocol.h"
>  #include "mib.h"
>  
> +#define CREATE_TRACE_POINTS
> +#include <trace/events/mptcp.h>
> +
>  #if IS_ENABLED(CONFIG_MPTCP_IPV6)
>  struct mptcp6_sock {
>  	struct mptcp_sock msk;
> @@ -1411,6 +1414,10 @@ static struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk)
>  			send_info[subflow->backup].ssk = ssk;
>  			send_info[subflow->backup].ratio = ratio;
>  		}
> +		trace_mptcp_subflow_get_send(mptcp_subflow_active(subflow),
> +					     sk_stream_memory_free(subflow->tcp_sock),
> +					     tcp_sk(ssk)->snd_wnd, pace,
> +					     subflow->backup, ratio);

If I read correctly, here 'mptcp_subflow_active(subflow)' should be
always true. That means we actually don't trace some data: we don'
trace not active subflows, subflows with 0 pacing_rate etc.

We should instead get the info even for them.

I think it would be better move the tracepoint just after the loop
start, move mptcp_subflow_active() to the header file, and do the
relevant check inside the tracepoint.

Thanks!

Side note: the other patches LGTM, thanks !

Paolo


  parent reply	other threads:[~2021-03-30 13:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-30  9:16 [MPTCP][PATCH v3 mptcp-next 0/4] add tracepoints Geliang Tang
2021-03-30  9:16 ` [MPTCP][PATCH v3 mptcp-next 1/4] mptcp: add tracepoint in mptcp_subflow_get_send Geliang Tang
2021-03-30  9:16   ` [MPTCP][PATCH v3 mptcp-next 2/4] mptcp: add tracepoint in get_mapping_status Geliang Tang
2021-03-30  9:16     ` [MPTCP][PATCH v3 mptcp-next 3/4] mptcp: add tracepoint in ack_update_msk Geliang Tang
2021-03-30  9:16       ` [MPTCP][PATCH v3 mptcp-next 4/4] mptcp: add tracepoint in subflow_check_data_avail Geliang Tang
2021-03-30 13:51   ` Paolo Abeni [this message]
2021-03-30 17:26   ` [MPTCP][PATCH v3 mptcp-next 1/4] mptcp: add tracepoint in mptcp_subflow_get_send Paolo Abeni

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=b0cbe100fd42007cf3798911da4c4c932c991b4d.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=geliangtang@gmail.com \
    --cc=mptcp@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).