From: Mario Smarduch <m.smarduch@samsung.com> To: Alexander Graf <agraf@suse.de> Cc: kvmarm@lists.cs.columbia.edu, marc.zyngier@arm.com, christoffer.dall@linaro.org, pbonzini@redhat.com, gleb@kernel.org, xiantao.zhang@intel.com, borntraeger@de.ibm.com, cornelia.huck@de.ibm.com, xiaoguangrong@linux.vnet.ibm.com, steve.capper@arm.com, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, jays.lee@samsung.com, sungjinn.chung@samsung.com Subject: Re: [PATCH v9 2/4] arm: ARMv7 dirty page logging inital mem region write protect (w/no huge PUD support) Date: Fri, 25 Jul 2014 10:45:17 -0700 [thread overview] Message-ID: <53D297AD.8020103@samsung.com> (raw) In-Reply-To: <53D1F642.6010007@suse.de> On 07/24/2014 11:16 PM, Alexander Graf wrote: > > On 25.07.14 02:56, Mario Smarduch wrote: >> Patch adds support for initial write protection VM memlsot. This >> patch series >> assumes that huge PUDs will not be used in 2nd stage tables. > > Is this a valid assumption? Right now it's unclear if PUDs will be used to back guest memory, assuming so required quite a bit of additional code. After discussing on mailing list it was recommended to treat this as BUG_ON case for now. > >> >> Signed-off-by: Mario Smarduch <m.smarduch@samsung.com> >> --- >> arch/arm/include/asm/kvm_host.h | 1 + >> arch/arm/include/asm/kvm_mmu.h | 20 ++++++ >> arch/arm/include/asm/pgtable-3level.h | 1 + >> arch/arm/kvm/arm.c | 9 +++ >> arch/arm/kvm/mmu.c | 128 >> +++++++++++++++++++++++++++++++++ >> 5 files changed, 159 insertions(+) >> >> diff --git a/arch/arm/include/asm/kvm_host.h >> b/arch/arm/include/asm/kvm_host.h >> index 042206f..6521a2d 100644 >> --- a/arch/arm/include/asm/kvm_host.h >> +++ b/arch/arm/include/asm/kvm_host.h >> @@ -231,5 +231,6 @@ int kvm_perf_teardown(void); >> u64 kvm_arm_timer_get_reg(struct kvm_vcpu *, u64 regid); >> int kvm_arm_timer_set_reg(struct kvm_vcpu *, u64 regid, u64 value); >> void kvm_arch_flush_remote_tlbs(struct kvm *); >> +void kvm_mmu_wp_memory_region(struct kvm *kvm, int slot); >> #endif /* __ARM_KVM_HOST_H__ */ >> diff --git a/arch/arm/include/asm/kvm_mmu.h >> b/arch/arm/include/asm/kvm_mmu.h >> index 5cc0b0f..08ab5e8 100644 >> --- a/arch/arm/include/asm/kvm_mmu.h >> +++ b/arch/arm/include/asm/kvm_mmu.h >> @@ -114,6 +114,26 @@ static inline void kvm_set_s2pmd_writable(pmd_t >> *pmd) >> pmd_val(*pmd) |= L_PMD_S2_RDWR; >> } >> +static inline void kvm_set_s2pte_readonly(pte_t *pte) >> +{ >> + pte_val(*pte) = (pte_val(*pte) & ~L_PTE_S2_RDWR) | L_PTE_S2_RDONLY; >> +} >> + >> +static inline bool kvm_s2pte_readonly(pte_t *pte) >> +{ >> + return (pte_val(*pte) & L_PTE_S2_RDWR) == L_PTE_S2_RDONLY; >> +} >> + >> +static inline void kvm_set_s2pmd_readonly(pmd_t *pmd) >> +{ >> + pmd_val(*pmd) = (pmd_val(*pmd) & ~L_PMD_S2_RDWR) | L_PMD_S2_RDONLY; >> +} >> + >> +static inline bool kvm_s2pmd_readonly(pmd_t *pmd) >> +{ >> + return (pmd_val(*pmd) & L_PMD_S2_RDWR) == L_PMD_S2_RDONLY; >> +} >> + >> /* Open coded p*d_addr_end that can deal with 64bit addresses */ >> #define kvm_pgd_addr_end(addr, end) \ >> ({ u64 __boundary = ((addr) + PGDIR_SIZE) & PGDIR_MASK; \ >> diff --git a/arch/arm/include/asm/pgtable-3level.h >> b/arch/arm/include/asm/pgtable-3level.h >> index 85c60ad..d8bb40b 100644 >> --- a/arch/arm/include/asm/pgtable-3level.h >> +++ b/arch/arm/include/asm/pgtable-3level.h >> @@ -129,6 +129,7 @@ >> #define L_PTE_S2_RDONLY (_AT(pteval_t, 1) << 6) /* >> HAP[1] */ >> #define L_PTE_S2_RDWR (_AT(pteval_t, 3) << 6) /* >> HAP[2:1] */ >> +#define L_PMD_S2_RDONLY (_AT(pteval_t, 1) << 6) /* >> HAP[1] */ >> #define L_PMD_S2_RDWR (_AT(pmdval_t, 3) << 6) /* >> HAP[2:1] */ >> /* >> diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c >> index 3c82b37..e11c2dd 100644 >> --- a/arch/arm/kvm/arm.c >> +++ b/arch/arm/kvm/arm.c >> @@ -242,6 +242,15 @@ void kvm_arch_commit_memory_region(struct kvm *kvm, >> const struct kvm_memory_slot *old, >> enum kvm_mr_change change) >> { >> +#ifdef CONFIG_ARM > > Same question on CONFIG_ARM here. Is this the define used to distinguish > between 32bit and 64bit? Yes let ARM64 compile. Eventually we'll come back to ARM64 soon, and these will go. > > > Alex >
WARNING: multiple messages have this Message-ID (diff)
From: m.smarduch@samsung.com (Mario Smarduch) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v9 2/4] arm: ARMv7 dirty page logging inital mem region write protect (w/no huge PUD support) Date: Fri, 25 Jul 2014 10:45:17 -0700 [thread overview] Message-ID: <53D297AD.8020103@samsung.com> (raw) In-Reply-To: <53D1F642.6010007@suse.de> On 07/24/2014 11:16 PM, Alexander Graf wrote: > > On 25.07.14 02:56, Mario Smarduch wrote: >> Patch adds support for initial write protection VM memlsot. This >> patch series >> assumes that huge PUDs will not be used in 2nd stage tables. > > Is this a valid assumption? Right now it's unclear if PUDs will be used to back guest memory, assuming so required quite a bit of additional code. After discussing on mailing list it was recommended to treat this as BUG_ON case for now. > >> >> Signed-off-by: Mario Smarduch <m.smarduch@samsung.com> >> --- >> arch/arm/include/asm/kvm_host.h | 1 + >> arch/arm/include/asm/kvm_mmu.h | 20 ++++++ >> arch/arm/include/asm/pgtable-3level.h | 1 + >> arch/arm/kvm/arm.c | 9 +++ >> arch/arm/kvm/mmu.c | 128 >> +++++++++++++++++++++++++++++++++ >> 5 files changed, 159 insertions(+) >> >> diff --git a/arch/arm/include/asm/kvm_host.h >> b/arch/arm/include/asm/kvm_host.h >> index 042206f..6521a2d 100644 >> --- a/arch/arm/include/asm/kvm_host.h >> +++ b/arch/arm/include/asm/kvm_host.h >> @@ -231,5 +231,6 @@ int kvm_perf_teardown(void); >> u64 kvm_arm_timer_get_reg(struct kvm_vcpu *, u64 regid); >> int kvm_arm_timer_set_reg(struct kvm_vcpu *, u64 regid, u64 value); >> void kvm_arch_flush_remote_tlbs(struct kvm *); >> +void kvm_mmu_wp_memory_region(struct kvm *kvm, int slot); >> #endif /* __ARM_KVM_HOST_H__ */ >> diff --git a/arch/arm/include/asm/kvm_mmu.h >> b/arch/arm/include/asm/kvm_mmu.h >> index 5cc0b0f..08ab5e8 100644 >> --- a/arch/arm/include/asm/kvm_mmu.h >> +++ b/arch/arm/include/asm/kvm_mmu.h >> @@ -114,6 +114,26 @@ static inline void kvm_set_s2pmd_writable(pmd_t >> *pmd) >> pmd_val(*pmd) |= L_PMD_S2_RDWR; >> } >> +static inline void kvm_set_s2pte_readonly(pte_t *pte) >> +{ >> + pte_val(*pte) = (pte_val(*pte) & ~L_PTE_S2_RDWR) | L_PTE_S2_RDONLY; >> +} >> + >> +static inline bool kvm_s2pte_readonly(pte_t *pte) >> +{ >> + return (pte_val(*pte) & L_PTE_S2_RDWR) == L_PTE_S2_RDONLY; >> +} >> + >> +static inline void kvm_set_s2pmd_readonly(pmd_t *pmd) >> +{ >> + pmd_val(*pmd) = (pmd_val(*pmd) & ~L_PMD_S2_RDWR) | L_PMD_S2_RDONLY; >> +} >> + >> +static inline bool kvm_s2pmd_readonly(pmd_t *pmd) >> +{ >> + return (pmd_val(*pmd) & L_PMD_S2_RDWR) == L_PMD_S2_RDONLY; >> +} >> + >> /* Open coded p*d_addr_end that can deal with 64bit addresses */ >> #define kvm_pgd_addr_end(addr, end) \ >> ({ u64 __boundary = ((addr) + PGDIR_SIZE) & PGDIR_MASK; \ >> diff --git a/arch/arm/include/asm/pgtable-3level.h >> b/arch/arm/include/asm/pgtable-3level.h >> index 85c60ad..d8bb40b 100644 >> --- a/arch/arm/include/asm/pgtable-3level.h >> +++ b/arch/arm/include/asm/pgtable-3level.h >> @@ -129,6 +129,7 @@ >> #define L_PTE_S2_RDONLY (_AT(pteval_t, 1) << 6) /* >> HAP[1] */ >> #define L_PTE_S2_RDWR (_AT(pteval_t, 3) << 6) /* >> HAP[2:1] */ >> +#define L_PMD_S2_RDONLY (_AT(pteval_t, 1) << 6) /* >> HAP[1] */ >> #define L_PMD_S2_RDWR (_AT(pmdval_t, 3) << 6) /* >> HAP[2:1] */ >> /* >> diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c >> index 3c82b37..e11c2dd 100644 >> --- a/arch/arm/kvm/arm.c >> +++ b/arch/arm/kvm/arm.c >> @@ -242,6 +242,15 @@ void kvm_arch_commit_memory_region(struct kvm *kvm, >> const struct kvm_memory_slot *old, >> enum kvm_mr_change change) >> { >> +#ifdef CONFIG_ARM > > Same question on CONFIG_ARM here. Is this the define used to distinguish > between 32bit and 64bit? Yes let ARM64 compile. Eventually we'll come back to ARM64 soon, and these will go. > > > Alex >
next prev parent reply other threads:[~2014-07-25 17:45 UTC|newest] Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-07-25 0:56 [PATCH v9 0/4] arm: dirty page logging support for ARMv7 Mario Smarduch 2014-07-25 0:56 ` Mario Smarduch 2014-07-25 0:56 ` [PATCH v9 1/4] arm: add ARMv7 HYP API to flush VM TLBs, change generic TLB flush to support arch flush Mario Smarduch 2014-07-25 0:56 ` Mario Smarduch 2014-07-25 6:12 ` Alexander Graf 2014-07-25 6:12 ` Alexander Graf 2014-07-25 17:37 ` Mario Smarduch 2014-07-25 17:37 ` Mario Smarduch 2014-08-08 17:50 ` [PATCH v9 1/4] arm: add ARMv7 HYP API to flush VM TLBs ... - looking for comments Mario Smarduch 2014-08-08 17:50 ` Mario Smarduch 2014-08-11 19:12 ` [PATCH v9 1/4] arm: add ARMv7 HYP API to flush VM TLBs, change generic TLB flush to support arch flush Christoffer Dall 2014-08-11 19:12 ` Christoffer Dall 2014-08-11 23:54 ` Mario Smarduch 2014-08-11 23:54 ` Mario Smarduch 2014-07-25 0:56 ` [PATCH v9 2/4] arm: ARMv7 dirty page logging inital mem region write protect (w/no huge PUD support) Mario Smarduch 2014-07-25 0:56 ` Mario Smarduch 2014-07-25 6:16 ` Alexander Graf 2014-07-25 6:16 ` Alexander Graf 2014-07-25 17:45 ` Mario Smarduch [this message] 2014-07-25 17:45 ` Mario Smarduch 2014-08-11 19:12 ` Christoffer Dall 2014-08-11 19:12 ` Christoffer Dall 2014-08-12 0:16 ` Mario Smarduch 2014-08-12 0:16 ` Mario Smarduch 2014-08-12 9:32 ` Christoffer Dall 2014-08-12 9:32 ` Christoffer Dall 2014-08-12 23:17 ` Mario Smarduch 2014-08-12 23:17 ` Mario Smarduch 2014-08-12 1:36 ` Mario Smarduch 2014-08-12 1:36 ` Mario Smarduch 2014-08-12 9:36 ` Christoffer Dall 2014-08-12 9:36 ` Christoffer Dall 2014-08-12 21:08 ` Mario Smarduch 2014-08-12 21:08 ` Mario Smarduch 2014-07-25 0:56 ` [PATCH v9 3/4] arm: dirty log write protect mgmt. Moved x86, armv7 to generic, set armv8 ia64 mips powerpc s390 arch specific Mario Smarduch 2014-07-25 0:56 ` Mario Smarduch 2014-08-11 19:13 ` Christoffer Dall 2014-08-11 19:13 ` Christoffer Dall 2014-08-12 0:24 ` Mario Smarduch 2014-08-12 0:24 ` Mario Smarduch 2014-07-25 0:56 ` [PATCH v9 4/4] arm: ARMv7 dirty page logging 2nd stage page fault handling support Mario Smarduch 2014-07-25 0:56 ` Mario Smarduch 2014-08-11 19:13 ` Christoffer Dall 2014-08-11 19:13 ` Christoffer Dall 2014-08-12 1:25 ` Mario Smarduch 2014-08-12 1:25 ` Mario Smarduch 2014-08-12 9:50 ` Christoffer Dall 2014-08-12 9:50 ` Christoffer Dall 2014-08-13 1:27 ` Mario Smarduch 2014-08-13 1:27 ` Mario Smarduch 2014-08-13 7:30 ` Christoffer Dall 2014-08-13 7:30 ` Christoffer Dall 2014-08-14 1:20 ` Mario Smarduch 2014-08-14 1:20 ` Mario Smarduch 2014-08-15 0:01 ` Mario Smarduch 2014-08-15 0:01 ` Mario Smarduch 2014-08-18 12:51 ` Christoffer Dall 2014-08-18 12:51 ` Christoffer Dall 2014-08-18 17:42 ` Mario Smarduch 2014-08-18 17:42 ` Mario Smarduch
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=53D297AD.8020103@samsung.com \ --to=m.smarduch@samsung.com \ --cc=agraf@suse.de \ --cc=borntraeger@de.ibm.com \ --cc=christoffer.dall@linaro.org \ --cc=cornelia.huck@de.ibm.com \ --cc=gleb@kernel.org \ --cc=jays.lee@samsung.com \ --cc=kvm@vger.kernel.org \ --cc=kvmarm@lists.cs.columbia.edu \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=marc.zyngier@arm.com \ --cc=pbonzini@redhat.com \ --cc=steve.capper@arm.com \ --cc=sungjinn.chung@samsung.com \ --cc=xiantao.zhang@intel.com \ --cc=xiaoguangrong@linux.vnet.ibm.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: linkBe 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.