Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1655520rbb; Mon, 26 Feb 2024 17:46:12 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWTu9yr4shOXUY4/A+qpR3E7HET26kbRHLFCwvqxw9b9ZiG/IHxb6Kp3nueKhhRCwf74xEsnNq16kMc0TWAeEhJNNXswGa8/JkqEmeqQA== X-Google-Smtp-Source: AGHT+IFwcJwoNRO5B+VD+zpB0IvNgEh3wEeW6GFNAgqu5spF+Fi6+Bc2dJ8Zk/vSH9kTEJfPgG28 X-Received: by 2002:a17:906:d96c:b0:a43:4ddb:a9cd with SMTP id rp12-20020a170906d96c00b00a434ddba9cdmr3192690ejb.37.1708998372702; Mon, 26 Feb 2024 17:46:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708998372; cv=pass; d=google.com; s=arc-20160816; b=MOfjKaqRLF9EP2NDGju1LFXRTI7/SFWsdnQEBX/yzHS5TCisH3+6tPoXkFQ1pH1E5l cLe27byo7O7I2cZv/6dBeCmrWOV5mPJJgf2nOSYanAxpG6wmrqdZ1znoxLSIKn2gIAT1 iFkFDR3+1Ehq4cQwooqGFOxdlb/HEgqfeW6e+8qFJDWCq7IjRQehNmUy3ROeMXG0Qtpr xMLX6IfzwqRkpO/kDPbHlp2L4RTw6pAPqOOCaAnPaDxyrfWHJzpA1131VFbsoKBl09lA VIx+JqRH7wVgjGiAv2PC20uuTp4TpDdxr0JnyZGh4dHWLGjfAR5+tVjoV1aqQbsqsap4 PFTw== 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=ZbqMnRaA46GLfxF9iAB19JjJ3wlbWWuu4pSU4SA/yuM=; fh=hy2Gx5YsJlzzzUllceSwV/VJ/pVTx7gDIjRmL8kMpRo=; b=CUNykCXLrFsF/o+0frCaFThuwRyxX04JxLmKxDHz1MoDxT0sOBL2dFuYPYwDfQVA/0 Q492WUg/mTkCwLd5Jo+jnO0VMlq77joye2ZiUybH4+uGzUwHDC77Rh7cafWVCWu6Jvf2 a6bTQ60LpehUM2wu41r/6HAESNRkuixHu0K11kJvr5t0iUKVOtd0iFW/BZ86N39bfr/Z 4XoluQDolyX092e62fmp/wDU8h8dGVqHNA6rUVoVelkKZYOEqr/iF3abIs8CpbCfYNoG nSZXCmtGK6A20rODQ4iee9shzsmmb6CEwe+F4wCwIIKbY1UxADGvZ1f9kBfgfKRHKXPI CX4g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-82551-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82551-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id c16-20020a170906171000b00a4305d78651si250832eje.99.2024.02.26.17.46.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 17:46:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82551-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-82551-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82551-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 74E741F250B9 for ; Tue, 27 Feb 2024 01:46:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B43F710A0D; Tue, 27 Feb 2024 01:45:59 +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 2E3BC2916; Tue, 27 Feb 2024 01:45:58 +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=1708998359; cv=none; b=qaNfWJtHf/M9o9HJXZnDpl0QwsnBwz4FUy1zMZJV/ITIaWeFpqLKyIORATpwbPO6IfiP98qPz2kiqlDLefIm8pZFZiY4gbWq/PiFU12f1ayt7cOKE14wi2VY82c3oStYPB7n+mz2SHmGMff9U7SMEpX2V0pDmNN04QHeOjgmcH8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708998359; c=relaxed/simple; bh=LuyC8MIBSY/6X2DV9kyguJMcgXgow64FfJ55DNaRInI=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=O+i56kCQXs5W5iL0+lwW2FrMlDhSxL0YgIUNKqQ6MmEAlG+ZY/76u4yYuJGamB3OjmmiGYhogclfPzRPcZue4sTK01ptkdgZClNhXjRfhiSFKJHrjbuQqmqPjPtzSciRCH+SbcC2SwNmI5/MUr1FbleT6GxQSXyUOwJH8PyX8Q0= 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 B6A64C43390; Tue, 27 Feb 2024 01:45:56 +0000 (UTC) Date: Mon, 26 Feb 2024 20:47:57 -0500 From: Steven Rostedt To: Huang Yiwei Cc: , , , , , , , , , , , , , , , , Ross Zwisler , Joel Fernandes Subject: Re: [PATCH v5] tracing: Support to dump instance traces by ftrace_dump_on_oops Message-ID: <20240226204757.1a968a10@gandalf.local.home> In-Reply-To: <20240208131814.614691-1-quic_hyiwei@quicinc.com> References: <20240208131814.614691-1-quic_hyiwei@quicinc.com> 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, 8 Feb 2024 21:18:14 +0800 Huang Yiwei wrote: > Currently ftrace only dumps the global trace buffer on an OOPs. For > debugging a production usecase, instance trace will be helpful to > check specific problems since global trace buffer may be used for > other purposes. > > This patch extend the ftrace_dump_on_oops parameter to dump a specific > or multiple trace instances: > > - ftrace_dump_on_oops=0: as before -- don't dump > - ftrace_dump_on_oops[=1]: as before -- dump the global trace buffer > on all CPUs > - ftrace_dump_on_oops=2 or =orig_cpu: as before -- dump the global > trace buffer on CPU that triggered the oops > - ftrace_dump_on_oops=: new behavior -- dump the > tracing instance matching > - ftrace_dump_on_oops[=2/orig_cpu],[=2/orig_cpu], > [=2/orig_cpu]: new behavior -- dump the global trace > buffer and multiple instance buffer on all CPUs, or only dump on CPU > that triggered the oops if =2 or =orig_cpu is given So we need to add that the syntax is: ftrace_dump_on_oops[=[<0|1|2|orig_cpu>,][[=<1|2|orig_cpu>][,...]] > > Also, the sysctl node can handle the input accordingly. > > Cc: Ross Zwisler > Signed-off-by: Joel Fernandes (Google) > Signed-off-by: Huang Yiwei > --- > .../admin-guide/kernel-parameters.txt | 26 ++- > Documentation/admin-guide/sysctl/kernel.rst | 30 +++- > include/linux/ftrace.h | 4 +- > include/linux/kernel.h | 1 + > kernel/sysctl.c | 4 +- > kernel/trace/trace.c | 156 +++++++++++++----- > kernel/trace/trace_selftest.c | 2 +- > 7 files changed, 168 insertions(+), 55 deletions(-) > > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt > index 31b3a25680d0..3d6ea8e80c2f 100644 > --- a/Documentation/admin-guide/kernel-parameters.txt > +++ b/Documentation/admin-guide/kernel-parameters.txt > @@ -1561,12 +1561,28 @@ > The above will cause the "foo" tracing instance to trigger > a snapshot at the end of boot up. > > - ftrace_dump_on_oops[=orig_cpu] > + ftrace_dump_on_oops[=2(orig_cpu) | =][, | > + ,=2(orig_cpu)] > [FTRACE] will dump the trace buffers on oops. > - If no parameter is passed, ftrace will dump > - buffers of all CPUs, but if you pass orig_cpu, it will > - dump only the buffer of the CPU that triggered the > - oops. > + If no parameter is passed, ftrace will dump global > + buffers of all CPUs, if you pass 2 or orig_cpu, it > + will dump only the buffer of the CPU that triggered > + the oops, or the specific instance will be dumped if > + its name is passed. Multiple instance dump is also > + supported, and instances are separated by commas. Each > + instance supports only dump on CPU that triggered the > + oops by passing 2 or orig_cpu to it. > + > + ftrace_dump_on_oops=foo=orig_cpu > + > + The above will dump only the buffer of "foo" instance > + on CPU that triggered the oops. > + > + ftrace_dump_on_oops,foo,bar=orig_cpu I believe the above is incorrect. It should be: ftrace_dump_on_oops=foo,bar=orig_cpu And you can add here as well: ftrace_dump_on_oops[=[<0|1|2|orig_cpu>,][[=<1|2|orig_cpu>][,...]] Thanks, --Steve > + > + The above will dump global buffer on all CPUs, the > + buffer of "foo" instance on all CPUs and the buffer > + of "bar" instance on CPU that triggered the oops. > > ftrace_filter=[function-list]