From: Eric Dumazet <hidden> Date: 2018-03-20 15:07:14
On 03/20/2018 07:44 AM, David Lebrun wrote:
quoted hunk
From: David Lebrun <redacted>
The seg6_build_state() function is called with RCU read lock held,
so we cannot use GFP_KERNEL. This patch uses GFP_ATOMIC instead.
Fixes: 6c8702c60b886 ("ipv6: sr: add support for SRH encapsulation and injection with lwtunnels")
Signed-off-by: David Lebrun <redacted>
---
net/ipv6/seg6_iptunnel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: David Lebrun <hidden> Date: 2018-03-20 17:11:21
On 20/03/18 15:07, Eric Dumazet wrote:
This is not the proper fix.
Control path holds RTNL and can sleeep if needed.
RCU should be avoided in lwtunnel_build_state()
+Roopa
In lwtunnel_build_state(), the RCU protects the lwtunnel_encap_ops "ops" which is rcu-dereferenced. Moreover, the lwtunnel_state_alloc() function, which is used in all build_state functions, also uses GFP_ATOMIC, so this seemed a proper fix, or at least proper mitigation.
Do you suggest that the lwtunnel_encap_ops can be protected in a different way, not requiring RCU ?
From: Eric Dumazet <hidden> Date: 2018-03-20 17:20:17
On 03/20/2018 10:11 AM, David Lebrun wrote:
On 20/03/18 15:07, Eric Dumazet wrote:
quoted
This is not the proper fix.
Control path holds RTNL and can sleeep if needed.
RCU should be avoided in lwtunnel_build_state()
+Roopa
In lwtunnel_build_state(), the RCU protects the lwtunnel_encap_ops "ops" which is rcu-dereferenced. Moreover, the lwtunnel_state_alloc() function, which is used in all build_state functions, also uses GFP_ATOMIC, so this seemed a proper fix, or at least proper mitigation.
Do you suggest that the lwtunnel_encap_ops can be protected in a different way, not requiring RCU ?
Yes, GFP_ATOMIC might be an 'easy fix' for net tree,
but for the future, GFP_KERNEL allocations make more sense in control path.
Many scripts do not handle errors correctly and simply abort.
In case of failure, they might retry (busy poll) in the best scenario,
consuming cycles that might be needed to exit from pressure.
GFP_KERNEL allocations provide proper scheduling, they really should be the norm for control path.
From: David Miller <davem@davemloft.net> Date: 2018-03-22 16:22:28
From: Eric Dumazet <redacted>
Date: Tue, 20 Mar 2018 10:20:15 -0700
On 03/20/2018 10:11 AM, David Lebrun wrote:
quoted
On 20/03/18 15:07, Eric Dumazet wrote:
quoted
This is not the proper fix.
Control path holds RTNL and can sleeep if needed.
RCU should be avoided in lwtunnel_build_state()
+Roopa
In lwtunnel_build_state(), the RCU protects the lwtunnel_encap_ops "ops" which is rcu-dereferenced. Moreover, the lwtunnel_state_alloc() function, which is used in all build_state functions, also uses GFP_ATOMIC, so this seemed a proper fix, or at least proper mitigation.
Do you suggest that the lwtunnel_encap_ops can be protected in a different way, not requiring RCU ?
Yes, GFP_ATOMIC might be an 'easy fix' for net tree,
but for the future, GFP_KERNEL allocations make more sense in control path.
Agreed.
I'll apply this to net and queue it up for -stable, but long term making
this able to use GFP_KERNEL properly is the real way to go about it.