From: Paolo Bonzini <pbonzini@redhat.com>
To: KarimAllah Ahmed <karahmed@amazon.de>, kvm@vger.kernel.org
Cc: "Radim Krčmář" <rkrcmar@redhat.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kvm: Map PFN-type memory regions as writable (if possible)
Date: Wed, 17 Jan 2018 18:56:40 +0100 [thread overview]
Message-ID: <64411cad-77ee-2f6e-d431-78e853cae65d@redhat.com> (raw)
In-Reply-To: <1516209965-18614-1-git-send-email-karahmed@amazon.de>
On 17/01/2018 18:26, KarimAllah Ahmed wrote:
> For EPT-violations that are triggered by a read, the pages are also mapped with
> write permissions (if their memory region is also writable). That would avoid
> getting yet another fault on the same page when a write occurs.
>
> This optimization only happens when you have a "struct page" backing the memory
> region. So also enable it for memory regions that do not have a "struct page".
>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Radim Krčmář <rkrcmar@redhat.com>
> Cc: kvm@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: KarimAllah Ahmed <karahmed@amazon.de>
> ---
> virt/kvm/kvm_main.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 97da45e..0efb089 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -1534,6 +1534,8 @@ static kvm_pfn_t hva_to_pfn(unsigned long addr, bool atomic, bool *async,
> goto retry;
> if (r < 0)
> pfn = KVM_PFN_ERR_FAULT;
> + if (writable)
> + *writable = true;
> } else {
> if (async && vma_is_valid(vma, write_fault))
> *async = true;
>
Looks good, but it should be in hva_to_pfn_remapped.
Paolo
next prev parent reply other threads:[~2018-01-17 17:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-17 17:26 [PATCH] kvm: Map PFN-type memory regions as writable (if possible) KarimAllah Ahmed
2018-01-17 17:56 ` Paolo Bonzini [this message]
2018-01-17 18:18 ` [PATCH v2] " KarimAllah Ahmed
2018-01-18 8:36 ` Paolo Bonzini
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=64411cad-77ee-2f6e-d431-78e853cae65d@redhat.com \
--to=pbonzini@redhat.com \
--cc=karahmed@amazon.de \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rkrcmar@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).