All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mukesh R" <mrathor@linux.microsoft.com>, linux-hyperv@vger.kernel.org
Subject: Re: [PATCH] mshv: Handle completions on repeat hypercall failures
Date: Fri, 20 Nov 2026 02:20:42 +0000	[thread overview]
Message-ID: <sashiko-outbox-224348@kernel.org> (raw)
In-Reply-To: <20261120020858.3597446-1-mrathor@linux.microsoft.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] mshv: missing Fixes trailer for commit 621191d709b1
It also noticed 1 related pre-existing issue this patch does not
introduce:
- [High] mshv: reclaim lock inversion in hv_do_map_gpa_hcall() under
  mreg_mutex [1]
--

commit f6f04457a79d386b8628402d94d80fb4ab5e158c
Author: Mukesh R <mrathor@linux.microsoft.com>

> mshv: Handle completions on repeat hypercall failures
>
> When a repeat hypercall fails, it could still have completed some of the
> entries requested. Fix places where completions are not checked in case
> of repeat hypercall failures. Also, add error prints in couple places
> with correct partial completion counts when repeat hypercall fails.
>
> Signed-off-by: Mukesh R <mrathor@linux.microsoft.com>

[Severity: Low]
All four modified helpers were introduced with the status check placed
before accounting for hv_repcomp(status).  Should this include:

  Fixes: 621191d709b1 ("Drivers: hv: Introduce mshv_root module to expose /dev/mshv to VMMs")

> diff --git a/drivers/hv/mshv_root_hv_call.c b/drivers/hv/mshv_root_hv_call.c
> index e761addda50e1..6261686c36382 100644
> --- a/drivers/hv/mshv_root_hv_call.c
> +++ b/drivers/hv/mshv_root_hv_call.c
> @@ -239,6 +239,7 @@ static int hv_do_map_gpa_hcall(u64 partition_id, u64 gfn, u64 page_struct_count,
>  		local_irq_restore(irq_flags);
>  
>  		completed = hv_repcomp(status);
> +		done += completed;
>  
>  		if (hv_result_needs_memory(status)) {
>  			ret = hv_deposit_memory(partition_id, status);

[Severity: High]
This problem wasn't introduced by this patch, but can calling
hv_deposit_memory() here cause a reclaim lock inversion on
region->mreg_mutex [1]?

mshv_region_range_fault() and mshv_region_interval_invalidate() call
mshv_region_remap_pages() -> ... -> hv_do_map_gpa_hcall() while holding
region->mreg_mutex.  When hv_result_needs_memory(status) is true,
hv_deposit_memory() allocates pages with GFP_KERNEL via
hv_call_deposit_pages() and hv_alloc_dep_pages(), which can enter direct
reclaim and invoke the MMU interval notifier callback on the same region:

mshv_region_range_fault()
  mutex_lock(&region->mreg_mutex)
  mshv_region_remap_pages()
    ...
      hv_do_map_gpa_hcall()
        hv_deposit_memory()
          ...
            hv_call_deposit_pages()
              get_zeroed_page(GFP_KERNEL)
                <direct reclaim>
                  mmu_notifier_invalidate_range_start()
                    mshv_region_interval_invalidate()
                      mutex_lock(&region->mreg_mutex)  <-- deadlock

[1] https://sashiko.dev/#/bug/linux-5f8ad8fe-ef3b-459b-a784-e85fb87d7746

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261120020858.3597446-1-mrathor@linux.microsoft.com?part=1

      reply	other threads:[~2026-11-20  2:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  2:08 [PATCH] mshv: Handle completions on repeat hypercall failures Mukesh R
2026-11-20  2:20 ` sashiko-bot [this message]

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-224348@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=mrathor@linux.microsoft.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.