Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-10-14 Thread Paolo Bonzini
Il 01/09/2013 11:17, Gleb Natapov ha scritto: > This makes me think are there other places where gfn_to_hva() was > used, but gfn_to_hva_prot() should have been? > - kvm_host_page_size() looks incorrect. We never use huge page to map >read only memory slots currently. > -

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-10-14 Thread Paolo Bonzini
Il 01/09/2013 11:17, Gleb Natapov ha scritto: This makes me think are there other places where gfn_to_hva() was used, but gfn_to_hva_prot() should have been? - kvm_host_page_size() looks incorrect. We never use huge page to map read only memory slots currently. - kvm_handle_bad_page()

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Gleb Natapov
On Mon, Sep 02, 2013 at 05:58:41PM +0200, Paolo Bonzini wrote: > Il 02/09/2013 12:11, Gleb Natapov ha scritto: > >> > > >> > Got it, thanks for your explanation. > >> > > >> > BTW, if you and Paolo are busy on other things, i am happy to fix these > >> > issues. :) > > I am busy with reviews

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Gleb Natapov
On Mon, Sep 02, 2013 at 05:56:07PM +0200, Paolo Bonzini wrote: > Il 02/09/2013 12:07, Gleb Natapov ha scritto: > > On Mon, Sep 02, 2013 at 06:00:39PM +0800, Xiao Guangrong wrote: > >> On 09/02/2013 05:25 PM, Gleb Natapov wrote: > >>> On Mon, Sep 02, 2013 at 05:20:15PM +0800, Xiao Guangrong wrote:

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Gleb Natapov
On Mon, Sep 02, 2013 at 06:00:08PM +0200, Paolo Bonzini wrote: > Il 02/09/2013 11:25, Gleb Natapov ha scritto: > > On Mon, Sep 02, 2013 at 05:20:15PM +0800, Xiao Guangrong wrote: > >> On 08/30/2013 08:41 PM, Paolo Bonzini wrote: > >>> Page tables in a read-only memory slot will currently cause a

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Paolo Bonzini
Il 02/09/2013 11:25, Gleb Natapov ha scritto: > On Mon, Sep 02, 2013 at 05:20:15PM +0800, Xiao Guangrong wrote: >> On 08/30/2013 08:41 PM, Paolo Bonzini wrote: >>> Page tables in a read-only memory slot will currently cause a triple >>> fault because the page walker uses gfn_to_hva and it fails on

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Paolo Bonzini
Il 02/09/2013 12:11, Gleb Natapov ha scritto: >> > >> > Got it, thanks for your explanation. >> > >> > BTW, if you and Paolo are busy on other things, i am happy to fix these >> > issues. :) > I am busy with reviews mostly :). If you are not to busy with lockless > write protection then fine

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Paolo Bonzini
Il 02/09/2013 12:07, Gleb Natapov ha scritto: > On Mon, Sep 02, 2013 at 06:00:39PM +0800, Xiao Guangrong wrote: >> On 09/02/2013 05:25 PM, Gleb Natapov wrote: >>> On Mon, Sep 02, 2013 at 05:20:15PM +0800, Xiao Guangrong wrote: On 08/30/2013 08:41 PM, Paolo Bonzini wrote: > Page tables in

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Gleb Natapov
On Mon, Sep 02, 2013 at 06:05:10PM +0800, Xiao Guangrong wrote: > On 09/02/2013 05:49 PM, Gleb Natapov wrote: > > On Mon, Sep 02, 2013 at 05:42:25PM +0800, Xiao Guangrong wrote: > >> On 09/01/2013 05:17 PM, Gleb Natapov wrote: > >>> On Fri, Aug 30, 2013 at 02:41:37PM +0200, Paolo Bonzini wrote: >

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Gleb Natapov
On Mon, Sep 02, 2013 at 06:00:39PM +0800, Xiao Guangrong wrote: > On 09/02/2013 05:25 PM, Gleb Natapov wrote: > > On Mon, Sep 02, 2013 at 05:20:15PM +0800, Xiao Guangrong wrote: > >> On 08/30/2013 08:41 PM, Paolo Bonzini wrote: > >>> Page tables in a read-only memory slot will currently cause a

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Xiao Guangrong
On 09/02/2013 05:49 PM, Gleb Natapov wrote: > On Mon, Sep 02, 2013 at 05:42:25PM +0800, Xiao Guangrong wrote: >> On 09/01/2013 05:17 PM, Gleb Natapov wrote: >>> On Fri, Aug 30, 2013 at 02:41:37PM +0200, Paolo Bonzini wrote: Page tables in a read-only memory slot will currently cause a triple

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Xiao Guangrong
On 09/02/2013 05:25 PM, Gleb Natapov wrote: > On Mon, Sep 02, 2013 at 05:20:15PM +0800, Xiao Guangrong wrote: >> On 08/30/2013 08:41 PM, Paolo Bonzini wrote: >>> Page tables in a read-only memory slot will currently cause a triple >>> fault because the page walker uses gfn_to_hva and it fails on

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Gleb Natapov
On Mon, Sep 02, 2013 at 05:42:25PM +0800, Xiao Guangrong wrote: > On 09/01/2013 05:17 PM, Gleb Natapov wrote: > > On Fri, Aug 30, 2013 at 02:41:37PM +0200, Paolo Bonzini wrote: > >> Page tables in a read-only memory slot will currently cause a triple > >> fault because the page walker uses

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Xiao Guangrong
On 09/01/2013 05:17 PM, Gleb Natapov wrote: > On Fri, Aug 30, 2013 at 02:41:37PM +0200, Paolo Bonzini wrote: >> Page tables in a read-only memory slot will currently cause a triple >> fault because the page walker uses gfn_to_hva and it fails on such a slot. >> >> OVMF uses such a page table;

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Gleb Natapov
On Mon, Sep 02, 2013 at 05:20:15PM +0800, Xiao Guangrong wrote: > On 08/30/2013 08:41 PM, Paolo Bonzini wrote: > > Page tables in a read-only memory slot will currently cause a triple > > fault because the page walker uses gfn_to_hva and it fails on such a slot. > > > > OVMF uses such a page

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Xiao Guangrong
On 08/30/2013 08:41 PM, Paolo Bonzini wrote: > Page tables in a read-only memory slot will currently cause a triple > fault because the page walker uses gfn_to_hva and it fails on such a slot. > > OVMF uses such a page table; however, real hardware seems to be fine with > that as long as the

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Xiao Guangrong
On 08/30/2013 08:41 PM, Paolo Bonzini wrote: Page tables in a read-only memory slot will currently cause a triple fault because the page walker uses gfn_to_hva and it fails on such a slot. OVMF uses such a page table; however, real hardware seems to be fine with that as long as the

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Gleb Natapov
On Mon, Sep 02, 2013 at 05:20:15PM +0800, Xiao Guangrong wrote: On 08/30/2013 08:41 PM, Paolo Bonzini wrote: Page tables in a read-only memory slot will currently cause a triple fault because the page walker uses gfn_to_hva and it fails on such a slot. OVMF uses such a page table;

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Xiao Guangrong
On 09/01/2013 05:17 PM, Gleb Natapov wrote: On Fri, Aug 30, 2013 at 02:41:37PM +0200, Paolo Bonzini wrote: Page tables in a read-only memory slot will currently cause a triple fault because the page walker uses gfn_to_hva and it fails on such a slot. OVMF uses such a page table; however, real

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Gleb Natapov
On Mon, Sep 02, 2013 at 05:42:25PM +0800, Xiao Guangrong wrote: On 09/01/2013 05:17 PM, Gleb Natapov wrote: On Fri, Aug 30, 2013 at 02:41:37PM +0200, Paolo Bonzini wrote: Page tables in a read-only memory slot will currently cause a triple fault because the page walker uses gfn_to_hva and

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Xiao Guangrong
On 09/02/2013 05:25 PM, Gleb Natapov wrote: On Mon, Sep 02, 2013 at 05:20:15PM +0800, Xiao Guangrong wrote: On 08/30/2013 08:41 PM, Paolo Bonzini wrote: Page tables in a read-only memory slot will currently cause a triple fault because the page walker uses gfn_to_hva and it fails on such a

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Xiao Guangrong
On 09/02/2013 05:49 PM, Gleb Natapov wrote: On Mon, Sep 02, 2013 at 05:42:25PM +0800, Xiao Guangrong wrote: On 09/01/2013 05:17 PM, Gleb Natapov wrote: On Fri, Aug 30, 2013 at 02:41:37PM +0200, Paolo Bonzini wrote: Page tables in a read-only memory slot will currently cause a triple fault

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Gleb Natapov
On Mon, Sep 02, 2013 at 06:00:39PM +0800, Xiao Guangrong wrote: On 09/02/2013 05:25 PM, Gleb Natapov wrote: On Mon, Sep 02, 2013 at 05:20:15PM +0800, Xiao Guangrong wrote: On 08/30/2013 08:41 PM, Paolo Bonzini wrote: Page tables in a read-only memory slot will currently cause a triple

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Gleb Natapov
On Mon, Sep 02, 2013 at 06:05:10PM +0800, Xiao Guangrong wrote: On 09/02/2013 05:49 PM, Gleb Natapov wrote: On Mon, Sep 02, 2013 at 05:42:25PM +0800, Xiao Guangrong wrote: On 09/01/2013 05:17 PM, Gleb Natapov wrote: On Fri, Aug 30, 2013 at 02:41:37PM +0200, Paolo Bonzini wrote: Page

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Paolo Bonzini
Il 02/09/2013 12:07, Gleb Natapov ha scritto: On Mon, Sep 02, 2013 at 06:00:39PM +0800, Xiao Guangrong wrote: On 09/02/2013 05:25 PM, Gleb Natapov wrote: On Mon, Sep 02, 2013 at 05:20:15PM +0800, Xiao Guangrong wrote: On 08/30/2013 08:41 PM, Paolo Bonzini wrote: Page tables in a read-only

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Paolo Bonzini
Il 02/09/2013 12:11, Gleb Natapov ha scritto: Got it, thanks for your explanation. BTW, if you and Paolo are busy on other things, i am happy to fix these issues. :) I am busy with reviews mostly :). If you are not to busy with lockless write protection then fine with me. Lest wait

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Paolo Bonzini
Il 02/09/2013 11:25, Gleb Natapov ha scritto: On Mon, Sep 02, 2013 at 05:20:15PM +0800, Xiao Guangrong wrote: On 08/30/2013 08:41 PM, Paolo Bonzini wrote: Page tables in a read-only memory slot will currently cause a triple fault because the page walker uses gfn_to_hva and it fails on such a

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Gleb Natapov
On Mon, Sep 02, 2013 at 06:00:08PM +0200, Paolo Bonzini wrote: Il 02/09/2013 11:25, Gleb Natapov ha scritto: On Mon, Sep 02, 2013 at 05:20:15PM +0800, Xiao Guangrong wrote: On 08/30/2013 08:41 PM, Paolo Bonzini wrote: Page tables in a read-only memory slot will currently cause a triple

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Gleb Natapov
On Mon, Sep 02, 2013 at 05:56:07PM +0200, Paolo Bonzini wrote: Il 02/09/2013 12:07, Gleb Natapov ha scritto: On Mon, Sep 02, 2013 at 06:00:39PM +0800, Xiao Guangrong wrote: On 09/02/2013 05:25 PM, Gleb Natapov wrote: On Mon, Sep 02, 2013 at 05:20:15PM +0800, Xiao Guangrong wrote: On

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-02 Thread Gleb Natapov
On Mon, Sep 02, 2013 at 05:58:41PM +0200, Paolo Bonzini wrote: Il 02/09/2013 12:11, Gleb Natapov ha scritto: Got it, thanks for your explanation. BTW, if you and Paolo are busy on other things, i am happy to fix these issues. :) I am busy with reviews mostly :). If you are not

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-01 Thread Gleb Natapov
On Fri, Aug 30, 2013 at 02:41:37PM +0200, Paolo Bonzini wrote: > Page tables in a read-only memory slot will currently cause a triple > fault because the page walker uses gfn_to_hva and it fails on such a slot. > > OVMF uses such a page table; however, real hardware seems to be fine with > that

Re: [PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-09-01 Thread Gleb Natapov
On Fri, Aug 30, 2013 at 02:41:37PM +0200, Paolo Bonzini wrote: Page tables in a read-only memory slot will currently cause a triple fault because the page walker uses gfn_to_hva and it fails on such a slot. OVMF uses such a page table; however, real hardware seems to be fine with that as

[PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-08-30 Thread Paolo Bonzini
Page tables in a read-only memory slot will currently cause a triple fault because the page walker uses gfn_to_hva and it fails on such a slot. OVMF uses such a page table; however, real hardware seems to be fine with that as long as the accessed/dirty bits are set. Save whether the slot is

[PATCH] KVM: mmu: allow page tables to be in read-only slots

2013-08-30 Thread Paolo Bonzini
Page tables in a read-only memory slot will currently cause a triple fault because the page walker uses gfn_to_hva and it fails on such a slot. OVMF uses such a page table; however, real hardware seems to be fine with that as long as the accessed/dirty bits are set. Save whether the slot is