From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03E46C433FE for ; Fri, 11 Dec 2020 17:20:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C670023DC2 for ; Fri, 11 Dec 2020 17:20:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732956AbgLKQLV (ORCPT ); Fri, 11 Dec 2020 11:11:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390382AbgLKQLL (ORCPT ); Fri, 11 Dec 2020 11:11:11 -0500 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96760C0613CF for ; Fri, 11 Dec 2020 08:10:29 -0800 (PST) Received: by mail-ot1-x32c.google.com with SMTP id x13so8662538oto.8 for ; Fri, 11 Dec 2020 08:10:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=t1AamKEB8573/0gwWabz8y5LwEeV/syrC78MuWy5qpc=; b=CnaS7F3jdu+PwA3Ac84kNeDMu7+QyYeJ26OqiHz9bkzLyZFs/VcrgphShLA3Kc++Sw RjAg+Kpr1IVxgoX1UFzSMnqKvg/Vx0OqtOGV1o3TSybYwE5J3IoMOOk9kqP5Oa80H78l UopcvFxPdWMUq0JXab+eZTwWzPAla7e0zIYGlylgC4r8nOPL/82vSiy2f3EBTDab4yU2 AWbCtrc8Naz79IxsjsLCViH9CZJYLM8tCiunEVicbpxQAzjPv9KBtauoue3V/I+XtRE2 3z8ZGdKusrd1Q1lpkWJGq5kb/boWnpWyzPVWDGTtjIo873zUmSSQtO44fPFM9HAwYAEa 0s8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=t1AamKEB8573/0gwWabz8y5LwEeV/syrC78MuWy5qpc=; b=mUqkUF5cshd7HJxgESfrjfSo2myPuPJNho2T6ZLZop7PNIkBkQQICpdH1uLgQQmI27 ltW0yGSOk87VMgl4VWM21ZN7u9HTGAhnGWHyQE3Effl446TLACsyLaIQYgykvgAZHNlh aXSQmfzkpd1GhbuNK0xbSHZEbRW9gaFr6+G9OfuOiEDH+yGks9xnQEmF+gMHWYPZNusP PjmWO2uIKNlG8aasRNELU0J+gqnm6gWHc840chL7itr1l4WS/ix+kxpkrNqZJdPhsiun 6RwGdBOkFCEaR6NlJGlS0wYMBzL90m/FVPfW0xfyZImGkT0SnxjMxiDWlNipwmH6yKa0 sBmg== X-Gm-Message-State: AOAM5301iRVg0S3sjcn/I/Q0CE6j+oh9BU8guhBsIj4SW5E5naOYxF6/ 67tAydVzAn+ElJqR7m62zWQ= X-Google-Smtp-Source: ABdhPJwyTffKCOsXL3Ep9EpfYtUlt1TzVJYzZBmnXocIwhRJhOs52agbgw3k7x39eluRhPUx7oYmwA== X-Received: by 2002:a05:6830:1bef:: with SMTP id k15mr2071525otb.303.1607703029042; Fri, 11 Dec 2020 08:10:29 -0800 (PST) Received: from Davids-MacBook-Pro.local ([2601:282:800:dc80:6139:6f39:a803:1a61]) by smtp.googlemail.com with ESMTPSA id i1sm999013otr.81.2020.12.11.08.10.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 11 Dec 2020 08:10:28 -0800 (PST) Subject: Re: Refcount mismatch when unregistering netdevice from kernel To: stranche@codeaurora.org Cc: Wei Wang , Eric Dumazet , Martin KaFai Lau , Mahesh Bandewar , Jakub Kicinski , Linux Kernel Network Developers , Subash Abhinov Kasiviswanathan References: <56e72b72-685f-925d-db2d-d245c1557987@gmail.com> <307c2de1a2ddbdcd0a346c57da88b394@codeaurora.org> <6a314f7da0f41c899926d9e7ba996337@codeaurora.org> From: David Ahern Message-ID: <839f0ad6-83c1-1df6-c34d-b844c52ba771@gmail.com> Date: Fri, 11 Dec 2020 09:10:26 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <6a314f7da0f41c899926d9e7ba996337@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 12/10/20 6:12 PM, stranche@codeaurora.org wrote: >>> BTW, have you tried your previous proposed patch and confirmed it >>> would fix the issue? >>> > > Yes, we shared this with the customer and the refcount mismatch still > occurred, so this doesn't seem sufficient either. > >>> Could we further distinguish between dst added to the uncached list by >>> icmp6_dst_alloc() and xfrm6_fill_dst(), and confirm which ones are the >>> ones leaking reference? >>> I suspect it would be the xfrm ones, but I think it is worth verifying. >>> > > After digging into the DST allocation/destroy a bit more, it seems that > there are some cases where the DST's refcount does not hit zero, causing > them to never be freed and release their references. > One case comes from here on the IPv6 packet output path (these DST > structs would hold references to both the inet6_dev and the netdevice) > ip6_pol_route_output+0x20/0x2c -> ip6_pol_route+0x1dc/0x34c -> > rt6_make_pcpu_route+0x18/0xf4 -> ip6_rt_pcpu_alloc+0xb4/0x19c This is the normal data path, and this refers to a per-cpu dst cache. Delete the route and the cached entries get removed. > > We also see two DSTs where they are stored as the xdst->rt entry on the > XFRM path that do not get released. One is allocated by the same path as > above, and the other like this > xfrm6_esp_err+0x7c/0xd4 -> esp6_err+0xc8/0x100 -> > ip6_update_pmtu+0xc8/0x100 -> __ip6_rt_update_pmtu+0x248/0x434 -> > ip6_rt_cache_alloc+0xa0/0x1dc This entry goes into an exception cache. I have lost track of kernel versions and features. Try listing the route cache to see these: ip -6 ro ls cache