All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: no-reply@sashiko.virtuozzo.com
To: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>,
	Konstantin Khorenko <khorenko@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 v2 2/2] selftests/ve: check the AIO ring size in a pseudosuper VE
Date: Mon, 16 Nov 2026 10:38:32 +0000	[thread overview]
Message-ID: <010701a1e3efe554-1abb6de9-ab8b-4c3b-9c52-46bb1ea2e496-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261116-pr-ptikhomirov-vstor-154129-aio-pseudosuper-ring-v2-2-532d149b4bd7@virtuozzo.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Low] selftests/ve: ve_ring_nr() hides run_in_ve() failures behind a
  ring size of 0
- [Low] selftests/ve: sysconf(_SC_NPROCESSORS_CONF) used instead of
  possible CPU mask
--

commit f6695923b52cdf1c2c82b7a1c344e0b1de81f04b
Author: Pavel Tikhomirov <ptikhomirov@virtuozzo.com>

selftests/ve: check the AIO ring size in a pseudosuper VE

This adds a selftest that checks that the host and a VE keep the CPU heuristic of the io_setup() ring and that a pseudosuper VE skips it. It also checks that io_setup((nr - 2) / 2) in a pseudosuper VE gives a ring of nr events for rings of 1 to 4 pages.

> diff --git a/tools/testing/selftests/ve/ve_aio_ring_test.c b/tools/testing/selftests/ve/ve_aio_ring_test.c
> new file mode 100644
> index 000000000000..1922a05aceef
> --- /dev/null
> +++ b/tools/testing/selftests/ve/ve_aio_ring_test.c

[ ... ]

> +/* The ring capacity io_setup(@nr_events) makes in the VE, or 0. */
> +static unsigned int ve_ring_nr(FIXTURE_DATA(ve_aio_ring) * self,
> +			       unsigned int nr_events)
> +{
> +	self->arg->nr_events = nr_events;
> +	self->arg->ring_nr = 0;
> +	if (run_in_ve(self->cgv2_fd, self->ctid, &self->ns_ctx, CLONE_NEWVE,
> +		      aio_ring_nr, self->arg))
> +		return 0;
> +	return self->arg->ring_nr;
> +}

[Severity: Low]
Does this hide run_in_ve() failures behind a ring size of 0? If the fork, the cgroup enter or the setns fails, or aio_ring_nr() itself fails, the callers only see 0. ve_keeps_cpu_heuristic and the pseudosuper tests then report "expected N, got 0" as a failure of the behaviour under test instead of an environment error. Could the failure be reported separately, for example by returning an error code and having the callers ASSERT on it?

[ ... ]

> +FIXTURE_SETUP(ve_aio_ring)
> +{
> +	long cpus;
> +	int ret;
> +
> +	self->ctid = -1;
> +	self->arg = MAP_FAILED;
> +
> +	self->page_size = sysconf(_SC_PAGESIZE);
> +	cpus = sysconf(_SC_NPROCESSORS_CONF);
> +	ASSERT_GT(cpus, 0);
> +	self->cpus = cpus;
> +	if (ring_nr(self, 1) == ring_nr_pseudosuper(self, 1))
> +		SKIP(return, "%u possible CPUs are too few for the CPU heuristic to matter",
> +		     self->cpus);

[Severity: Low]
Does sysconf(_SC_NPROCESSORS_CONF) give the number of possible CPUs that ring_nr() needs? The kernel sizes the ring in ioctx_alloc() with num_possible_cpus(). As far as I can tell, libc derives the configured count from the cpuN sysfs entries. The generic cpu_dev_register_generic() registers those only for present CPUs.

On a VM with hotplug slots, or with possible_cpus= or nr_cpus= set, possible CPUs can outnumber the cpuN entries. Then the expected ring sizes are wrong, and host_keeps_cpu_heuristic and ve_keeps_cpu_heuristic fail spuriously. The skip check can also wrongly skip the pseudosuper tests.

The file header and the skip message both say "possible CPUs". Would it be better to read /sys/devices/system/cpu/possible instead?

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261116-pr-ptikhomirov-vstor-154129-aio-pseudosuper-ring-v2-0-532d149b4bd7@virtuozzo.com?part=2

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

  reply	other threads:[~2026-11-16 10:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 10:31 [Devel] [PATCH hci-8.1 v2 0/2] fs/aio: fix CT migration with AIO to a node with more CPUs Pavel Tikhomirov
2026-11-16 10:31 ` [Devel] [PATCH hci-8.1 v2 1/2] fs/aio: restore the AIO ring of the dumped size in a pseudosuper VE Pavel Tikhomirov
2026-11-16 10:36   ` no-reply
2026-11-16 10:31 ` [Devel] [PATCH hci-8.1 v2 2/2] selftests/ve: check the AIO ring " Pavel Tikhomirov
2026-11-16 10:38   ` no-reply [this message]
2026-11-16 16:55 ` [Devel] [PATCH hci-8.1 v2 0/2] fs/aio: fix CT migration with AIO to a node with more CPUs Konstantin Khorenko
2026-11-16 16:55 ` Konstantin Khorenko

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=010701a1e3efe554-1abb6de9-ab8b-4c3b-9c52-46bb1ea2e496-000000@eu-central-1.amazonses.com \
    --to=no-reply@sashiko.virtuozzo.com \
    --cc=devel@openvz.org \
    --cc=khorenko@virtuozzo.com \
    --cc=ptikhomirov@virtuozzo.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 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.