All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Wei Li" <liwei1412@hotmail.com>
Cc: linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH 5/6] tools/rv: Parse the mixed enable state of containers
Date: Wed, 04 Nov 2026 09:39:06 +0000	[thread overview]
Message-ID: <sashiko-outbox-196976@kernel.org> (raw)
In-Reply-To: <CY8PR19MB700974075298C61A1DB70C3EB7682@CY8PR19MB7009.namprd19.prod.outlook.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] tools/rv: ikm_run_monitor() still treats mixed-state container as enabled
--

commit 46a912d6c838892960e060f3a3369c5f213319f7
Author: Wei Li <liwei391@huawei.com>

tools/rv: Parse the mixed enable state of containers

This commit updates __ikm_read_enable() to parse the "X" mixed enable state
of containers as 2 and displays such containers as [MIX] in rv list.

> diff --git a/tools/verification/rv/src/in_kernel.c b/tools/verification/rv/src/in_kernel.c
> index e6dea4040f8f4..0f2e9f1eca51f 100644
> --- a/tools/verification/rv/src/in_kernel.c
> +++ b/tools/verification/rv/src/in_kernel.c
> @@ -29,21 +29,38 @@ static char *config_reactor;
>   *
>   * __does not log errors.
>   *
> - * Returns the current status, or -1 if the monitor does not exist,
> - * __hence not logging errors.
> + * Returns 0 if disabled, 1 if enabled, 2 if a container with children
> + * in mixed states, or -1 if the monitor does not exist, __hence not
> + * logging errors.
>   */
>  static int __ikm_read_enable(char *monitor_name)
>  {
>  	char path[MAX_PATH];
> -	long long enabled;
> -	int retval;
> +	char *buffer;
> +	int enabled;
>  
>  	snprintf(path, MAX_PATH, "rv/monitors/%s/enable", monitor_name);
>  
> -	retval = tracefs_instance_file_read_number(NULL, path, &enabled);
> -	if (retval < 0)
> +	buffer = tracefs_instance_file_read(NULL, path, NULL);
> +	if (!buffer)
>  		return -1;
>  
> +	switch (buffer[0]) {
> +	case '0':
> +		enabled = 0;
> +		break;
> +	case '1':
> +		enabled = 1;
> +		break;
> +	case 'X':
> +		enabled = 2;
> +		break;
> +	default:
> +		enabled = -1;
> +	}
> +
> +	free(buffer);
> +
>  	return enabled;
>  }

[Severity: Medium]
The commit message notes that rv fails to start a container in a mixed state
because rv mon takes the return value of __ikm_read_enable() as a true value
and reports a spurious "already enabled" message.

However, in tools/verification/rv/src/in_kernel.c, ikm_run_monitor() still
checks for any non-zero return value from __ikm_read_enable():

	retval = __ikm_read_enable(full_name);
	if (retval) {
		err_msg("ikm: monitor %s (in-kernel) is already enabled\n", nested_name);
		return -1;
	}

When a container has children in mixed states, __ikm_read_enable() now
returns 2, which is still non-zero (as is -1 on read errors). Won't
ikm_run_monitor() still treat a mixed-state container as already enabled and
refuse to start it?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/CY8PR19MB70098BF493A3B67418C7B9ABB7682@CY8PR19MB7009.namprd19.prod.outlook.com?part=5

  reply	other threads:[~2026-11-04  9:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-04  9:21 [PATCH 0/6] rv: Expose and preserve nested monitor states Wei Li
2026-11-04  9:21 ` [PATCH 1/6] rv: Mark diverged child reactors with a star Wei Li
2026-11-04  9:21 ` [PATCH 2/6] rv: Update monitors through a quiesce helper Wei Li
2026-11-04  9:32   ` sashiko-bot
2026-11-04  9:21 ` [PATCH 3/6] rv: Show the mixed enable state of containers Wei Li
2026-11-04  9:37   ` sashiko-bot
2026-11-04  9:21 ` [PATCH 4/6] Documentation/rv: Document the enable and reactor states Wei Li
2026-11-04  9:21 ` [PATCH 5/6] tools/rv: Parse the mixed enable state of containers Wei Li
2026-11-04  9:39   ` sashiko-bot [this message]
2026-11-04  9:21 ` [PATCH 6/6] rv: Do not send the trailing NUL to userspace Wei Li

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-196976@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=liwei1412@hotmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.