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=-0.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS autolearn=ham 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 73289C43218 for ; Sun, 28 Apr 2019 03:24:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 31B6D206C1 for ; Sun, 28 Apr 2019 03:24:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mXaXntMB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726341AbfD1DWo (ORCPT ); Sat, 27 Apr 2019 23:22:44 -0400 Received: from mail-it1-f178.google.com ([209.85.166.178]:52548 "EHLO mail-it1-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726279AbfD1DWo (ORCPT ); Sat, 27 Apr 2019 23:22:44 -0400 Received: by mail-it1-f178.google.com with SMTP id x132so11728162itf.2 for ; Sat, 27 Apr 2019 20:22:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=vPVTVmGlNbY3yzTg9zK1qOIKcyDuGW7XBgp6e9gtN7g=; b=mXaXntMBO4yg7wer5k4afhK270HaNkTSkz9xlDj982MvbZGPuyoHXhLpRwYZPQI6qM cdHi4r8WsDNi1yMTy09C9tNFrZtIH+pEuzbaUvrI66UxgO8qQoRzYBae3S0PsY5NxpFL fRCn7zcZTHKN6TYfzIdwdRLRUoUIq1SEAelBqLi7V96aGO8EBtRVimse8ZqNY5K4enBP j4p12e03K6zuIL8u/psA9nQlbp3an1eqxgA98YmnccW+AwvI1x1KY6X7Ji4lPEDGoufM XjthSzeUu3rtvBdKg3jCfQF0FqzY81uRbTfpy+zy4YzcAmq3PFyDqG/EHnt52wku2VCR ywRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=vPVTVmGlNbY3yzTg9zK1qOIKcyDuGW7XBgp6e9gtN7g=; b=JIigcIb8lB4gdTm3DKbPm5PYWTcaKhSTW/q+t2WTDz6bY5rA6miLxqfTq88QIyEPSy rc/NiHx8tbokFDxsITpBhja2gpXMQ6ZjLJt8OzyQOVxk2ya1GPK+jq9AWjz0me3XTSHY kNMp9kYwwaEX5iglkPrK5NesyLYjsSLeMNeFkQKem68OCzWaJbDKCcMo22P6lAaZ3P7k l/6HiwlSNlJbISx+u2+Kb4OfBLXkm16W4qWedoGH7Hp+ai+pjZB0UwyysRfVPq5oI44w CtAwQcmkWs5UBRzSIuHTLEEyakw1QfqMLUfRFXreQz/ZQwoHHApBI06WmISPsMsmTMEo RiFA== X-Gm-Message-State: APjAAAXEx7MZWcDZ/NsrLic74kQltfeUIB8YzJWf4SOTx/k5uWbSHU3M r8tpOSeYDWEbrOX3fwF7faHUlcAf X-Google-Smtp-Source: APXvYqyd2tMfwHBRuRa298p1nWTebXCiWt3Y3NC/ehs7jHWouS5q0i3Q5MIfXLd9+HTObVQFIRnwQg== X-Received: by 2002:a24:7bcb:: with SMTP id q194mr14303642itc.173.1556421763505; Sat, 27 Apr 2019 20:22:43 -0700 (PDT) Received: from ?IPv6:2601:282:800:fd80:adce:4a1:6f34:b527? ([2601:282:800:fd80:adce:4a1:6f34:b527]) by smtp.googlemail.com with ESMTPSA id n184sm16890317itc.28.2019.04.27.20.22.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 27 Apr 2019 20:22:42 -0700 (PDT) Subject: Re: About ip6_dst_destroy() To: Eric Dumazet , Networking References: <3e01083c-ba34-e515-bb3d-d85a98f90e61@gmail.com> From: David Ahern Message-ID: Date: Sat, 27 Apr 2019 21:22:41 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <3e01083c-ba34-e515-bb3d-d85a98f90e61@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 4/27/19 5:56 PM, Eric Dumazet wrote: > David > > I am staring at ip6_dst_destroy() and the last part makes really no sense to me. > > How rcu_read_lock()/rcu_read_unnlock() can help in a writer side ??? > > Changlog of a68886a691804d3f6d479ebf6825480fbafb6a00 ("net/ipv6: Make from in rt6_info rcu protected") > does not make sense either. > > > There is a race window when a FIB entry is deleted and the 'from' on the > pcpu route is dropped and the pcpu route hits a cookie check. Handle > this race using rcu on from. > > A FIB entry (fib6_info) is deleted, but resources are not cleaned up as there are outstanding references to the entry. Specifically, the references are the 'from' on pcpu routes. Commit (93531c6743157) added code to release those references as otherwise there is nothing that forces it. Further testing hit the condition noted in a68886a69180. I presume you are asking about ip6_dst_destroy vs all of the other 'from' references because of the fib6_info_release - which would result in an underflow when it is released twice. I guess something like a rmb() / wmb() pair is needed for this case.