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] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 12 Oct 2022 08:58:32 +0300
From:   Leon Romanovsky <leon@...nel.org>
To:     Peilin Ye <yepeilin.cs@...il.com>
Cc:     Eric Dumazet <edumazet@...gle.com>,
        "David S. Miller" <davem@...emloft.net>,
        Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
        David Ahern <dsahern@...nel.org>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Peilin Ye <peilin.ye@...edance.com>,
        Cong Wang <cong.wang@...edance.com>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v3] net/sock: Introduce trace_sk_data_ready()

On Tue, Oct 11, 2022 at 12:58:56PM -0700, Peilin Ye wrote:
> From: Peilin Ye <peilin.ye@...edance.com>
> 
> As suggested by Cong, introduce a tracepoint for all ->sk_data_ready()
> callback implementations.  For example:
> 
> <...>
>   dpkg-deb-7752    [000] .....   145.660735: sk_data_ready: family=16 protocol=16 func=sock_def_readable
>   dpkg-deb-7757    [000] .....   145.759168: sk_data_ready: family=16 protocol=16 func=sock_def_readable
>   dpkg-deb-7758    [000] .....   145.763956: sk_data_ready: family=16 protocol=16 func=sock_def_readable
> <...>
> 
> Suggested-by: Cong Wang <cong.wang@...edance.com>
> Signed-off-by: Peilin Ye <peilin.ye@...edance.com>
> ---
> change since v2:
>   - Fix modpost error for modules (kernel test robot)
> 
> changes since v1:
>   - Move tracepoint into ->sk_data_ready() callback implementations
>     (Eric Dumazet)
>   - Fix W=1 warning (Jakub Kicinski)
> 
>  drivers/infiniband/hw/erdma/erdma_cm.c   |  3 +++
>  drivers/infiniband/sw/siw/siw_cm.c       |  5 +++++
>  drivers/infiniband/sw/siw/siw_qp.c       |  3 +++
>  drivers/nvme/host/tcp.c                  |  3 +++
>  drivers/nvme/target/tcp.c                |  5 +++++
>  drivers/scsi/iscsi_tcp.c                 |  3 +++
>  drivers/soc/qcom/qmi_interface.c         |  3 +++
>  drivers/target/iscsi/iscsi_target_nego.c |  2 ++
>  drivers/xen/pvcalls-back.c               |  5 +++++
>  fs/dlm/lowcomms.c                        |  5 +++++
>  fs/ocfs2/cluster/tcp.c                   |  5 +++++
>  include/trace/events/sock.h              | 24 ++++++++++++++++++++++++
>  net/ceph/messenger.c                     |  4 ++++
>  net/core/net-traces.c                    |  2 ++
>  net/core/skmsg.c                         |  3 +++
>  net/core/sock.c                          |  2 ++
>  net/kcm/kcmsock.c                        |  3 +++
>  net/mptcp/subflow.c                      |  3 +++
>  net/qrtr/ns.c                            |  3 +++
>  net/rds/tcp_listen.c                     |  2 ++
>  net/rds/tcp_recv.c                       |  2 ++
>  net/sctp/socket.c                        |  3 +++
>  net/smc/smc_rx.c                         |  3 +++
>  net/sunrpc/svcsock.c                     |  5 +++++
>  net/sunrpc/xprtsock.c                    |  3 +++
>  net/tipc/socket.c                        |  3 +++
>  net/tipc/topsrv.c                        |  5 +++++
>  net/tls/tls_sw.c                         |  3 +++
>  net/xfrm/espintcp.c                      |  3 +++
>  29 files changed, 118 insertions(+)
> 
> diff --git a/drivers/infiniband/hw/erdma/erdma_cm.c b/drivers/infiniband/hw/erdma/erdma_cm.c
> index f13f16479eca..63f314222813 100644
> --- a/drivers/infiniband/hw/erdma/erdma_cm.c
> +++ b/drivers/infiniband/hw/erdma/erdma_cm.c

<...>

> +	trace_sk_data_ready(sk, __func__);

<...>

> +	trace_sk_data_ready(sk, __func__);

<...>

> +	trace_sk_data_ready(sk, __func__);

<...>

> +	trace_sk_data_ready(sk, __func__);

<...>

> +	trace_sk_data_ready(sk, __func__);

<...>

> +	trace_sk_data_ready(sk, __func__);

<...>

> +	trace_sk_data_ready(sk, __func__);

<...>

> +	trace_sk_data_ready(sk, __func__);

<...>

> +	trace_sk_data_ready(sk, __func__);

<...>

> +	trace_sk_data_ready(sk, __func__);
>  	pr_debug("Entering iscsi_target_sk_data_ready: conn: %p\n", conn);

This can go.

<...>

> +	trace_sk_data_ready(sock, __func__);

<...>

> +	trace_sk_data_ready(sock, __func__);

<...>

> +	trace_sk_data_ready(sk, __func__);

<...>

> +	trace_sk_data_ready(sk, __func__);

<...>

> +	trace_sk_data_ready(sk, __func__);

<...>

> +	trace_sk_data_ready(sk, __func__);

<...>

__func__ repetitive pattern hints that it is not best API interface.


> +TRACE_EVENT(sk_data_ready,
> +
> +	TP_PROTO(const struct sock *sk, const char *func),
> +
> +	TP_ARGS(sk, func),
> +
> +	TP_STRUCT__entry(
> +		__field(const void *, skaddr)
> +		__field(__u16, family)
> +		__field(__u16, protocol)
> +		__string(func, func)

TRACE_EVENT() is macro defined in .h file, you can safely put __func__
instead.

> +	),
> +
> +	TP_fast_assign(
> +		__entry->skaddr = sk;
> +		__entry->family = sk->sk_family;
> +		__entry->protocol = sk->sk_protocol;
> +		__assign_str(func, func)
> +	),
> +
> +	TP_printk("family=%u protocol=%u func=%s",
> +		  __entry->family, __entry->protocol, __get_str(func))
> +);
> +
>  #endif /* _TRACE_SOCK_H */

Powered by blists - more mailing lists