From: David Matlack <dmatlack@google.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: bgardon@google.com, kvm@vger.kernel.org
Subject: Re: [bug report] KVM: x86/mmu: Use an rwlock for the x86 MMU
Date: Mon, 26 Jul 2021 16:53:53 +0000 [thread overview]
Message-ID: <YP7oocNiF5NW8I58@google.com> (raw)
In-Reply-To: <20210726075238.GA10030@kili>
On Mon, Jul 26, 2021 at 10:52:38AM +0300, Dan Carpenter wrote:
> [ This is not the correct patch to blame, but there is something going
> on here which I don't understand so this email is more about me
> learning rather than reporting bugs. - dan ]
>
> Hello Ben Gardon,
>
> The patch 531810caa9f4: "KVM: x86/mmu: Use an rwlock for the x86 MMU"
> from Feb 2, 2021, leads to the following static checker warning:
>
> arch/x86/kvm/mmu/mmu.c:5769 kvm_mmu_zap_all()
> warn: sleeping in atomic context
>
> arch/x86/kvm/mmu/mmu.c
> 5756 void kvm_mmu_zap_all(struct kvm *kvm)
> 5757 {
> 5758 struct kvm_mmu_page *sp, *node;
> 5759 LIST_HEAD(invalid_list);
> 5760 int ign;
> 5761
> 5762 write_lock(&kvm->mmu_lock);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^
> This line bumps the preempt count.
>
> 5763 restart:
> 5764 list_for_each_entry_safe(sp, node, &kvm->arch.active_mmu_pages, link) {
> 5765 if (WARN_ON(sp->role.invalid))
> 5766 continue;
> 5767 if (__kvm_mmu_prepare_zap_page(kvm, sp, &invalid_list, &ign))
> 5768 goto restart;
> --> 5769 if (cond_resched_rwlock_write(&kvm->mmu_lock))
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> This line triggers a sleeping in atomic warning. What's going on here
> that I'm not understanding?
cond_resched_rwlock_write drops the provided lock (kvm->mmu_lock in this
case) before scheduling and then re-acquires it afterwards. So this
warning looks like a false positive.
>
> 5770 goto restart;
> 5771 }
> 5772
> 5773 kvm_mmu_commit_zap_page(kvm, &invalid_list);
> 5774
> 5775 if (is_tdp_mmu_enabled(kvm))
> 5776 kvm_tdp_mmu_zap_all(kvm);
> 5777
> 5778 write_unlock(&kvm->mmu_lock);
> 5779 }
>
> regards,
> dan carpenter
prev parent reply other threads:[~2021-07-26 17:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-26 7:52 [bug report] KVM: x86/mmu: Use an rwlock for the x86 MMU Dan Carpenter
2021-07-26 16:47 ` Ben Gardon
2021-07-27 0:16 ` Sean Christopherson
2021-07-27 8:06 ` Dan Carpenter
2021-07-26 16:53 ` David Matlack [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=YP7oocNiF5NW8I58@google.com \
--to=dmatlack@google.com \
--cc=bgardon@google.com \
--cc=dan.carpenter@oracle.com \
--cc=kvm@vger.kernel.org \
/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.