Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp558626rdb; Thu, 1 Feb 2024 17:46:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IEfcj7cVu9WsKRJ4dQByYr5FyzJL4Azx/4zQ2p9RyNrtqMsC8uigJau7mQYB/QeybibG0L9 X-Received: by 2002:a05:6a20:c31f:b0:19a:1cff:f574 with SMTP id dk31-20020a056a20c31f00b0019a1cfff574mr6525473pzb.36.1706838388182; Thu, 01 Feb 2024 17:46:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706838388; cv=pass; d=google.com; s=arc-20160816; b=dac3sF+Qg8dVokHgFbb5LmL8ta2o/Zn+iiAcD1EJjTjV1bXLeDIojXfsDwXXrC6jSU 6e+PCIdfU09e1RAmlIb0Ew2uk/BM91tRB1sR4DGujbUYB5RptkkhTTsQkXGUHkVuSwFJ 6MNCMH7jeC+RFx+bGRi2JtP0pUnC2sgYyoBfuiZAgar70p8E2NoxvHjKf1Vj/veV7mtm SBUnB2Ei4SySAFjugCKS4XlD6yH2Aix8HVqSIbZL0SRlFot4+CzP8tP0EGxRwcT8GlMo 7lTn6aFDceelOMgmEaOzD/zkLVUxeP5Dh/nwFwo1mZd/g8Zqx67296mUhtZznSO1iWfu jYmg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date; bh=+MWDwQudCqBp926Jj+1av+XOXDmy1OpmeH7RpWWaw5k=; fh=rd9SA2E+/Ii5EhQqKaZh+d4ZKykbrvEBXE7YTQiOi0s=; b=zeJFX+tb8Mg2xuLC2fD5KL6zzCDrDbz1N20RjPsVG23KjPRTv3KBba0aZfSuZUoCRK 0O3rjfbkec5vMHkCdtAqriMDEtCY8GxB3NvyMJsdlE2tc4uiSR4MjKDP+1fZvV3y32Xz JL+KXw/3T4n1Cau9ZnekSzqmtcsBQsZgtK4r7iRer0m+UaUnoovfuMDTJngW+LysnVgy YYbt4rZhvbtF5cBo3Hvt5lwjuxkbrpB4Y13538bQMUbvXB/0cbQlNtn3Dd2xCt++q1ja NS3WS1+DYoeDbkD7CmfjjzUFyk7Gx023U5ixhIwxp9fdGltGHZIDGo7OFGp1JVFldE9W jkKg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-49072-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49072-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCXJP1yvnbYhi4Lq/lUxq3TYiUysCEaI58zmurkH6+JKQOLr7yr4zIqJ5c+yI3ngT3sZTvuqjLgRUQf4LYqk/OzFMH2IlyKjadVB0gdg1Q== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id g8-20020a056a0023c800b006dddd2876dfsi629052pfc.295.2024.02.01.17.46.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 17:46:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49072-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-49072-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49072-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D341F28CB37 for ; Fri, 2 Feb 2024 01:46:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 138D26FA5; Fri, 2 Feb 2024 01:46:22 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A2D4BA2C; Fri, 2 Feb 2024 01:46:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706838381; cv=none; b=B/JrEC0XpRf2TQareOA1zXf9fsaEgon4MHQk75sqHqzAJ3M6j4HfOdOhuy9rVs+ga23hCpDzhlWLD32c8ANpwInKKD+dnMHIoj/ErnujbDOKFWu9NzTlwmJChbr1XAMRDSZXqLr8bs57kqoVlkjkJdzRxoE52oAzfODvxFU1RWM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706838381; c=relaxed/simple; bh=zQL/rMBDuoXBWrWx5GoEV+Lp22Ug6QFEu8XoV5dB1T0=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hNCnw6Y1xilQE01qioVhjAQmkKmjIQMe0hDqyMOnHH4YYplatcWKjuNQJv/7Q64zsQ0gt2DEly05vMtYdJjog0MjxZPoxtgMKYU4ynNmD9DuBoPOgL3oUdSmmn7fTpJ4OKCMafNTvUIVi+1d87RTJ3ITwBKuFX1bPk9HCCHzkDk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62967C433C7; Fri, 2 Feb 2024 01:46:20 +0000 (UTC) Date: Thu, 1 Feb 2024 20:46:37 -0500 From: Steven Rostedt To: Ahmad Fatoum Cc: linux-trace-kernel@vger.kernel.org, Masami Hiramatsu , "linux-kernel@vger.kernel.org" , Pengutronix Kernel Team Subject: Re: Boot-time dumping of ftrace fuctiongraph buffer Message-ID: <20240201204637.2afab2db@gandalf.local.home> In-Reply-To: References: X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 1 Feb 2024 13:21:37 +0100 Ahmad Fatoum wrote: > Hello, > > I semi-regularly debug probe failures. For drivers that use dev_err_probe > rigorously, this is a quick matter: The probe function records a deferral reason > and if the deferral persists, deferred_probe_timeout_work_func() will print > the collected reasons, even if PID 1 is never started. > > For drivers that don't call dev_err_probe, I find myself sometimes doing printf > debugging inside the probe function. Is the driver built in or started after init? > > I would like to replace this with the function graph tracer: > > - record the probe function, configured over kernel command line > (The device indefinitely deferring probe is printed to the console, > so I know what I am looking for on the next boot) > > - Dump the function graph trace > > - See if the last call before (non-devm) cleanup is getting a clock, a GPIO, > a regulator or w/e. > > For this to be maximally useful, I need to configure this not only at boot-time, > but also dump the ftrace buffer at boot time. Probe deferral can hinder the kernel from > calling init and providing a shell, where I could read /sys/kernel/tracing/trace. OK so the driver is built in. > > I found following two mechanisms that looked relevant, but seem not to > do exactly what I want: > > - tp_printk: seems to be related to trace points only and not usable > for the function graph output > > - dump_on_oops: I don't get an Oops if probe deferral times out, but maybe > one could patch the kernel to check a oops_on_probe_deferral or dump_on_probe_deferral > kernel command line parameter in deferred_probe_timeout_work_func()? > > > Is there existing support that I am missing? Any input on whether this > would be a welcome feature to have? Well you can start function_graph on the kernel command line and event filter on a give function ftrace=function_graph function_graph_filter=probe_func You can add your own ftrace_dump() on some kind of detected error and put that in the kernel command line. For example RCU has: rcupdate.rcu_cpu_stall_ftrace_dump= Which will do a ftrace dump when a RCU stall is triggered. -- Steve