Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp6425602ybx; Mon, 11 Nov 2019 08:57:43 -0800 (PST) X-Google-Smtp-Source: APXvYqy4fYDG+YElCBvQlYeIqy9oI2ywdKMSlQ+NKa7cDzt/cmyWUjU35lm9+hXN65WLoHagbOHF X-Received: by 2002:a17:906:351b:: with SMTP id r27mr23988350eja.120.1573491463064; Mon, 11 Nov 2019 08:57:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573491463; cv=none; d=google.com; s=arc-20160816; b=XShx1IegRvp1sAUL/qursCLS803J2Ny8tSxi0+B35fviLs5QAHtbBd83+LdCqowlTI U4Z5Y9XXwikMoBPuyM7gNbVpBmu6K9SNiQMy1dPvrCvD55hm+caDNyWZUQ5LgyPztAr7 DWleFEOKsaCcIJuWOa/PuIaJ/V4NZ+qk5VxAcAzwPsl63j4uujUB99yh631oSjA8AXBG YSETOpRAGMyLwhd/snNqKVFt46Uxl5CGSJak9e8Po5Za2yH/F6uVnGJsKovaeZRcxrWT MPnIJsouFaETG5+EFu0l7+BbJzlW0p+zZQXhOUeyEfvfUucViootBmlfB7EM+LgXHi4f NJmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=jQ+E6czJ4DNaGOkMLTz7dyfB5cXcK4wWj6bFDEgy1h0=; b=LsFhQ/V7RF3dpV5qL4kU+S3kB4l8G9K6j7aAsZj8XJrXbKJWB/g4ay4YyRwOFYxpGZ IY7BR9U4QLXopLsG4+aok4A4hY6/jpApQxg4CEp37Mo9K7YMIjsE7w4TeVfVoU+RW5Iz ZQp/o+zBPLhwueDQNL7iL3YXpay2AWjoEOJM5DvDpT7tODzazIqkGnT8hqJXeulhfvst Ez+6TxvNa1rojNfdmxlJGJWSeJ6xiSf0cxOBmwiaM1x8SeboOn+R/Liy5pwV6y69C7d7 XY1W/WlyoWGbOv2EGXBEwBp3mamkaKzx+FHsdgWuTG36uH+mgyCvZ1UkpLlTxQPoDUac PS9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@networkplumber-org.20150623.gappssmtp.com header.s=20150623 header.b=ebFjG3a7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x19si9630276ejv.94.2019.11.11.08.57.18; Mon, 11 Nov 2019 08:57:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@networkplumber-org.20150623.gappssmtp.com header.s=20150623 header.b=ebFjG3a7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727126AbfKKQ4o (ORCPT + 99 others); Mon, 11 Nov 2019 11:56:44 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:36488 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726928AbfKKQ4n (ORCPT ); Mon, 11 Nov 2019 11:56:43 -0500 Received: by mail-pg1-f196.google.com with SMTP id k13so9821245pgh.3 for ; Mon, 11 Nov 2019 08:56:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jQ+E6czJ4DNaGOkMLTz7dyfB5cXcK4wWj6bFDEgy1h0=; b=ebFjG3a7GurRBYEtFEzgyjSkDQrPT+h3Oeke2Fjt6QWFc1kk89q1scDl25V3vMp0Z3 9RCiD+1QK1wu6ZSFHVD5gc4qxQ8wRwhW0jtrBlwLzEvFeOuYXX23CfnIPAwdJ6bk3lkO FIJS8C3imAMAgF+Q34zvN5SK9ucCPIvVramajPclRHIMIlmgq8l4oBAMcX0GlNsJI7A9 dUgVkCehUDS/bcO9t6QuxUUIZPngPGWnIqZBbQsEkVS4WvQy6u9BS+q7hKd2chF6QPa/ K58vsA3r9KTC9VBQHCJmtvUEMsENBGbHJIMdIT8iKdW+oa0gfgo83xuDaaypZnb5HGaX l3Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jQ+E6czJ4DNaGOkMLTz7dyfB5cXcK4wWj6bFDEgy1h0=; b=Chv2TUFSz4MhAHgN7G14tL4ZdekpqeO4Wkx2tfzYtWEo8G+iY3hhKhy53JMSVGxTuW Kd89Kxps1mP5dCUOfBXqWMN3P5/25Q9YyVJqnmjwQxcOUqnirz8Vq9Dhhwh0vXl51fSu 9T7XiCuAYKXJAhdgtuS25nqldkR2Gww/6CaciG8FwJpePetoUv9PP9gsZKljrAfIk/Zb 3ppU1LZ/nu/UktXxiXYJnuuJXBH7UYCniOB5xaHOPYqobkJjDlY/r7DmuLOx+6/o9xq0 kLoUT+3CnXL8DIept6b30si+Na6sUfg09gqzv26aq9AgVPWBe7tYzMZo8TL4g4C4veHF /8aA== X-Gm-Message-State: APjAAAUJLJZmi/e2nHWIUFImY+SXIlOOxTy99gtPAbAHaje3RRLlEazj dw1AtYkMUuR4KjCfnOUubgZbgfmctHngIw== X-Received: by 2002:a17:90a:22a6:: with SMTP id s35mr34591908pjc.3.1573491401372; Mon, 11 Nov 2019 08:56:41 -0800 (PST) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id r5sm15009594pfh.179.2019.11.11.08.56.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Nov 2019 08:56:41 -0800 (PST) Date: Mon, 11 Nov 2019 08:56:32 -0800 From: Stephen Hemminger To: Tony Lu Cc: davem@davemloft.net, shemminger@osdl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: remove static inline from dev_put/dev_hold Message-ID: <20191111085632.24d88706@hermes.lan> In-Reply-To: <20191111140502.17541-1-tonylu@linux.alibaba.com> References: <20191111140502.17541-1-tonylu@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 11 Nov 2019 22:05:03 +0800 Tony Lu wrote: > This patch removes static inline from dev_put/dev_hold in order to help > trace the pcpu_refcnt leak of net_device. > > We have sufferred this kind of issue for several times during > manipulating NIC between different net namespaces. It prints this > log in dmesg: > > unregister_netdevice: waiting for eth0 to become free. Usage count = 1 > > However, it is hard to find out who called and leaked refcnt in time. It > only left the crime scene but few evidence. Once leaked, it is not > safe to fix it up on the running host. We can't trace dev_put/dev_hold > directly, for the functions are inlined and used wildly amoung modules. > And this issue is common, there are tens of patches fix net_device > refcnt leak for various causes. > > To trace the refcnt manipulating, this patch removes static inline from > dev_put/dev_hold. We can use handy tools, such as eBPF with kprobe, to > find out who holds but forgets to put refcnt. This will not be called > frequently, so the overhead is limited. > > Signed-off-by: Tony Lu In the past dev_hold/dev_put was in the hot path for several operations. What is the performance implication of doing this?