All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH resend 0/3] mm: allow arch to override lowmem_page_address
@ 2016-04-18 16:04 ` Ard Biesheuvel
  0 siblings, 0 replies; 16+ messages in thread
From: Ard Biesheuvel @ 2016-04-18 16:04 UTC (permalink / raw)
  To: linux-kernel, linux-mm, akpm, lftan, jonas; +Cc: will.deacon, Ard Biesheuvel

These patches allow the arch to define the page_to_virt() conversion that
is used in lowmem_page_address(). This is desirable for arm64, where this
conversion is trivial when CONFIG_SPARSEMEM_VMEMMAP is enabled, while
breaking it up into __va(PFN_PHYS(page_to_pfn(page))), as is done currently
in lowmem_page_address(), will force the use of a virt-to-phys() conversion
and back again, which always involves a memory access on arm64, since the
start of physical memory is not a compile time constant.

I have split off these patches from my series 'arm64: optimize virt_to_page
and page_address' which I sent out 3 weeks ago, and resending them in the
hope that they can be picked up (with Will's ack on #3) to be merged via
the mm tree.

I have cc'ed the nios2 and openrisc maintainers on previous versions, and
cc'ing them again now. I have dropped both of the arch specific mailing
lists, since one is defunct and the other is subscriber only.

Andrew, is this something you would be pulling to pick up (assuming that you
agree with the contents)? Thanks.

Ard Biesheuvel (3):
  nios2: use correct void* return type for page_to_virt()
  openrisc: drop wrongly typed definition of page_to_virt()
  mm: replace open coded page to virt conversion with page_to_virt()

 arch/nios2/include/asm/io.h      | 1 -
 arch/nios2/include/asm/page.h    | 2 +-
 arch/nios2/include/asm/pgtable.h | 2 +-
 arch/openrisc/include/asm/page.h | 2 --
 include/linux/mm.h               | 6 +++++-
 5 files changed, 7 insertions(+), 6 deletions(-)

-- 
2.5.0

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

* [PATCH resend 0/3] mm: allow arch to override lowmem_page_address
@ 2016-04-18 16:04 ` Ard Biesheuvel
  0 siblings, 0 replies; 16+ messages in thread
From: Ard Biesheuvel @ 2016-04-18 16:04 UTC (permalink / raw)
  To: linux-kernel, linux-mm, akpm, lftan, jonas; +Cc: will.deacon, Ard Biesheuvel

These patches allow the arch to define the page_to_virt() conversion that
is used in lowmem_page_address(). This is desirable for arm64, where this
conversion is trivial when CONFIG_SPARSEMEM_VMEMMAP is enabled, while
breaking it up into __va(PFN_PHYS(page_to_pfn(page))), as is done currently
in lowmem_page_address(), will force the use of a virt-to-phys() conversion
and back again, which always involves a memory access on arm64, since the
start of physical memory is not a compile time constant.

