Linux Trace Kernel
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Vincent Donnefort" <vdonnefort@google.com>,
	linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH v10 17/19] tracing/remotes: Add trace_remote cmdline options
Date: Thu, 03 Dec 2026 19:58:36 +0000	[thread overview]
Message-ID: <sashiko-outbox-248579@kernel.org> (raw)
In-Reply-To: <20261203190007.2431041-18-vdonnefort@google.com>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] tracing/remotes: trace_remote_apply_cmdline() breaks arm64
  non-pKVM nVHE boot
- [Low] tracing/remotes: buf_size= accepts sub-KiB values causing
  buffer_size_kb 0
- [Low] tracing/remotes: commit message omits supported trace_remote=
  options
--

commit a2c801edeccc3e60146d0407c3cc18baac9e6aec
Author: Vincent Donnefort <vdonnefort@google.com>

> tracing/remotes: Add trace_remote cmdline options
>
> Following the same format as trace_instance, add a cmdline to configure
> a trace remote on registration:
>
>   trace_remote=<remote>^<opt1>^<opt2>,<evt1>,<evt2>
>
> Enabling events automatically turns on tracing.
>
> Signed-off-by: Vincent Donnefort <vdonnefort@google.com>

[Severity: Low]
This isn't a bug, but the commit message only shows <opt1>^<opt2>
placeholders and omits the four options added here (dump_on_panic, dmesg,
buf_size=<size>, and poll=<ms>), their units, and support for repeating
trace_remote=.  Even though commit "Documentation/kernel-parameters: Add
trace_remote" documents them in kernel-parameters.txt, listing them here
would make this changelog self-contained.

> diff --git a/kernel/trace/trace_remote.c b/kernel/trace/trace_remote.c
> index 7a79e43dcd46a..70415ecf45b72 100644
> --- a/kernel/trace/trace_remote.c
> +++ b/kernel/trace/trace_remote.c

[ ... ]

> @@ -1177,6 +1179,136 @@ static int poll_ms_show(struct seq_file *s, void *unused)

[ ... ]

