All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH kvm-unit-tests 0/2] arm/arm64: some fixups
@ 2017-11-21 16:49 Andrew Jones
  2017-11-21 16:49 ` [PATCH kvm-unit-tests 1/2] Makefile: fix cscope target Andrew Jones
  2017-11-21 16:49 ` [PATCH kvm-unit-tests 2/2] arm/arm64: mmu: add missing TLB flushes Andrew Jones
  0 siblings, 2 replies; 5+ messages in thread
From: Andrew Jones @ 2017-11-21 16:49 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini, rkrcmar

Fixups needed after the 'merge x86 vmalloc and arm/powerpc alloc'
series was merged.

Andrew Jones (2):
  Makefile: fix cscope target
  arm/arm64: mmu: add missing TLB flushes

 Makefile      | 2 +-
 lib/arm/mmu.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

-- 
2.13.6

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH kvm-unit-tests 1/2] Makefile: fix cscope target
  2017-11-21 16:49 [PATCH kvm-unit-tests 0/2] arm/arm64: some fixups Andrew Jones
@ 2017-11-21 16:49 ` Andrew Jones
  2017-11-21 16:49 ` [PATCH kvm-unit-tests 2/2] arm/arm64: mmu: add missing TLB flushes Andrew Jones
  1 sibling, 0 replies; 5+ messages in thread
From: Andrew Jones @ 2017-11-21 16:49 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini, rkrcmar

Since 031755db "arm: enable vmalloc" one of arm's source files is a
symlink. cscope doesn't like that. Fix how we generate cscope.files
in order to make it happy.

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 72313347b8b0..7c0f8e220912 100644
--- a/Makefile
+++ b/Makefile
@@ -121,5 +121,5 @@ cscope: cscope_dirs = lib lib/libfdt lib/linux $(TEST_DIR) $(ARCH_LIBDIRS) lib/a
 cscope:
 	$(RM) ./cscope.*
 	find -L $(cscope_dirs) -maxdepth 1 \
-		-name '*.[chsS]' -print | sed 's,^\./,,' | sort -u > ./cscope.files
+		-name '*.[chsS]' -exec realpath --relative-base=$(PWD) {} \; | sort -u > ./cscope.files
 	cscope -bk
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH kvm-unit-tests 2/2] arm/arm64: mmu: add missing TLB flushes
  2017-11-21 16:49 [PATCH kvm-unit-tests 0/2] arm/arm64: some fixups Andrew Jones
  2017-11-21 16:49 ` [PATCH kvm-unit-tests 1/2] Makefile: fix cscope target Andrew Jones
@ 2017-11-21 16:49 ` Andrew Jones
  2017-11-23 16:13   ` Radim Krčmář
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Jones @ 2017-11-21 16:49 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini, rkrcmar

Since 031755db "arm: enable vmalloc" the virtual addresses returned
from malloc and friends are no longer identical to the physical
addresses they map to. On some hardware the change exposes missing
TLB flushes. Let's get them added.

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 lib/arm/mmu.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/arm/mmu.c b/lib/arm/mmu.c
index 21bcf3a363af..2e5c993f1e7f 100644
--- a/lib/arm/mmu.c
+++ b/lib/arm/mmu.c
@@ -86,6 +86,7 @@ static pteval_t *install_pte(pgd_t *pgtable, uintptr_t vaddr, pteval_t pte)
 {
 	pteval_t *p_pte = get_pte(pgtable, vaddr);
 	*p_pte = pte;
+	flush_tlb_page(vaddr);
 	return p_pte;
 }
 
@@ -136,9 +137,9 @@ void mmu_set_range_sect(pgd_t *pgtable, uintptr_t virt_offset,
 		pgd_val(*pgd) |= PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S;
 		pgd_val(*pgd) |= pgprot_val(prot);
 	}
+	flush_tlb_all();
 }
 
-
 void *setup_mmu(phys_addr_t phys_end)
 {
 	uintptr_t code_end = (uintptr_t)&etext;
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH kvm-unit-tests 2/2] arm/arm64: mmu: add missing TLB flushes
  2017-11-21 16:49 ` [PATCH kvm-unit-tests 2/2] arm/arm64: mmu: add missing TLB flushes Andrew Jones
@ 2017-11-23 16:13   ` Radim Krčmář
  2017-11-23 16:23     ` Andrew Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Radim Krčmář @ 2017-11-23 16:13 UTC (permalink / raw)
  To: Andrew Jones; +Cc: kvm, pbonzini