I have split off these patches from my series 'arm64: optimize virt_to_page
and page_address' which I sent out 3 weeks ago, and resending them in the
hope that they can be picked up (with Will's ack on #3) to be merged via
the mm tree.

I have cc'ed the nios2 and openrisc maintainers on previous versions, and
cc'ing them again now. I have dropped both of the arch specific mailing
lists, since one is defunct and the other is subscriber only.

Andrew, is this something you would be pulling to pick up (assuming that you
agree with the contents)? Thanks.

Ard Biesheuvel (3):
  nios2: use correct void* return type for page_to_virt()
  openrisc: drop wrongly typed definition of page_to_virt()
  mm: replace open coded page to virt conversion with page_to_virt()

 arch/nios2/include/asm/io.h      | 1 -
 arch/nios2/include/asm/page.h    | 2 +-
 arch/nios2/include/asm/pgtable.h | 2 +-
 arch/openrisc/include/asm/page.h | 2 --
 include/linux/mm.h               | 6 +++++-
 5 files changed, 7 insertions(+), 6 deletions(-)

-- 
2.5.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* [PATCH resend 1/3] nios2: use correct void* return type for page_to_virt()
  2016-04-18 16:04 ` Ard Biesheuvel
@ 2016-04-18 16:04   ` Ard Biesheuvel
  -1 siblings, 0 replies; 16+ messages in thread
From: Ard Biesheuvel @ 2016-04-18 16:04 UTC (permalink / raw)
  To: linux-kernel, linux-mm, akpm, lftan, jonas; +Cc: will.deacon, Ard Biesheuvel

To align with other architectures, the expression produced by expanding
the macro page_to_virt() should be of type void*, since it returns a
virtual address. Fix that, and also fix up an instance where page_to_virt
was expected to return 'unsigned long', and drop another instance that was
entirely unused (page_to_bus)

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 arch/nios2/include/asm/io.h      | 1 -
 arch/nios2/include/asm/page.h    | 2 +-
 arch/nios2/include/asm/pgtable.h | 2 +-
 3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/nios2/include/asm/io.h b/arch/nios2/include/asm/io.h
index c5a62da22cd2..ce072ba0f8dd 100644
--- a/arch/nios2/include/asm/io.h
+++ b/arch/nios2/include/asm/io.h
@@ -50,7 +50,6 @@ static inline void iounmap(void __iomem *addr)
 
 /* Pages to physical address... */
 #define page_to_phys(page)	virt_to_phys(page_to_virt(page))
-#define page_to_bus(page)	page_to_virt(page)
 
 /* Macros used for converting between virtual and physical mappings. */
 #define phys_to_virt(vaddr)	\
diff --git a/arch/nios2/include/asm/page.h b/arch/nios2/include/asm/page.h
index 4b32d6fd9d98..c1683f51ad0f 100644
--- a/arch/nios2/include/asm/page.h
+++ b/arch/nios2/include/asm/page.h
@@ -84,7 +84,7 @@ extern struct page *mem_map;
 	((void *)((unsigned long)(x) + PAGE_OFFSET - PHYS_OFFSET))
 
 #define page_to_virt(page)	\
-	((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
+	((void *)(((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
 
 # define pfn_to_kaddr(pfn)	__va((pfn) << PAGE_SHIFT)
 # define pfn_valid(pfn)		((pfn) >= ARCH_PFN_OFFSET &&	\
diff --git a/arch/nios2/include/asm/pgtable.h b/arch/nios2/include/asm/pgtable.h
index a213e8c9aad0..298393c3cb42 100644
--- a/arch/nios2/include/asm/pgtable.h
+++ b/arch/nios2/include/asm/pgtable.h
@@ -209,7 +209,7 @@ static inline void set_pte(pte_t *ptep, pte_t pteval)
 static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
 			      pte_t *ptep, pte_t pteval)
 {
-	unsigned long paddr = page_to_virt(pte_page(pteval));
+	unsigned long paddr = (unsigned long)page_to_virt(pte_page(pteval));
 
 	flush_dcache_range(paddr, paddr + PAGE_SIZE);
 	set_pte(ptep, pteval);
-- 
2.5.0

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

* [PATCH resend 1/3] nios2: use correct void* return type for page_to_virt()
@ 2016-04-18 16:04   ` Ard Biesheuvel
  0 siblings, 0 replies; 16+ messages in thread
From: Ard Biesheuvel @ 2016-04-18 16:04 UTC (permalink / raw)
  To: linux-kernel, linux-mm, akpm, lftan, jonas; +Cc: will.deacon, Ard Biesheuvel

To align with other architectures, the expression produced by expanding
the macro page_to_virt() should be of type void*, since it returns a
virtual address. Fix that, and also fix up an instance where page_to_virt
was expected to return 'unsigned long', and drop another instance that was
entirely unused (page_to_bus)

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 arch/nios2/include/asm/io.h      | 1 -
 arch/nios2/include/asm/page.h    | 2 +-
 arch/nios2/include/asm/pgtable.h | 2 +-
 3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/nios2/include/asm/io.h b/arch/nios2/include/asm/io.h
index c5a62da22cd2..ce072ba0f8dd 100644
--- a/arch/nios2/include/asm/io.h
+++ b/arch/nios2/include/asm/io.h
@@ -50,7 +50,6 @@ static inline void iounmap(void __iomem *addr)
 
 /* Pages to physical address... */
 #define page_to_phys(page)	virt_to_phys(page_to_virt(page))
-#define page_to_bus(page)	page_to_virt(page)
 
 /* Macros used for converting between virtual and physical mappings. */
 #define phys_to_virt(vaddr)	\
diff --git a/arch/nios2/include/asm/page.h b/arch/nios2/include/asm/page.h
index 4b32d6fd9d98..c1683f51ad0f 100644
--- a/arch/nios2/include/asm/page.h
+++ b/arch/nios2/include/asm/page.h
@@ -84,7 +84,7 @@ extern struct page *mem_map;
 	((void *)((unsigned long)(x) + PAGE_OFFSET - PHYS_OFFSET))
 
 #define page_to_virt(page)	\
-	((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
+	((void *)(((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
 
 # define pfn_to_kaddr(pfn)	__va((pfn) << PAGE_SHIFT)
 # define pfn_valid(pfn)		((pfn) >= ARCH_PFN_OFFSET &&	\
diff --git a/arch/nios2/include/asm/pgtable.h b/arch/nios2/include/asm/pgtable.h
index a213e8c9aad0..298393c3cb42 100644
--- a/arch/nios2/include/asm/pgtable.h
+++ b/arch/nios2/include/asm/pgtable.h
@@ -209,7 +209,7 @@ static inline void set_pte(pte_t *ptep, pte_t pteval)
 static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
 			      pte_t *ptep, pte_t pteval)
 {
-	unsigned long paddr = page_to_virt(pte_page(pteval));
+	unsigned long paddr = (unsigned long)page_to_virt(pte_page(pteval));
 
 	flush_dcache_range(paddr, paddr + PAGE_SIZE);
 	set_pte(ptep, pteval);
-- 
2.5.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* [PATCH resend 2/3] openrisc: drop wrongly typed definition of page_to_virt()
  2016-04-18 16:04 ` Ard Biesheuvel
@ 2016-04-18 16:04   ` Ard Biesheuvel
  -1 siblings, 0 replies; 16+ messages in thread
From: Ard Biesheuvel @ 2016-04-18 16:04 UTC (permalink / raw)
  To: linux-kernel, linux-mm, akpm, lftan, jonas; +Cc: will.deacon, Ard Biesheuvel

To align with generic code and other architectures that expect the macro
page_to_virt to produce an expression whose type is 'void*', drop the
arch specific definition, which is never referenced anyway.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 arch/openrisc/include/asm/page.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/openrisc/include/asm/page.h b/arch/openrisc/include/asm/page.h
index e613d3673034..35bcb7cd2cde 100644
--- a/arch/openrisc/include/asm/page.h
+++ b/arch/openrisc/include/asm/page.h
@@ -81,8 +81,6 @@ typedef struct page *pgtable_t;
 
 #define virt_to_page(addr) \
 	(mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT))
-#define page_to_virt(page) \
-	((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
 
 #define page_to_phys(page)      ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
 
-- 
2.5.0

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

* [PATCH resend 2/3] openrisc: drop wrongly typed definition of page_to_virt()
@ 2016-04-18 16:04   ` Ard Biesheuvel
  0 siblings, 0 replies; 16+ messages in thread
From: Ard Biesheuvel @ 2016-04-18 16:04 UTC (permalink / raw)
  To: linux-kernel, linux-mm, akpm, lftan, jonas; +Cc: will.deacon, Ard Biesheuvel

To align with generic code and other architectures that expect the macro
page_to_virt to produce an expression whose type is 'void*', drop the
arch specific definition, which is never referenced anyway.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 arch/openrisc/include/asm/page.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/openrisc/include/asm/page.h b/arch/openrisc/include/asm/page.h
index e613d3673034..35bcb7cd2cde 100644
--- a/arch/openrisc/include/asm/page.h
+++ b/arch/openrisc/include/asm/page.h
@@ -81,8 +81,6 @@ typedef struct page *pgtable_t;
 
 #define virt_to_page(addr) \
 	(mem_map + (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT))
-#define page_to_virt(page) \
-	((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
 
 #define page_to_phys(page)      ((dma_addr_t)page_to_pfn(page) << PAGE_SHIFT)
 
-- 
2.5.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* [PATCH resend 3/3] mm: replace open coded page to virt conversion with page_to_virt()
  2016-04-18 16:04 ` Ard Biesheuvel
@ 2016-04-18 16:04   ` Ard Biesheuvel
  -1 siblings, 0 replies; 16+ messages in thread
From: Ard Biesheuvel @ 2016-04-18 16:04 UTC (permalink / raw)
  To: linux-kernel, linux-mm, akpm, lftan, jonas; +Cc: will.deacon, Ard Biesheuvel

The open coded conversion from struct page address to virtual address in
lowmem_page_address() involves an intermediate conversion step to pfn
number/physical address. Since the placement of the struct page array
relative to the linear mapping may be completely independent from the
placement of physical RAM (as is that case for arm64 after commit
dfd55ad85e 'arm64: vmemmap: use virtual projection of linear region'),
the conversion to physical address and back again should factor out of
the equation, but unfortunately, the shifting and pointer arithmetic
involved prevent this from happening, and the resulting calculation
essentially subtracts the address of the start of physical memory and
adds it back again, in a way that prevents the compiler from optimizing
it away.

Since the start of physical memory is not a build time constant on arm64,
the resulting conversion involves an unnecessary memory access, which
we would like to get rid of. So replace the open coded conversion with
a call to page_to_virt(), and use the open coded conversion as its
default definition, to be overriden by the architecture, if desired.
The existing arch specific definitions of page_to_virt are all equivalent
to this default definition, so by itself this patch is a no-op.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 include/linux/mm.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index a55e5be0894f..7d66dbba220f 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -72,6 +72,10 @@ extern int mmap_rnd_compat_bits __read_mostly;
 #define __pa_symbol(x)  __pa(RELOC_HIDE((unsigned long)(x), 0))
 #endif
 
+#ifndef page_to_virt
+#define page_to_virt(x)	__va(PFN_PHYS(page_to_pfn(x)))
+#endif
+
 /*
  * To prevent common memory management code establishing
  * a zero page mapping on a read fault.
@@ -948,7 +952,7 @@ static inline struct mem_cgroup *page_memcg(struct page *page)
 
 static __always_inline void *lowmem_page_address(const struct page *page)
 {
-	return __va(PFN_PHYS(page_to_pfn(page)));
+	return page_to_virt(page);
 }
 
 #if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL)
-- 
2.5.0

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

* [PATCH resend 3/3] mm: replace open coded page to virt conversion with page_to_virt()
@ 2016-04-18 16:04   ` Ard Biesheuvel
  0 siblings, 0 replies; 16+ messages in thread
From: Ard Biesheuvel @ 2016-04-18 16:04 UTC (permalink / raw)
  To: linux-kernel, linux-mm, akpm, lftan, jonas; +Cc: will.deacon, Ard Biesheuvel

The open coded conversion from struct page address to virtual address in
lowmem_page_address() involves an intermediate conversion step to pfn
number/physical address. Since the placement of the struct page array
relative to the linear mapping may be completely independent from the
placement of physical RAM (as is that case for arm64 after commit
dfd55ad85e 'arm64: vmemmap: use virtual projection of linear region'),
the conversion to physical address and back again should factor out of
the equation, but unfortunately, the shifting and pointer arithmetic
involved prevent this from happening, and the resulting calculation
essentially subtracts the address of the start of physical memory and
adds it back again, in a way that prevents the compiler from optimizing
it away.

Since the start of physical memory is not a build time constant on arm64,
the resulting conversion involves an unnecessary memory access, which
we would like to get rid of. So replace the open coded conversion with
a call to page_to_virt(), and use the open coded conversion as its
default definition, to be overriden by the architecture, if desired.
The existing arch specific definitions of page_to_virt are all equivalent
to this default definition, so by itself this patch is a no-op.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 include/linux/mm.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index a55e5be0894f..7d66dbba220f 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -72,6 +72,10 @@ extern int mmap_rnd_compat_bits __read_mostly;
 #define __pa_symbol(x)  __pa(RELOC_HIDE((unsigned long)(x), 0))
 #endif
 
+#ifndef page_to_virt
+#define page_to_virt(x)	__va(PFN_PHYS(page_to_pfn(x)))
+#endif
+
 /*
  * To prevent common memory management code establishing
  * a zero page mapping on a read fault.
@@ -948,7 +952,7 @@ static inline struct mem_cgroup *page_memcg(struct page *page)
 
 static __always_inline void *lowmem_page_address(const struct page *page)
 {
-	return __va(PFN_PHYS(page_to_pfn(page)));
+	return page_to_virt(page);
 }
 
 #if defined(CONFIG_HIGHMEM) && !defined(WANT_PAGE_VIRTUAL)
-- 
2.5.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH resend 0/3] mm: allow arch to override lowmem_page_address
  2016-04-18 16:04 ` Ard Biesheuvel
@ 2016-04-18 16:07   ` Ard Biesheuvel
  -1 siblings, 0 replies; 16+ messages in thread
From: Ard Biesheuvel @ 2016-04-18 16:07 UTC (permalink / raw)
  To: linux-kernel, linux-mm, Andrew Morton, lftan, Jonas Bonn
  Cc: Will Deacon, Ard Biesheuvel

On 18 April 2016 at 18:04, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> These patches allow the arch to define the page_to_virt() conversion that
> is used in lowmem_page_address(). This is desirable for arm64, where this
> conversion is trivial when CONFIG_SPARSEMEM_VMEMMAP is enabled, while
> breaking it up into __va(PFN_PHYS(page_to_pfn(page))), as is done currently
> in lowmem_page_address(), will force the use of a virt-to-phys() conversion
> and back again, which always involves a memory access on arm64, since the
> start of physical memory is not a compile time constant.
>
> I have split off these patches from my series 'arm64: optimize virt_to_page
> and page_address' which I sent out 3 weeks ago, and resending them in the
> hope that they can be picked up (with Will's ack on #3) to be merged via
> the mm tree.
>
> I have cc'ed the nios2 and openrisc maintainers on previous versions, and
> cc'ing them again now. I have dropped both of the arch specific mailing
> lists, since one is defunct and the other is subscriber only.
>
> Andrew, is this something you would be pulling to pick up (assuming that you

s/pulling/willing/

> agree with the contents)? Thanks.
>
> Ard Biesheuvel (3):
>   nios2: use correct void* return type for page_to_virt()
>   openrisc: drop wrongly typed definition of page_to_virt()
>   mm: replace open coded page to virt conversion with page_to_virt()
>
>  arch/nios2/include/asm/io.h      | 1 -
>  arch/nios2/include/asm/page.h    | 2 +-
>  arch/nios2/include/asm/pgtable.h | 2 +-
>  arch/openrisc/include/asm/page.h | 2 --
>  include/linux/mm.h               | 6 +++++-
>  5 files changed, 7 insertions(+), 6 deletions(-)
>
> --
> 2.5.0
>

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

* Re: [PATCH resend 0/3] mm: allow arch to override lowmem_page_address
@ 2016-04-18 16:07   ` Ard Biesheuvel
  0 siblings, 0 replies; 16+ messages in thread
From: Ard Biesheuvel @ 2016-04-18 16:07 UTC (permalink / raw)
  To: linux-kernel, linux-mm, Andrew Morton, lftan, Jonas Bonn
  Cc: Will Deacon, Ard Biesheuvel

On 18 April 2016 at 18:04, Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> These patches allow the arch to define the page_to_virt() conversion that
> is used in lowmem_page_address(). This is desirable for arm64, where this
> conversion is trivial when CONFIG_SPARSEMEM_VMEMMAP is enabled, while
> breaking it up into __va(PFN_PHYS(page_to_pfn(page))), as is done currently
> in lowmem_page_address(), will force the use of a virt-to-phys() conversion
> and back again, which always involves a memory access on arm64, since the
> start of physical memory is not a compile time constant.
>
> I have split off these patches from my series 'arm64: optimize virt_to_page
> and page_address' which I sent out 3 weeks ago, and resending them in the
> hope that they can be picked up (with Will's ack on #3) to be merged via
> the mm tree.
>
> I have cc'ed the nios2 and openrisc maintainers on previous versions, and
> cc'ing them again now. I have dropped both of the arch specific mailing
> lists, since one is defunct and the other is subscriber only.
>
> Andrew, is this something you would be pulling to pick up (assuming that you

s/pulling/willing/

> agree with the contents)? Thanks.
>
> Ard Biesheuvel (3):
>   nios2: use correct void* return type for page_to_virt()
>   openrisc: drop wrongly typed definition of page_to_virt()
>   mm: replace open coded page to virt conversion with page_to_virt()
>
>  arch/nios2/include/asm/io.h      | 1 -
>  arch/nios2/include/asm/page.h    | 2 +-
>  arch/nios2/include/asm/pgtable.h | 2 +-
>  arch/openrisc/include/asm/page.h | 2 --
>  include/linux/mm.h               | 6 +++++-
>  5 files changed, 7 insertions(+), 6 deletions(-)
>
> --
> 2.5.0
>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH resend 1/3] nios2: use correct void* return type for page_to_virt()
  2016-04-18 16:04   ` Ard Biesheuvel
@ 2016-04-19  9:35     ` Ley Foon Tan
  -1 siblings, 0 replies; 16+ messages in thread
From: Ley Foon Tan @ 2016-04-19  9:35 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: linux-kernel, linux-mm, Andrew Morton, Jonas Bonn, will.deacon

On Tue, Apr 19, 2016 at 12:04 AM, Ard Biesheuvel
<ard.biesheuvel@linaro.org> wrote:
>
> To align with other architectures, the expression produced by expanding
> the macro page_to_virt() should be of type void*, since it returns a
> virtual address. Fix that, and also fix up an instance where page_to_virt
> was expected to return 'unsigned long', and drop another instance that was
> entirely unused (page_to_bus)
>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  arch/nios2/include/asm/io.h      | 1 -
>  arch/nios2/include/asm/page.h    | 2 +-
>  arch/nios2/include/asm/pgtable.h | 2 +-
>  3 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/arch/nios2/include/asm/io.h b/arch/nios2/include/asm/io.h
> index c5a62da22cd2..ce072ba0f8dd 100644
> --- a/arch/nios2/include/asm/io.h
> +++ b/arch/nios2/include/asm/io.h
> @@ -50,7 +50,6 @@ static inline void iounmap(void __iomem *addr)
>
>  /* Pages to physical address... */
>  #define page_to_phys(page)     virt_to_phys(page_to_virt(page))
> -#define page_to_bus(page)      page_to_virt(page)
>
>  /* Macros used for converting between virtual and physical mappings. */
>  #define phys_to_virt(vaddr)    \
> diff --git a/arch/nios2/include/asm/page.h b/arch/nios2/include/asm/page.h
> index 4b32d6fd9d98..c1683f51ad0f 100644
> --- a/arch/nios2/include/asm/page.h
> +++ b/arch/nios2/include/asm/page.h
> @@ -84,7 +84,7 @@ extern struct page *mem_map;
>         ((void *)((unsigned long)(x) + PAGE_OFFSET - PHYS_OFFSET))
>
>  #define page_to_virt(page)     \
> -       ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
> +       ((void *)(((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
>
>  # define pfn_to_kaddr(pfn)     __va((pfn) << PAGE_SHIFT)
>  # define pfn_valid(pfn)                ((pfn) >= ARCH_PFN_OFFSET &&    \
> diff --git a/arch/nios2/include/asm/pgtable.h b/arch/nios2/include/asm/pgtable.h
> index a213e8c9aad0..298393c3cb42 100644
> --- a/arch/nios2/include/asm/pgtable.h
> +++ b/arch/nios2/include/asm/pgtable.h
> @@ -209,7 +209,7 @@ static inline void set_pte(pte_t *ptep, pte_t pteval)
>  static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
>                               pte_t *ptep, pte_t pteval)
>  {
> -       unsigned long paddr = page_to_virt(pte_page(pteval));
> +       unsigned long paddr = (unsigned long)page_to_virt(pte_page(pteval));
>
>         flush_dcache_range(paddr, paddr + PAGE_SIZE);
>         set_pte(ptep, pteval);
> --
Acked-by: Ley Foon Tan <lftan@altera.com>

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

* Re: [PATCH resend 1/3] nios2: use correct void* return type for page_to_virt()
@ 2016-04-19  9:35     ` Ley Foon Tan
  0 siblings, 0 replies; 16+ messages in thread
From: Ley Foon Tan @ 2016-04-19  9:35 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: linux-kernel, linux-mm, Andrew Morton, Jonas Bonn, will.deacon

On Tue, Apr 19, 2016 at 12:04 AM, Ard Biesheuvel
<ard.biesheuvel@linaro.org> wrote:
>
> To align with other architectures, the expression produced by expanding
> the macro page_to_virt() should be of type void*, since it returns a
> virtual address. Fix that, and also fix up an instance where page_to_virt
> was expected to return 'unsigned long', and drop another instance that was
> entirely unused (page_to_bus)
>
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  arch/nios2/include/asm/io.h      | 1 -
>  arch/nios2/include/asm/page.h    | 2 +-
>  arch/nios2/include/asm/pgtable.h | 2 +-
>  3 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/arch/nios2/include/asm/io.h b/arch/nios2/include/asm/io.h
> index c5a62da22cd2..ce072ba0f8dd 100644
> --- a/arch/nios2/include/asm/io.h
> +++ b/arch/nios2/include/asm/io.h
> @@ -50,7 +50,6 @@ static inline void iounmap(void __iomem *addr)
>
>  /* Pages to physical address... */
>  #define page_to_phys(page)     virt_to_phys(page_to_virt(page))
> -#define page_to_bus(page)      page_to_virt(page)
>
>  /* Macros used for converting between virtual and physical mappings. */
>  #define phys_to_virt(vaddr)    \
> diff --git a/arch/nios2/include/asm/page.h b/arch/nios2/include/asm/page.h
> index 4b32d6fd9d98..c1683f51ad0f 100644
> --- a/arch/nios2/include/asm/page.h
> +++ b/arch/nios2/include/asm/page.h
> @@ -84,7 +84,7 @@ extern struct page *mem_map;
>         ((void *)((unsigned long)(x) + PAGE_OFFSET - PHYS_OFFSET))
>
>  #define page_to_virt(page)     \
> -       ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
> +       ((void *)(((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET)
>
>  # define pfn_to_kaddr(pfn)     __va((pfn) << PAGE_SHIFT)
>  # define pfn_valid(pfn)                ((pfn) >= ARCH_PFN_OFFSET &&    \
> diff --git a/arch/nios2/include/asm/pgtable.h b/arch/nios2/include/asm/pgtable.h
> index a213e8c9aad0..298393c3cb42 100644
> --- a/arch/nios2/include/asm/pgtable.h
> +++ b/arch/nios2/include/asm/pgtable.h
> @@ -209,7 +209,7 @@ static inline void set_pte(pte_t *ptep, pte_t pteval)
>  static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
>                               pte_t *ptep, pte_t pteval)
>  {
> -       unsigned long paddr = page_to_virt(pte_page(pteval));
> +       unsigned long paddr = (unsigned long)page_to_virt(pte_page(pteval));
>
>         flush_dcache_range(paddr, paddr + PAGE_SIZE);
>         set_pte(ptep, pteval);
> --
Acked-by: Ley Foon Tan <lftan@altera.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH resend 0/3] mm: allow arch to override lowmem_page_address
  2016-04-18 16:04 ` Ard Biesheuvel
@ 2016-04-21 23:51   ` Andrew Morton
  -1 siblings, 0 replies; 16+ messages in thread
From: Andrew Morton @ 2016-04-21 23:51 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: linux-kernel, linux-mm, lftan, jonas, will.deacon

On Mon, 18 Apr 2016 18:04:54 +0200 Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:

> These patches allow the arch to define the page_to_virt() conversion that
> is used in lowmem_page_address(). This is desirable for arm64, where this
> conversion is trivial when CONFIG_SPARSEMEM_VMEMMAP is enabled, while
> breaking it up into __va(PFN_PHYS(page_to_pfn(page))), as is done currently
> in lowmem_page_address(), will force the use of a virt-to-phys() conversion
> and back again, which always involves a memory access on arm64, since the
> start of physical memory is not a compile time constant.
> 
> I have split off these patches from my series 'arm64: optimize virt_to_page
> and page_address' which I sent out 3 weeks ago, and resending them in the
> hope that they can be picked up (with Will's ack on #3) to be merged via
> the mm tree.
> 
> I have cc'ed the nios2 and openrisc maintainers on previous versions, and
> cc'ing them again now. I have dropped both of the arch specific mailing
> lists, since one is defunct and the other is subscriber only.
> 
> Andrew, is this something you would be pulling to pick up (assuming that you
> agree with the contents)? Thanks.

Looks OK to me and apart from the trivial openrisc/nios2 changes it's
obviously a no-op for all-but-arm.  So I suggest you include these
patches in the appropriate arm tree.

Acked-by: Andrew Morton <akpm@linux-foundation.org>

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

* Re: [PATCH resend 0/3] mm: allow arch to override lowmem_page_address
@ 2016-04-21 23:51   ` Andrew Morton
  0 siblings, 0 replies; 16+ messages in thread
From: Andrew Morton @ 2016-04-21 23:51 UTC (permalink / raw)
  To: Ard Biesheuvel; +Cc: linux-kernel, linux-mm, lftan, jonas, will.deacon

On Mon, 18 Apr 2016 18:04:54 +0200 Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:

> These patches allow the arch to define the page_to_virt() conversion that
> is used in lowmem_page_address(). This is desirable for arm64, where this
> conversion is trivial when CONFIG_SPARSEMEM_VMEMMAP is enabled, while
> breaking it up into __va(PFN_PHYS(page_to_pfn(page))), as is done currently
> in lowmem_page_address(), will force the use of a virt-to-phys() conversion
> and back again, which always involves a memory access on arm64, since the
> start of physical memory is not a compile time constant.
> 
> I have split off these patches from my series 'arm64: optimize virt_to_page
> and page_address' which I sent out 3 weeks ago, and resending them in the
> hope that they can be picked up (with Will's ack on #3) to be merged via
> the mm tree.
> 
> I have cc'ed the nios2 and openrisc maintainers on previous versions, and
> cc'ing them again now. I have dropped both of the arch specific mailing
> lists, since one is defunct and the other is subscriber only.
> 
> Andrew, is this something you would be pulling to pick up (assuming that you
> agree with the contents)? Thanks.

Looks OK to me and apart from the trivial openrisc/nios2 changes it's
obviously a no-op for all-but-arm.  So I suggest you include these
patches in the appropriate arm tree.

Acked-by: Andrew Morton <akpm@linux-foundation.org>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH resend 0/3] mm: allow arch to override lowmem_page_address
  2016-04-21 23:51   ` Andrew Morton
@ 2016-04-22  9:07     ` Will Deacon
  -1 siblings, 0 replies; 16+ messages in thread
From: Will Deacon @ 2016-04-22  9:07 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Ard Biesheuvel, linux-kernel, linux-mm, lftan, jonas

On Thu, Apr 21, 2016 at 04:51:38PM -0700, Andrew Morton wrote:
> On Mon, 18 Apr 2016 18:04:54 +0200 Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> 
> > These patches allow the arch to define the page_to_virt() conversion that
> > is used in lowmem_page_address(). This is desirable for arm64, where this
> > conversion is trivial when CONFIG_SPARSEMEM_VMEMMAP is enabled, while
> > breaking it up into __va(PFN_PHYS(page_to_pfn(page))), as is done currently
> > in lowmem_page_address(), will force the use of a virt-to-phys() conversion
> > and back again, which always involves a memory access on arm64, since the
> > start of physical memory is not a compile time constant.
> > 
> > I have split off these patches from my series 'arm64: optimize virt_to_page
> > and page_address' which I sent out 3 weeks ago, and resending them in the
> > hope that they can be picked up (with Will's ack on #3) to be merged via
> > the mm tree.
> > 
> > I have cc'ed the nios2 and openrisc maintainers on previous versions, and
> > cc'ing them again now. I have dropped both of the arch specific mailing
> > lists, since one is defunct and the other is subscriber only.
> > 
> > Andrew, is this something you would be pulling to pick up (assuming that you
> > agree with the contents)? Thanks.
> 
> Looks OK to me and apart from the trivial openrisc/nios2 changes it's
> obviously a no-op for all-but-arm.  So I suggest you include these
> patches in the appropriate arm tree.
> 
> Acked-by: Andrew Morton <akpm@linux-foundation.org>

Cracking, thanks Andrew. I'll queue these three in the arm64 tree and get
them into -next.

Will

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

* Re: [PATCH resend 0/3] mm: allow arch to override lowmem_page_address
@ 2016-04-22  9:07     ` Will Deacon
  0 siblings, 0 replies; 16+ messages in thread
From: Will Deacon @ 2016-04-22  9:07 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Ard Biesheuvel, linux-kernel, linux-mm, lftan, jonas

On Thu, Apr 21, 2016 at 04:51:38PM -0700, Andrew Morton wrote:
> On Mon, 18 Apr 2016 18:04:54 +0200 Ard Biesheuvel <ard.biesheuvel@linaro.org> wrote:
> 
> > These patches allow the arch to define the page_to_virt() conversion that
> > is used in lowmem_page_address(). This is desirable for arm64, where this
> > conversion is trivial when CONFIG_SPARSEMEM_VMEMMAP is enabled, while
> > breaking it up into __va(PFN_PHYS(page_to_pfn(page))), as is done currently
> > in lowmem_page_address(), will force the use of a virt-to-phys() conversion
> > and back again, which always involves a memory access on arm64, since the
> > start of physical memory is not a compile time constant.
> > 
> > I have split off these patches from my series 'arm64: optimize virt_to_page
> > and page_address' which I sent out 3 weeks ago, and resending them in the
> > hope that they can be picked up (with Will's ack on #3) to be merged via
> > the mm tree.
> > 
> > I have cc'ed the nios2 and openrisc maintainers on previous versions, and
> > cc'ing them again now. I have dropped both of the arch specific mailing
> > lists, since one is defunct and the other is subscriber only.
> > 
> > Andrew, is this something you would be pulling to pick up (assuming that you
> > agree with the contents)? Thanks.
> 
> Looks OK to me and apart from the trivial openrisc/nios2 changes it's
> obviously a no-op for all-but-arm.  So I suggest you include these
> patches in the appropriate arm tree.
> 
> Acked-by: Andrew Morton <akpm@linux-foundation.org>

Cracking, thanks Andrew. I'll queue these three in the arm64 tree and get
them into -next.

Will

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2016-04-22  9:07 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-18 16:04 [PATCH resend 0/3] mm: allow arch to override lowmem_page_address Ard Biesheuvel
2016-04-18 16:04 ` Ard Biesheuvel
2016-04-18 16:04 ` [PATCH resend 1/3] nios2: use correct void* return type for page_to_virt() Ard Biesheuvel
2016-04-18 16:04   ` Ard Biesheuvel
2016-04-19  9:35   ` Ley Foon Tan
2016-04-19  9:35     ` Ley Foon Tan
2016-04-18 16:04 ` [PATCH resend 2/3] openrisc: drop wrongly typed definition of page_to_virt() Ard Biesheuvel
2016-04-18 16:04   ` Ard Biesheuvel
2016-04-18 16:04 ` [PATCH resend 3/3] mm: replace open coded page to virt conversion with page_to_virt() Ard Biesheuvel
2016-04-18 16:04   ` Ard Biesheuvel
2016-04-18 16:07 ` [PATCH resend 0/3] mm: allow arch to override lowmem_page_address Ard Biesheuvel
2016-04-18 16:07   ` Ard Biesheuvel
2016-04-21 23:51 ` Andrew Morton
2016-04-21 23:51   ` Andrew Morton
2016-04-22  9:07   ` Will Deacon
2016-04-22  9:07     ` Will Deacon

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.