From: sashiko-bot@kernel.org
To: "Shmuel Fomberg" <shmuelfomberg@gmail.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH] Adding support for hyper-v enlightments hv-extcalls and hv-memory-hint (hypercall HvExtCallMemoryHeatHint)
Date: Wed, 14 Oct 2026 12:52:29 +0000 [thread overview]
Message-ID: <sashiko-outbox-171300@kernel.org> (raw)
In-Reply-To: <20261014123954.95181-1-shmuelfomberg@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] qemu: hv_madvise_walk_step drops overlapping memory hints
--
commit e5fd145c0d62c5737370ada9533f9341dfc23d5a
Author: Shmuel Fomberg <shmuelfomberg@gmail.com>
Adding support for hyper-v enlightments hv-extcalls and hv-memory-hint (hypercall HvExtCallMemoryHeatHint)
This commit introduces support for Hyper-V extended memory heat-hint GPA
range helpers. It includes the API for decoding and walking memory ranges,
along with corresponding unit and functional tests.
> diff --git a/hw/hyperv/hv-gpa-range.c b/hw/hyperv/hv-gpa-range.c
> new file mode 100644
> index 0000000000000..e6d3d3eb42f7b
> --- /dev/null
> +++ b/hw/hyperv/hv-gpa-range.c
[ ... ]
> +bool hv_madvise_walk_step(hwaddr *gpa, hwaddr *len,
> + hwaddr section_start, hwaddr section_size,
> + hwaddr *out_gpa, hwaddr *out_len)
> +{
> + hwaddr skip;
> +
> + /*
> + * A hole with no memory region makes the section start past the
> + * cursor; a zero-size section means there is nothing left to find.
> + * Either way, stop -- do not advise or advance past the gap.
> + */
> + if (!section_size || section_start < *gpa) {
> + return false;
> + }
> +
> + skip = section_start - *gpa;
> + if (skip >= *len || section_size > *len - skip) {
> + return false;
> + }
[Severity: Medium]
Does this incorrectly drop overlapping memory hints?
If memory_region_find() returns a section that extends beyond the originally
requested range, section_size > *len - skip evaluates to true and the walk
is aborted entirely by returning false.
Should this instead clamp the section_size to the remaining length (*len - skip)
so that the valid overlapping portion is processed rather than discarded?
[ ... ]
> diff --git a/tests/unit/test-hv-gpa-range.c b/tests/unit/test-hv-gpa-range.c
> new file mode 100644
> index 0000000000000..70196f271b886
> --- /dev/null
> +++ b/tests/unit/test-hv-gpa-range.c
[ ... ]
> +static void test_walk_section_past_requested_range(void)
> +{
> + /* Section is larger than what's left to process -> stop, don't act */
> + hwaddr gpa = 0x1000, len = 0x1000;
> + hwaddr out_gpa = 0xdead, out_len = 0xdead;
> +
> + g_assert_false(hv_madvise_walk_step(&gpa, &len, 0x1000, 0x2000,
> + &out_gpa, &out_len));
[Severity: Medium]
This unit test appears to strictly enforce the behavior of failing when a
section extends past the requested range.
If hv_madvise_walk_step() is updated to clamp the returned size instead of
failing, will this test also need to be adjusted to expect the successful
clamped values?
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261014123954.95181-1-shmuelfomberg@gmail.com?part=1
next prev parent reply other threads:[~2026-10-14 12:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 12:39 [PATCH] Adding support for hyper-v enlightments hv-extcalls and hv-memory-hint (hypercall HvExtCallMemoryHeatHint) Shmuel Fomberg
2026-10-14 12:52 ` sashiko-bot [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-10-14 12:37 Shmuel Fomberg
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-171300@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=shmuelfomberg@gmail.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.