> +static bool trace_remote_apply_cmdline_opts(struct trace_remote *remote, char *cmdline)
> +{

[ ... ]

> +		} else if (!strncmp(opt, "buf_size=", 9)) {
> +			unsigned long long size;
> +			char *end;
> +
> +			size = memparse(opt + 9, &end);
> +			if (!*end && size && size < ULONG_MAX)
> +				WRITE_ONCE(remote->trace_buffer_size, size);
> +			else
> +				pr_warn("Invalid trace remote buffer size '%s'\n", opt);

[Severity: Low]
Should buf_size= require at least SZ_1K?  memparse() parses bytes, so a
sub-KiB value like buf_size=512 is accepted here and then displayed as 0
by buffer_size_kb_show() (which shifts trace_buffer_size right by 10),
even though buffer_size_kb_write() rejects 0 KiB as invalid.

[ ... ]

> @@ -1353,6 +1485,7 @@ int trace_remote_register(const char *name, struct trace_remote_callbacks *cbs,
>  	}
>  
>  	list_add(&remote->node, &trace_remotes);
> +	trace_remote_apply_cmdline(name, remote);
>  	retain_and_null_ptr(remote);
>  
>  	return 0;

[Severity: High]
Can calling trace_remote_apply_cmdline() synchronously here break arm64
non-pKVM nVHE boot?

On non-pKVM nVHE, init_subsystems() calls kvm_hyp_trace_init() ->
trace_remote_register("hypervisor", ...) inside a temporary EL2 window
and immediately tears EL2 back down:

arch/arm64/kvm/arm.c:init_subsystems() {
    ...
	err = kvm_hyp_trace_init();
	if (err)
		kvm_err("Failed to initialize Hyp tracing\n");

out:
	if (err)
		hyp_cpu_pm_exit();

	if (err || !is_protected_kvm_enabled())
		on_each_cpu(cpu_hyp_uninit, NULL, 1);
    ...
}

When booted with trace_remote=hypervisor,<evt> or
trace_remote=hypervisor^dmesg, trace_remote_apply_cmdline() starts
periodic EL2 hypercall workers (hyp_clock.work and/or remote->poll_work)
before cpu_hyp_uninit() restores __hyp_stub_vectors.

Subsequent kvm_call_hyp_nvhe() calls from those workers then fail against
__hyp_stub_vectors and trigger repeated WARN_ON(res.a0 != SMCCC_RET_SUCCESS)
splats in __kvm_call_hyp_nvhe() (continuously with kvm.enable_virt_at_load=0,
or if kvm_init() fails and runs teardown_hyp_mode()).

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261203190007.2431041-1-vdonnefort@google.com?part=17

  reply	other threads:[~2026-12-03 19:58 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 18:59 [PATCH v10 00/19] tracing/remotes: Add printk, dump_on_panic and boot parameters Vincent Donnefort
2026-12-03 18:59 ` [PATCH v10 01/19] tracing/remotes: Gate tracefs files opening on trace remote registration Vincent Donnefort
2026-12-03 19:20   ` sashiko-bot
2026-12-03 18:59 ` [PATCH v10 02/19] tracing/remotes: Release tracefs,eventfs on registration failure Vincent Donnefort
2026-12-03 19:24   ` sashiko-bot
2026-12-03 18:59 ` [PATCH v10 03/19] tracing/remotes: Use kstrtobool for boolean tracefs files Vincent Donnefort
2026-12-03 18:59 ` [PATCH v10 04/19] tracing/remotes: Initialise pos in trace_start() Vincent Donnefort
2026-12-03 19:18   ` sashiko-bot
2026-12-03 18:59 ` [PATCH v10 05/19] tracing/remotes: Annotate remote shared fields with READ_ONCE/WRITE_ONCE Vincent Donnefort
2026-12-03 19:19   ` sashiko-bot
2026-12-03 18:59 ` [PATCH v10 06/19] tracing/remotes: Use a single per-remote polling work Vincent Donnefort
2026-12-03 18:59 ` [PATCH v10 07/19] tracing/simple_ring_buffer: Add support for compressed length Vincent Donnefort
2026-12-03 18:59 ` [PATCH v10 08/19] tracing/remotes: Add dmesg tracefs file Vincent Donnefort
2026-12-03 19:43   ` sashiko-bot
2026-12-03 18:59 ` [PATCH v10 09/19] tracing/remotes: selftests: Add a test for the " Vincent Donnefort
2026-12-03 19:39   ` sashiko-bot
2026-12-03 18:59 ` [PATCH v10 10/19] tracing/remotes: selftests: Prefix hypervisor folder Vincent Donnefort
2026-12-03 18:59 ` [PATCH v10 11/19] ring-buffer: Use panic-friendly locking in ring_buffer_iter interface Vincent Donnefort
2026-12-03 19:38   ` sashiko-bot
2026-12-03 19:00 ` [PATCH v10 12/19] ring-buffer: Add kerneldoc for ring_buffer_poll_remote Vincent Donnefort
2026-12-03 19:00 ` [PATCH v10 13/19] tracing/remotes: Use ring_buffer_capacity() in trace_remote_has_cpu() Vincent Donnefort
2026-12-03 19:00 ` [PATCH v10 14/19] tracing/remotes: Add dump_on_panic tracefs file Vincent Donnefort
2026-12-03 19:52   ` sashiko-bot
2026-12-03 19:00 ` [PATCH v10 15/19] tracing/remotes: selftests: Add a test for the " Vincent Donnefort
2026-12-03 19:50   ` sashiko-bot
2026-12-03 19:00 ` [PATCH v10 16/19] tracing/remotes: Add poll_ms " Vincent Donnefort
2026-12-03 19:50   ` sashiko-bot
2026-12-03 19:00 ` [PATCH v10 17/19] tracing/remotes: Add trace_remote cmdline options Vincent Donnefort
2026-12-03 19:58   ` sashiko-bot [this message]
2026-12-03 19:00 ` [PATCH v10 18/19] Documentation: tracing/remotes: Add detailed tracefs layout Vincent Donnefort
2026-12-03 19:48   ` sashiko-bot
2026-12-03 19:00 ` [PATCH v10 19/19] Documentation/kernel-parameters: Add trace_remote Vincent Donnefort
2026-12-03 19:53   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-248579@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vdonnefort@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox