MPTCP Linux Development
 help / color / mirror / Atom feed
From: Matthieu Baerts <matttbe@kernel.org>
To: Geliang Tang <geliang@kernel.org>, Mat Martineau <martineau@kernel.org>
Cc: mptcp@lists.linux.dev, Geliang Tang <tanggeliang@kylinos.cn>
Subject: Re: [PATCH mptcp-next v5 2/5] Squash to "bpf: Extend bpf_skc_to_mptcp_sock to MPTCP sock"
Date: Fri, 7 Mar 2025 09:53:58 +0100	[thread overview]
Message-ID: <620b17f1-a5eb-4f9c-b411-92277d8bb3dc@kernel.org> (raw)
In-Reply-To: <7691b3bbc2cc5e9507a4187877e4cd821a73744b.camel@kernel.org>

Hi Geliang,

On 07/03/2025 04:54, Geliang Tang wrote:
> On Mon, 2025-03-03 at 17:37 -0800, Mat Martineau wrote:

(...)

>> The code above will set msk->bpf_iter_task even when the lock is not
>> held, 
>> and then it is never cleared.
>>
>> To set/clear as expected for get/setsockopt I think the task pointer
>> would 
>> have to be set in places where the locks are acquired and released,
>> like 
>> these:
>>
>> https://elixir.bootlin.com/linux/v6.14-rc5/source/kernel/bpf/cgroup.c#L1955
>> https://elixir.bootlin.com/linux/v6.14-rc5/source/kernel/bpf/cgroup.c#L1846
>>
> 
> The get/setsockopt scenario is a bit complicated. I think we can use
> the bpf_iter_task check only for bpf schedulers, keep the
> get/setsockopt scenario unchanged, and continue to use the
> msk_owned_by_me(msk) check. What do you think?

I think in any case, it doesn't hurt to keep msk_owned_by_me(msk) for
lockdep.

If we think it is difficult to have the bpf_iter for both CG
[gs]etsockopt and struct_ops, then we can also drop the patches for the
[gs]etsockopt.

Or, from a kfunc, is it easy to check if we are called from a struct_ops?

> In addition, I think it's better to add bpf_iter_task to struct
> mptcp_sched_data instead in struct mptcp_sock, since it's more related
> to mptcp scheduler. For specific usage, please see [1]. What do you
> think of this?

Please see my reply to your comment on this thread. In short, we can
always add new parameters later, when we need them, no?

https://lore.kernel.org/706a3051-8328-4321-8eea-71d4120ea996@kernel.org

> 
> Thanks,
> -Geliang
> 
> [1]
> https://patchwork.kernel.org/project/mptcp/cover/cover.1739788598.git.tanggeliang@kylinos.cn/
> 
>>
>> - Mat
>>
>>> +		return msk;
>>> +	}
>>>
>>> -	if (sk->sk_protocol == IPPROTO_TCP && sk_is_mptcp(sk))
>>> -		return mptcp_sk(mptcp_subflow_ctx(sk)->conn);
>>> +	if (sk->sk_protocol == IPPROTO_TCP && sk_is_mptcp(sk)) {
>>> +		msk = mptcp_sk(mptcp_subflow_ctx(sk)->conn);
>>> +		mptcp_set_bpf_iter_task(msk);
>>> +		return msk;
>>> +	}
>>>
>>> 	return NULL;
>>> }
>>> -- 
>>> 2.43.0
>>>
>>>
>>>
> 
> 

Cheers,
Matt
-- 
Sponsored by the NGI0 Core fund.


  reply	other threads:[~2025-03-07  8:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-03 10:33 [PATCH mptcp-next v5 0/5] Squash to "Add mptcp_subflow bpf_iter support" Geliang Tang
2025-03-03 10:33 ` [PATCH mptcp-next v5 1/5] mptcp: add bpf_iter_task for mptcp_sock Geliang Tang
2025-03-03 10:33 ` [PATCH mptcp-next v5 2/5] Squash to "bpf: Extend bpf_skc_to_mptcp_sock to MPTCP sock" Geliang Tang
2025-03-04  1:37   ` Mat Martineau
2025-03-07  3:51     ` Geliang Tang
2025-03-07  3:54     ` Geliang Tang
2025-03-07  8:53       ` Matthieu Baerts [this message]
2025-03-03 10:33 ` [PATCH mptcp-next v5 3/5] Squash to "bpf: Add mptcp_subflow bpf_iter" Geliang Tang
2025-03-04  1:39   ` Mat Martineau
2025-03-07  3:54     ` Geliang Tang
2025-03-03 10:33 ` [PATCH mptcp-next v5 4/5] Revert "bpf: Acquire and release mptcp socket" Geliang Tang
2025-03-03 10:33 ` [PATCH mptcp-next v5 5/5] Squash to "selftests/bpf: Add mptcp_subflow bpf_iter subtest" Geliang Tang
2025-03-03 11:13 ` [PATCH mptcp-next v5 0/5] Squash to "Add mptcp_subflow bpf_iter support" Matthieu Baerts
2025-03-03 11:42 ` MPTCP CI

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=620b17f1-a5eb-4f9c-b411-92277d8bb3dc@kernel.org \
    --to=matttbe@kernel.org \
    --cc=geliang@kernel.org \
    --cc=martineau@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=tanggeliang@kylinos.cn \
    /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