From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f65.google.com ([74.125.83.65]:43982 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751186AbeCTRUR (ORCPT ); Tue, 20 Mar 2018 13:20:17 -0400 Received: by mail-pg0-f65.google.com with SMTP id i9so877652pgq.10 for ; Tue, 20 Mar 2018 10:20:17 -0700 (PDT) Subject: Re: [PATCH net] ipv6: sr: fix scheduling in RCU when creating seg6 lwtunnel state To: David Lebrun , Eric Dumazet , netdev@vger.kernel.org Cc: David Lebrun , Roopa Prabhu References: <20180320144456.223556-1-dav.lebrun@gmail.com> From: Eric Dumazet Message-ID: <61d63ddf-eefa-3eca-25b4-51e2c9db2fc7@gmail.com> Date: Tue, 20 Mar 2018 10:20:15 -0700 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org List-ID: On 03/20/2018 10:11 AM, David Lebrun wrote: > 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 ? 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.