2017-11-21 17:49+0100, Andrew Jones:
> Since 031755db "arm: enable vmalloc" the virtual addresses returned
> from malloc and friends are no longer identical to the physical
> addresses they map to. On some hardware the change exposes missing
> TLB flushes. Let's get them added.
> 
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
>  lib/arm/mmu.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/arm/mmu.c b/lib/arm/mmu.c
> index 21bcf3a363af..2e5c993f1e7f 100644
> --- a/lib/arm/mmu.c
> +++ b/lib/arm/mmu.c
> @@ -86,6 +86,7 @@ static pteval_t *install_pte(pgd_t *pgtable, uintptr_t vaddr, pteval_t pte)
>  {
>  	pteval_t *p_pte = get_pte(pgtable, vaddr);
>  	*p_pte = pte;
> +	flush_tlb_page(vaddr);
>  	return p_pte;
>  }
>  
> @@ -136,9 +137,9 @@ void mmu_set_range_sect(pgd_t *pgtable, uintptr_t virt_offset,
>  		pgd_val(*pgd) |= PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S;
>  		pgd_val(*pgd) |= pgprot_val(prot);
>  	}
> +	flush_tlb_all();
>  }

Applied, thanks.

Out of curiosity, when does it become better to use flush_tlb_all() than
flush_tlb_page()? i.e.

diff --git a/lib/arm/mmu.c b/lib/arm/mmu.c
index 2e5c993f1e7f..030c44412c2a 100644
--- a/lib/arm/mmu.c
+++ b/lib/arm/mmu.c
@@ -136,8 +136,8 @@ void mmu_set_range_sect(pgd_t *pgtable, uintptr_t virt_offset,
 		pgd_val(*pgd) = paddr;
 		pgd_val(*pgd) |= PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S;
 		pgd_val(*pgd) |= pgprot_val(prot);
+		flush_tlb_page(vaddr);
 	}
-	flush_tlb_all();
 }
 
 void *setup_mmu(phys_addr_t phys_end)

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH kvm-unit-tests 2/2] arm/arm64: mmu: add missing TLB flushes
  2017-11-23 16:13   ` Radim Krčmář
@ 2017-11-23 16:23     ` Andrew Jones
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Jones @ 2017-11-23 16:23 UTC (permalink / raw)
  To: Radim Krčmář; +Cc: kvm, pbonzini

On Thu, Nov 23, 2017 at 05:13:01PM +0100, Radim Krčmář wrote:
> 2017-11-21 17:49+0100, Andrew Jones:
> > Since 031755db "arm: enable vmalloc" the virtual addresses returned
> > from malloc and friends are no longer identical to the physical
> > addresses they map to. On some hardware the change exposes missing
> > TLB flushes. Let's get them added.
> > 
> > Signed-off-by: Andrew Jones <drjones@redhat.com>
> > ---
> >  lib/arm/mmu.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/lib/arm/mmu.c b/lib/arm/mmu.c
> > index 21bcf3a363af..2e5c993f1e7f 100644
> > --- a/lib/arm/mmu.c
> > +++ b/lib/arm/mmu.c
> > @@ -86,6 +86,7 @@ static pteval_t *install_pte(pgd_t *pgtable, uintptr_t vaddr, pteval_t pte)
> >  {
> >  	pteval_t *p_pte = get_pte(pgtable, vaddr);
> >  	*p_pte = pte;
> > +	flush_tlb_page(vaddr);
> >  	return p_pte;
> >  }
> >  
> > @@ -136,9 +137,9 @@ void mmu_set_range_sect(pgd_t *pgtable, uintptr_t virt_offset,
> >  		pgd_val(*pgd) |= PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S;
> >  		pgd_val(*pgd) |= pgprot_val(prot);
> >  	}
> > +	flush_tlb_all();
> >  }
> 
> Applied, thanks.
> 
> Out of curiosity, when does it become better to use flush_tlb_all() than
> flush_tlb_page()? i.e.
>

I was just being lazy with the mmu_set_range_sect() function, because,
while that's currently part of the MMU API, it's actually only used in
one place, setup_mmu(), which does mmu_enable() after its call anyway.

So, in short, the mmu_set_range_sect() hunk is correct, but not optimal,
and it doesn't really matter :-)

drew

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-11-23 16:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-21 16:49 [PATCH kvm-unit-tests 0/2] arm/arm64: some fixups Andrew Jones
2017-11-21 16:49 ` [PATCH kvm-unit-tests 1/2] Makefile: fix cscope target Andrew Jones
2017-11-21 16:49 ` [PATCH kvm-unit-tests 2/2] arm/arm64: mmu: add missing TLB flushes Andrew Jones
2017-11-23 16:13   ` Radim Krčmář
2017-11-23 16:23     ` Andrew Jones

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.