mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Mingwei Zhang <mizhang@google.com>
Cc: Sean Christopherson <seanjc@google.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Nagareddy Reddy <nspreddy@google.com>,
	Jim Mattson <jmattson@google.com>,
	David Matlack <dmatlack@google.com>
Subject: Re: [RFC PATCH v2] KVM: x86/mmu: replace BUG() with KVM_BUG() in shadow mmu
Date: Thu, 24 Nov 2022 02:16:54 +0100	[thread overview]
Message-ID: <CABgObfYpn98X2NFhoWNAPuyu_NtmovKD5MHoon0gtVP08Su0eA@mail.gmail.com> (raw)
In-Reply-To: <20221124003505.424617-1-mizhang@google.com>

> v1 -> v2:
>  - compile test the code.
>  - fill KVM_BUG() with kvm_get_running_vcpu()->kvm

Nope, the zapping code paths will run often with no running vCPU, for
example drop_parent_pte <- kvm_mmu_unlink_parents <-
__kvm_mmu_prepare_zap_page <- kvm_zap_obsolete_pages <-
kvm_mmu_zap_all_fast <- kvm_mmu_invalidate_zap_pages_in_memslot <-
kvm_page_track_flush_slot <- kvm_arch_flush_shadow_memslot <-
kvm_invalidate_memslot <- ioctl(KVM_SET_USER_MEMORY_REGION).

Paolo

> v1:
> https://lore.kernel.org/all/20221123231206.274392-1-mizhang@google.com/
>
> Cc: Nagareddy Reddy <nspreddy@google.com>
> Cc: Jim Mattson <jmattson@google.com>
> Cc: David Matlack <dmatlack@google.com>
> Signed-off-by: Mingwei Zhang <mizhang@google.com>
> ---
>  arch/x86/kvm/mmu/mmu.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index 4736d7849c60..f3b307c588ac 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -955,12 +955,12 @@ static void pte_list_remove(u64 *spte, struct kvm_rmap_head *rmap_head)
>
>         if (!rmap_head->val) {
>                 pr_err("%s: %p 0->BUG\n", __func__, spte);
> -               BUG();
> +               KVM_BUG(true, kvm_get_running_vcpu()->kvm, "");
>         } else if (!(rmap_head->val & 1)) {
>                 rmap_printk("%p 1->0\n", spte);
>                 if ((u64 *)rmap_head->val != spte) {
>                         pr_err("%s:  %p 1->BUG\n", __func__, spte);
> -                       BUG();
> +                       KVM_BUG(true, kvm_get_running_vcpu()->kvm, "");
>                 }
>                 rmap_head->val = 0;
>         } else {
> @@ -979,7 +979,7 @@ static void pte_list_remove(u64 *spte, struct kvm_rmap_head *rmap_head)
>                         desc = desc->more;
>                 }
>                 pr_err("%s: %p many->many\n", __func__, spte);
> -               BUG();
> +               KVM_BUG(true, kvm_get_running_vcpu()->kvm, "");
>         }
>  }
>
> --
> 2.38.1.584.g0f3c55d4c2-goog
>


  reply	other threads:[~2022-11-24  1:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-24  0:35 Mingwei Zhang
2022-11-24  1:16 ` Paolo Bonzini [this message]
2022-11-27 23:47   ` Mingwei Zhang

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=CABgObfYpn98X2NFhoWNAPuyu_NtmovKD5MHoon0gtVP08Su0eA@mail.gmail.com \
    --to=pbonzini@redhat.com \
    --cc=dmatlack@google.com \
    --cc=hpa@zytor.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mizhang@google.com \
    --cc=nspreddy@google.com \
    --cc=seanjc@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

all inboxes | Powered by JetHome®