From: Sean Christopherson <seanjc@google.com>
To: Peter Xu <peterx@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
David Hildenbrand <david@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>,
Andrea Arcangeli <aarcange@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
Linux MM Mailing List <linux-mm@kvack.org>,
John Hubbard <jhubbard@nvidia.com>
Subject: Re: [PATCH v3 2/3] kvm: Add new pfn error KVM_PFN_ERR_SIGPENDING
Date: Fri, 7 Oct 2022 01:39:17 +0000 [thread overview]
Message-ID: <Yz+DRTfdFGmSR7Mq@google.com> (raw)
In-Reply-To: <20220817003614.58900-3-peterx@redhat.com>
On Tue, Aug 16, 2022, Peter Xu wrote:
> Since at it, renaming kvm_handle_bad_page to kvm_handle_error_pfn assuming
Please put parantheses after function names, e.g. kvm_handle_bad_page().
> that'll match better with what it does, e.g. KVM_PFN_ERR_SIGPENDING is not
> accurately a bad page but just one kind of errors.
...
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index 3e1317325e1f..23dc46da2f18 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -3134,8 +3134,13 @@ static void kvm_send_hwpoison_signal(unsigned long address, struct task_struct *
> send_sig_mceerr(BUS_MCEERR_AR, (void __user *)address, PAGE_SHIFT, tsk);
> }
>
> -static int kvm_handle_bad_page(struct kvm_vcpu *vcpu, gfn_t gfn, kvm_pfn_t pfn)
> +static int kvm_handle_error_pfn(struct kvm_vcpu *vcpu, gfn_t gfn, kvm_pfn_t pfn)
> {
> + if (is_sigpending_pfn(pfn)) {
> + kvm_handle_signal_exit(vcpu);
> + return -EINTR;
> + }
...
> @@ -2648,9 +2651,12 @@ kvm_pfn_t hva_to_pfn(unsigned long addr, bool atomic, bool *async,
> if (atomic)
> return KVM_PFN_ERR_FAULT;
>
> - npages = hva_to_pfn_slow(addr, async, write_fault, writable, &pfn);
> + npages = hva_to_pfn_slow(addr, async, write_fault, interruptible,
> + writable, &pfn);
> if (npages == 1)
> return pfn;
> + if (npages == -EINTR)
> + return KVM_PFN_ERR_SIGPENDING;
This patch should be split into 3 parts:
1. Add KVM_PFN_ERR_SIGPENDING and the above code
2. Add the interruptible flag
3. Add handling in x86 and rename kvm_handle_bad_page()
With #3 merged with patch 3.
That was if there's oddball arch code that reacts poorly to KVM_PFN_ERR_SIGPENDING,
those errors will bisect to #1.
And if there's a typo in the plumbing, that bisects to #2.
And if something goes sideways in x86, those bugs bisect to #3 (patch 3), and it's
easy to revert just the x86 changes (though I can't imagine that's likely).
next prev parent reply other threads:[~2022-10-07 1:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-17 0:36 [PATCH v3 0/3] kvm/mm: Allow GUP to respond to non fatal signals Peter Xu
2022-08-17 0:36 ` [PATCH v3 1/3] mm/gup: Add FOLL_INTERRUPTIBLE Peter Xu
2022-08-17 0:36 ` [PATCH v3 2/3] kvm: Add new pfn error KVM_PFN_ERR_SIGPENDING Peter Xu
2022-10-07 1:39 ` Sean Christopherson [this message]
2022-10-07 15:03 ` Peter Xu
2022-08-17 0:36 ` [PATCH v3 3/3] kvm/x86: Allow to respond to generic signals during slow page faults Peter Xu
2022-08-17 1:37 ` [PATCH v3 0/3] kvm/mm: Allow GUP to respond to non fatal signals Peter Xu
2022-10-06 20:47 ` Peter Xu
2022-10-07 1:40 ` Sean Christopherson
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=Yz+DRTfdFGmSR7Mq@google.com \
--to=seanjc@google.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=dgilbert@redhat.com \
--cc=jhubbard@nvidia.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.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.