Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4677230pxj; Wed, 12 May 2021 10:39:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPuzcGAk3a3tRVwlUjkypQVlm57BfBTMXjFcEWk14HdVWS4U+ZMlnWArwsDe8tof+lpXPR X-Received: by 2002:a17:906:7842:: with SMTP id p2mr38145803ejm.487.1620841196487; Wed, 12 May 2021 10:39:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620841196; cv=none; d=google.com; s=arc-20160816; b=P8NebZOpCNW5mr/5gxsSr/HUKMXPz9d45j01jINiRJsj4aGKAvENVWDg35VRP3QuMU uGud81keGiIAoDL58PUwt4un+npHEuVXOIfp/ykXAIRrBt8Lg0Wkv9nAmITpQWcbn/JK pGyT4GxyC+XqbYJecisgU83CVEkqBkfC6qbQt71aq30fKdHP/srxlzRkXReWEzDjVb03 a5XeTjsDKUa/SZUvTCcfX1vmGW6nQPmxqDa10YlTujymLSlp3+77gVJPG+5x2lf7IzOC Zy76xbdORtOOsYlHR988INtSIUajCQ/ScYrj0Uqyxc/9dTDljaMKvk8n+HLRrOWs0Jrj VoYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=3RRNtQw/MGQ2xNnrJry8Z8iWUSxHJrYB11eenbS0sNk=; b=qrihhhYgyJ1EpYG+2lHHnCrzEq/Z7owqNH7/8RHSi0tGiD0NgynJunwTG9gmibkZ1g u7UObnRMYh4oDAIhJI61CQWmnHGTbfZOmbljjyg0sNLb+VW1+qRxerzdUcNCdNXiBgbM j27WeYN1m8GQwrNX4O8y4vyZJheW+Rha6a2+4GZEAHam/QLm29zBX3Fd6tMIJnxmkt/l x2MvaoXe+5zKCJ8wKcnS+wwbSzTwaDQ3P927hfzRJHWkP0TnJ1SLMirFx/uZekd7o3xW QMDynfvLM1/Ci75qU6pj6or6eei6fQZgiXFizTG73NXUYF6rH11Afz1XSyfOOlpBswzR DLSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ax9+eTqI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z23si480179ejf.679.2021.05.12.10.39.32; Wed, 12 May 2021 10:39:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ax9+eTqI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240673AbhELReO (ORCPT + 99 others); Wed, 12 May 2021 13:34:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:34634 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234285AbhELQIU (ORCPT ); Wed, 12 May 2021 12:08:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BDC2261447; Wed, 12 May 2021 15:39:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1620833956; bh=3OKE5hvIdwuXgAtAcX9qP9UHIBPfVufpxaoy+qmN7ik=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ax9+eTqIZr/T8ny36CIMXGA9hNYiTeTt9XbyhxfEPDGXfPAWU5nG5S/zjLcbQdn2T qPOwqL20LTk856KlTtKDU367ck3i3dA3AxM4oeR6uX48dP/RFymAX834uZPxeBcu8w eUcelaBUPJW2GP0qFvlCmVOjyJtRYoBeyK/GD7wHbr1RbbuwdOc6IS4l25COBK2Ja7 iu+uG26ufHxyBoZgBdISpfOm8q7sTncmgVeSdropTh79gPy81Kfu0hcfLyGW9KcCnc r5pDV9LfJZzg1KLwXF88yxTD8qEgSGadtSIACQ4/iSl9w0RmSOm7AVqyHtG8gaKCby 4IP1ixvg62zpg== Date: Wed, 12 May 2021 08:39:13 -0700 From: Jakub Kicinski To: Rocco yue Cc: "David S . Miller" , Matthias Brugger , Andrew Morton , Masahiro Yamada , Nick Desaulniers , Andy Shevchenko , Peter Zijlstra , Tetsuo Handa , , , , , Subject: Re: [PATCH][v3] rtnetlink: add rtnl_lock debug log Message-ID: <20210512083913.733f9803@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <20210511113257.2094-1-rocco.yue@mediatek.com> References: <20210511113257.2094-1-rocco.yue@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 11 May 2021 19:32:57 +0800 Rocco yue wrote: > We often encounter system hangs caused by certain process > holding rtnl_lock for a long time. Even if there is a lock > detection mechanism in Linux, it is a bit troublesome and > affects the system performance. We hope to add a lightweight > debugging mechanism for detecting rtnl_lock. > > Up to now, we have discovered and solved some potential bugs > through this lightweight rtnl_lock debugging mechanism, which > is helpful for us. > > When you say Y for RTNL_LOCK_DEBUG, then the kernel will > detect if any function hold rtnl_lock too long and some key > information will be printed out to help locate the problem. > > i.e: from the following logs, we can clearly know that the > pid=2206 RfxSender_4 process holds rtnl_lock for a long time, > causing the system to hang. And we can also speculate that the > delay operation may be performed in devinet_ioctl(), resulting > in rtnl_lock was not released in time. You can achieve that with a pair of fexit/fentry hooks or kprobes, and maybe a bit of BPF. No need for config options, and hardcoded parameters..