Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp713852lqp; Fri, 5 Apr 2024 06:52:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW/xvN5PpD6HfoJPM5jhYI9lnR6B1zw9CyD5hbw429KFUCnmgkBH0CRBvkuiDVECWOWwaxouI5zxSRiGdzq8/dBtyuvn78WXGbuoEV3Ew== X-Google-Smtp-Source: AGHT+IGucuhzw4NreQWAoy38LE+UO/g/ByPEmFz27gUYSx9diAOnfGPeJcbWdG+FtbzOM2uwDoHp X-Received: by 2002:a17:907:9611:b0:a4e:8be4:8cea with SMTP id gb17-20020a170907961100b00a4e8be48ceamr1453870ejc.47.1712325144173; Fri, 05 Apr 2024 06:52:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712325144; cv=pass; d=google.com; s=arc-20160816; b=m1YKby80IzRaLEIJtX5LyXQDVF1bIJXB/wk+lcX1O0iftcteouxq6gEl9Bzw2ZkfRS iCsSSvDomkZsygHGZigPMxtRBGaTJ77Bt7oZWRKbySIxUYLQzCZCMPhroGEnm1JSkdgg 4x4bbczvtmeBuUf8URPMlYgJAr+P0fA6+Xn9NWmAFZ42RNzexn1lEVP603XP/IQ8ZqCq WpQ4XCRhz8cIlca4oPcerHWgR7+eioqkMozjhfy4SLayDe58e/A3W4/tIcy9ymhEuGC1 pZsiYSs0+C1LRvWk1UlPypPO6BhICpOIBj6zmU8WFRDDDBCsD+xG1ygMWcKjj7ZT+pgz yuYA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:autocrypt:from :references:cc:to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=RY5ULscKMwbdkiHMhe+jaO9W2mIijjM9jYqCnjDrZVM=; fh=3BqFEP1R4kCk2YBtrazqwleSbY7lpHi6I/XGt7IGVA4=; b=iMp7zl1XOdcZLvE78MYzA6Vmq/nMacNsPPIJud6p0o/zzAzVtE/A7MQWagQx/HOx+4 GY1+qSZeCTSAUiXZ7sVye+1b2jmwzLrtx0eb7rwLn+an/GOJU12tGJWgGf90Qp5Fp+fQ cQmnRtBZJwGwSjHbV84mpcCMZyxhxkJHyWWqWi3AqbEXUyjX//sTvuYVx2GVkohQ7HG6 v/uCdM9vQhEV+ZiVglOqL4q0ZPkwMqxEZXfLoA9ewRCYCYpfHrAmZFI+yY+15GxFZ0IH QKmDup4qdUbykF+hNUfTuYristFQcH4ZLhIZMLNvfApWe8w3jotvHQjfSg+BLpwmqwgK k6Cw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HhNEvKlo; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-133095-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-133095-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ds14-20020a170907724e00b00a46e00610dfsi785678ejc.322.2024.04.05.06.52.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 06:52:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-133095-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HhNEvKlo; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-133095-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-133095-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 943891F2156B for ; Fri, 5 Apr 2024 13:52:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3FA2316D9CF; Fri, 5 Apr 2024 13:52:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HhNEvKlo" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2CC6A16D309; Fri, 5 Apr 2024 13:52:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712325130; cv=none; b=RNriGSmXxxVTRpUFsHn20TS9YRruGAbcDO9vziinaddP+Et/qdCymV1w/m5H2d1PE2nwdtdcDXF/MI11njPEm0uOFQsHWGiVEQZbTbhcOmQURBcMxkv4fg3birF6DwEjDr32LqtHPLQPTV7unj3uFnR0P9vizM44H421PywlOjc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712325130; c=relaxed/simple; bh=XqlrFMow+DfUuNoWXAqGHAP/Ea4CAhFI638WoT8N7pk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=r3mfYfwN/xyI/nsr+MtnPkTOjOdk9hjtpT3GT+JnwGsfOE8fRuO/k8H25TJ0nv8cKwR6mJGxQjtmnTn/i4S0uhkU6fvMpVJKqfLUXRHp3dV2At76jehaoHrhvXXe+87lPFiW8trRaocaUBbui+2Bs+idxTs5KgCEfc6aqpwFYbI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HhNEvKlo; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50964C433F1; Fri, 5 Apr 2024 13:52:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712325129; bh=XqlrFMow+DfUuNoWXAqGHAP/Ea4CAhFI638WoT8N7pk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=HhNEvKloXhrbkZjlX8IYjDuZJaFgymf8W5wsAn8acyNT8mCWNDlQnLej/XJRmGp6n YobD5bq01JoXW1mYrEvPGDHu4OD+ZCOcJ+q12YXJXoZ7mIk9+IUHs2j97w5xttftb8 f/IVlx/IPLTD5U+FkWkRJjRgfoyxwqBnveoV7Wl5CiS4MCH2rosebxt/9aX9LqJ9JS urYTLlErPoOutuNBI/lje/lo9lPtGPaXwAnbTqPQvbuT6onGFUYKOgwJtT/tZnWUam 0njrX9NWk+S9Ziy2dI4XDhZI3nMic/MZuGUuwXL5Xjb8zaP8CAbEgY7lTNXn0p4uqF tE/pJETO9SvVg== Message-ID: <39588f6b-b466-4a1a-bd30-729c5da37a22@kernel.org> Date: Fri, 5 Apr 2024 15:52:05 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: [PATCH net-next 1/2] mptcp: add last time fields in mptcp_info Content-Language: en-GB To: Eric Dumazet Cc: mptcp@lists.linux.dev, Mat Martineau , Geliang Tang , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Shuah Khan , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Geliang Tang References: <20240405-upstream-net-next-20240405-mptcp-last-time-info-v1-0-52dc49453649@kernel.org> <20240405-upstream-net-next-20240405-mptcp-last-time-info-v1-1-52dc49453649@kernel.org> From: Matthieu Baerts Autocrypt: addr=matttbe@kernel.org; keydata= xsFNBFXj+ekBEADxVr99p2guPcqHFeI/JcFxls6KibzyZD5TQTyfuYlzEp7C7A9swoK5iCvf YBNdx5Xl74NLSgx6y/1NiMQGuKeu+2BmtnkiGxBNanfXcnl4L4Lzz+iXBvvbtCbynnnqDDqU c7SPFMpMesgpcu1xFt0F6bcxE+0ojRtSCZ5HDElKlHJNYtD1uwY4UYVGWUGCF/+cY1YLmtfb WdNb/SFo+Mp0HItfBC12qtDIXYvbfNUGVnA5jXeWMEyYhSNktLnpDL2gBUCsdbkov5VjiOX7 CRTkX0UgNWRjyFZwThaZADEvAOo12M5uSBk7h07yJ97gqvBtcx45IsJwfUJE4hy8qZqsA62A nTRflBvp647IXAiCcwWsEgE5AXKwA3aL6dcpVR17JXJ6nwHHnslVi8WesiqzUI9sbO/hXeXw TDSB+YhErbNOxvHqCzZEnGAAFf6ges26fRVyuU119AzO40sjdLV0l6LE7GshddyazWZf0iac nEhX9NKxGnuhMu5SXmo2poIQttJuYAvTVUNwQVEx/0yY5xmiuyqvXa+XT7NKJkOZSiAPlNt6 VffjgOP62S7M9wDShUghN3F7CPOrrRsOHWO/l6I/qJdUMW+MHSFYPfYiFXoLUZyPvNVCYSgs 3oQaFhHapq1f345XBtfG3fOYp1K2wTXd4ThFraTLl8PHxCn4ywARAQABzSRNYXR0aGlldSBC YWVydHMgPG1hdHR0YmVAa2VybmVsLm9yZz7CwZEEEwEIADsCGwMFCwkIBwIGFQoJCAsCBBYC AwECHgECF4AWIQToy4X3aHcFem4n93r2t4JPQmmgcwUCZUDpDAIZAQAKCRD2t4JPQmmgcz33 EACjROM3nj9FGclR5AlyPUbAq/txEX7E0EFQCDtdLPrjBcLAoaYJIQUV8IDCc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YNhjv67WMX7tNwiVbSrGLZoqf Xlgw4aAdnIMQyTW8nE6hH/Iwqay4S2str4HZtWwyWLitk7N+e+vxuK5qto4AxtB7VdimvKUs x6kQO5F3YWcC3vCXCgPwyV8133+fIR2L81R1L1q3swaEuh95vWj6iskxeNWSTyFAVKYYVskG V+OTtB71P1XCnb6AJCW9cKpC25+zxQqD2Zy0dK3u2RuKErajKBa/YWzuSaKAOkneFxG3LJIv Hl7iqPF+JDCjB5sAEQEAAcLBXwQYAQIACQUCVeP56QIbDAAKCRD2t4JPQmmgc5VnD/9YgbCr HR1FbMbm7td54UrYvZV/i7m3dIQNXK2e+Cbv5PXf19ce3XluaE+wA8D+vnIW5mbAAiojt3Mb 6p0WJS3QzbObzHNgAp3zy/L4lXwc6WW5vnpWAzqXFHP8D9PTpqvBALbXqL06smP47JqbyQxj Xf7D2rrPeIqbYmVY9da1KzMOVf3gReazYa89zZSdVkMojfWsbq05zwYU+SCWS3NiyF6QghbW voxbFwX1i/0xRwJiX9NNbRj1huVKQuS4W7rbWA87TrVQPXUAdkyd7FRYICNW+0gddysIwPoa KrLfx3Ba6Rpx0JznbrVOtXlihjl4KV8mtOPjYDY9u+8x412xXnlGl6AC4HLu2F3ECkamY4G6 UxejX+E6vW6Xe4n7H+rEX5UFgPRdYkS1TA/X3nMen9bouxNsvIJv7C6adZmMHqu/2azX7S7I vrxxySzOw9GxjoVTuzWMKWpDGP8n71IFeOot8JuPZtJ8omz+DZel+WCNZMVdVNLPOd5frqOv mpz0VhFAlNTjU1Vy0CnuxX3AM51J8dpdNyG0S8rADh6C8AKCDOfUstpq28/6oTaQv7QZdge0 JY6dglzGKnCi/zsmp2+1w559frz4+IC7j/igvJGX4KDDKUs0mlld8J2u2sBXv7CGxdzQoHaz lzVbFe7fduHbABmYz9cefQpO7wDE/Q== Organization: NGI0 Core In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi Eric, Thank you for the review! On 05/04/2024 15:29, Eric Dumazet wrote: > On Fri, Apr 5, 2024 at 3:06 PM Matthieu Baerts (NGI0) > wrote: >> >> From: Geliang Tang >> >> This patch adds "last time" fields last_data_sent, last_data_recv and >> last_ack_recv in struct mptcp_sock to record the last time data_sent, >> data_recv and ack_recv happened. They all are initialized as >> tcp_jiffies32 in __mptcp_init_sock(), and updated as tcp_jiffies32 too >> when data is sent in __subflow_push_pending(), data is received in >> __mptcp_move_skbs_from_subflow(), and ack is received in ack_update_msk(). >> >> Similar to tcpi_last_data_sent, tcpi_last_data_recv and tcpi_last_ack_recv >> exposed with TCP, this patch exposes the last time "an action happened" for >> MPTCP in mptcp_info, named mptcpi_last_data_sent, mptcpi_last_data_recv and >> mptcpi_last_ack_recv, calculated in mptcp_diag_fill_info() as the time >> deltas between now and the newly added last time fields in mptcp_sock. >> >> Also add three reserved bytes in struct mptcp_info not to have holes in >> this structure exposed to userspace. >> >> Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/446 >> Signed-off-by: Geliang Tang >> Reviewed-by: Mat Martineau >> Signed-off-by: Matthieu Baerts (NGI0) >> --- >> include/uapi/linux/mptcp.h | 4 ++++ > > >> diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c >> index 73fdf423de44..2ec2fdf9f4af 100644 >> --- a/net/mptcp/sockopt.c >> +++ b/net/mptcp/sockopt.c >> @@ -896,6 +896,7 @@ static int mptcp_getsockopt_first_sf_only(struct mptcp_sock *msk, int level, int >> void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *info) >> { >> struct sock *sk = (struct sock *)msk; >> + u32 now = tcp_jiffies32; >> u32 flags = 0; >> bool slow; >> >> @@ -930,6 +931,7 @@ void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *info) >> info->mptcpi_snd_una = msk->snd_una; >> info->mptcpi_rcv_nxt = msk->ack_seq; >> info->mptcpi_bytes_acked = msk->bytes_acked; >> + info->mptcpi_last_ack_recv = jiffies_to_msecs(now - msk->last_ack_recv); >> mptcp_data_unlock(sk); >> >> slow = lock_sock_fast(sk); > > lock_sock_fast(sk) can sleep and be quite slow... > > I suggest you reload now = jiffies32; Good point, it would make more sense to reload it after this lock! (or defining "now" only here, under this lock_sock_fast(), and move the block here above that is under the data spin lock, after, so all the "time" counter are "in sync"?) pw-bot: changes-requested > > >> @@ -942,6 +944,8 @@ void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *info) >> info->mptcpi_bytes_retrans = msk->bytes_retrans; >> info->mptcpi_subflows_total = info->mptcpi_subflows + >> __mptcp_has_initial_subflow(msk); >> + info->mptcpi_last_data_sent = jiffies_to_msecs(now - msk->last_data_sent); >> + info->mptcpi_last_data_recv = jiffies_to_msecs(now - msk->last_data_recv); >> unlock_sock_fast(sk, slow); >> } >> EXPORT_SYMBOL_GPL(mptcp_diag_fill_info); >> >> -- >> 2.43.0 >> > Cheers, Matt -- Sponsored by the NGI0 Core fund.