[PATCH mptcp-net v3 0/2] Locking fixes for subflow flag changes

Mat Martineau posted 2 patches 1 year, 9 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/multipath-tcp/mptcp_net-next tags/patchew/20220629225327.657202-1-mathew.j.martineau@linux.intel.com
Maintainers: "David S. Miller" <davem@davemloft.net>, Matthieu Baerts <matthieu.baerts@tessares.net>, Geliang Tang <geliangtang@gmail.com>, Mat Martineau <mathew.j.martineau@linux.intel.com>, Paolo Abeni <pabeni@redhat.com>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>
net/mptcp/options.c    |  3 +++
net/mptcp/pm_netlink.c | 13 ++++++-------
net/mptcp/protocol.c   |  9 +++++++--
net/mptcp/protocol.h   |  1 +
4 files changed, 17 insertions(+), 9 deletions(-)
[PATCH mptcp-net v3 0/2] Locking fixes for subflow flag changes
Posted by Mat Martineau 1 year, 9 months ago
When working with Kishen on the userspace PM, the locking code in
mptcp_pm_nl_mp_prio_send_ack() caught my attention. The
release-and-reacquire of the PM lock in that function was requiring the
userspace PM code to grab that lock, even though nothing protected by
that lock was being accessed. Patch 1 addresses this.

While investigating that issue, I realized that
mptcp_pm_nl_mp_prio_send_ack() was not holding the subflow socket lock
while modifying several parts of the subflow context. Patch 2 addresses
this, and is not a drastic change since the subflow lock was being
acquired anyway in mptcp_subflow_send_ack().

v2->v3: Fix build error

v1->v2: Based on Paolo's feedback, fix MIB issue with atomic context in
patch 1 (tested with CONFIG_PREEMPT), and squash patches 2 & 3.


Mat Martineau (2):
  mptcp: Avoid acquiring PM lock for subflow priority changes
  mptcp: Acquire the subflow socket lock before modifying MP_PRIO flags

 net/mptcp/options.c    |  3 +++
 net/mptcp/pm_netlink.c | 13 ++++++-------
 net/mptcp/protocol.c   |  9 +++++++--
 net/mptcp/protocol.h   |  1 +
 4 files changed, 17 insertions(+), 9 deletions(-)

-- 
2.37.0


Re: [PATCH mptcp-net v3 0/2] Locking fixes for subflow flag changes
Posted by Matthieu Baerts 1 year, 9 months ago
Hi Mat, Paolo,

On 30/06/2022 00:53, Mat Martineau wrote:
> When working with Kishen on the userspace PM, the locking code in
> mptcp_pm_nl_mp_prio_send_ack() caught my attention. The
> release-and-reacquire of the PM lock in that function was requiring the
> userspace PM code to grab that lock, even though nothing protected by
> that lock was being accessed. Patch 1 addresses this.
> 
> While investigating that issue, I realized that
> mptcp_pm_nl_mp_prio_send_ack() was not holding the subflow socket lock
> while modifying several parts of the subflow context. Patch 2 addresses
> this, and is not a drastic change since the subflow lock was being
> acquired anyway in mptcp_subflow_send_ack().
> 
> v2->v3: Fix build error
> 
> v1->v2: Based on Paolo's feedback, fix MIB issue with atomic context in
> patch 1 (tested with CONFIG_PREEMPT), and squash patches 2 & 3.
> 
> 
> Mat Martineau (2):
>   mptcp: Avoid acquiring PM lock for subflow priority changes
>   mptcp: Acquire the subflow socket lock before modifying MP_PRIO flags

Thank you for the patches and the reviews!

Now in our tree (fixes for -net) with Paolo's ACK and without the
internal changelog.


New patches for t/upstream-net:
- 2ac39a576e95: mptcp: Avoid acquiring PM lock for subflow priority changes
- 1554cc2cec00: mptcp: Acquire the subflow socket lock before modifying
MP_PRIO flags
- Results: 1fc747ab56ea..3c88708b1aca (export-net)

New patches for t/upstream:
- 2ac39a576e95: mptcp: Avoid acquiring PM lock for subflow priority changes
- 1554cc2cec00: mptcp: Acquire the subflow socket lock before modifying
MP_PRIO flags
- Results: 223590507ff9..ce6114ac321d (export)


Builds and tests are now in progress:

https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export-net/20220630T173736
https://github.com/multipath-tcp/mptcp_net-next/actions/workflows/build-validation.yml?query=branch:export-net
https://cirrus-ci.com/github/multipath-tcp/mptcp_net-next/export/20220630T173736
https://github.com/multipath-tcp/mptcp_net-next/actions/workflows/build-validation.yml?query=branch:export

Cheers,
Matt
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net

Re: [PATCH mptcp-net v3 0/2] Locking fixes for subflow flag changes
Posted by Paolo Abeni 1 year, 9 months ago
On Wed, 2022-06-29 at 15:53 -0700, Mat Martineau wrote:
> When working with Kishen on the userspace PM, the locking code in
> mptcp_pm_nl_mp_prio_send_ack() caught my attention. The
> release-and-reacquire of the PM lock in that function was requiring the
> userspace PM code to grab that lock, even though nothing protected by
> that lock was being accessed. Patch 1 addresses this.
> 
> While investigating that issue, I realized that
> mptcp_pm_nl_mp_prio_send_ack() was not holding the subflow socket lock
> while modifying several parts of the subflow context. Patch 2 addresses
> this, and is not a drastic change since the subflow lock was being
> acquired anyway in mptcp_subflow_send_ack().
> 
> v2->v3: Fix build error
> 
> v1->v2: Based on Paolo's feedback, fix MIB issue with atomic context in
> patch 1 (tested with CONFIG_PREEMPT), and squash patches 2 & 3.
> 
> 
> Mat Martineau (2):
>   mptcp: Avoid acquiring PM lock for subflow priority changes
>   mptcp: Acquire the subflow socket lock before modifying MP_PRIO flags
> 
>  net/mptcp/options.c    |  3 +++
>  net/mptcp/pm_netlink.c | 13 ++++++-------
>  net/mptcp/protocol.c   |  9 +++++++--
>  net/mptcp/protocol.h   |  1 +
>  4 files changed, 17 insertions(+), 9 deletions(-)

LGTM! for the series:

Acked-by: Paolo Abeni <pabeni@redhat.com>