* [PATCH] arm64: mte: Map hotplugged memory as Normal Tagged
@ 2021-03-09 12:26 ` Catalin Marinas
0 siblings, 0 replies; 12+ messages in thread
From: Catalin Marinas @ 2021-03-09 12:26 UTC (permalink / raw)
To: linux-arm-kernel
Cc: linux-mm, Anshuman Khandual, Patrick Daly, Will Deacon,
Andrew Morton, Vincenzo Frascino, David Hildenbrand
In a system supporting MTE, the linear map must allow reading/writing
allocation tags by setting the memory type as Normal Tagged. Currently,
this is only handled for memory present at boot. Hotplugged memory uses
Normal non-Tagged memory.
Introduce pgprot_mhp() for hotplugged memory and use it in
add_memory_resource(). The arm64 code maps pgprot_mhp() to
pgprot_tagged().
Note that ZONE_DEVICE memory should not be mapped as Tagged and
therefore setting the memory type in arch_add_memory() is not feasible.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Fixes: 0178dc761368 ("arm64: mte: Use Normal Tagged attributes for the linear map")
Reported-by: Patrick Daly <pdaly@codeaurora.org>
Link: https://lore.kernel.org/r/1614745263-27827-1-git-send-email-pdaly@codeaurora.org
Cc: <stable@vger.kernel.org> # 5.10.x
Cc: Will Deacon <will@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: David Hildenbrand <david@redhat.com>
---
Patrick, could you please give this patch a try on your platform? Thanks.
arch/arm64/include/asm/pgtable-prot.h | 1 -
arch/arm64/include/asm/pgtable.h | 3 +++
arch/arm64/mm/mmu.c | 3 ++-
include/linux/pgtable.h | 4 ++++
mm/memory_hotplug.c | 2 +-
5 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/arch/arm64/include/asm/pgtable-prot.h b/arch/arm64/include/asm/pgtable-prot.h
index 046be789fbb4..9a65fb528110 100644
--- a/arch/arm64/include/asm/pgtable-prot.h
+++ b/arch/arm64/include/asm/pgtable-prot.h
@@ -66,7 +66,6 @@ extern bool arm64_use_ng_mappings;
#define _PAGE_DEFAULT (_PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL))
#define PAGE_KERNEL __pgprot(PROT_NORMAL)
-#define PAGE_KERNEL_TAGGED __pgprot(PROT_NORMAL_TAGGED)
#define PAGE_KERNEL_RO __pgprot((PROT_NORMAL & ~PTE_WRITE) | PTE_RDONLY)
#define PAGE_KERNEL_ROX __pgprot((PROT_NORMAL & ~(PTE_WRITE | PTE_PXN)) | PTE_RDONLY)
#define PAGE_KERNEL_EXEC __pgprot(PROT_NORMAL & ~PTE_PXN)
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index e17b96d0e4b5..47027796c2f9 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -486,6 +486,9 @@ static inline pmd_t pmd_mkdevmap(pmd_t pmd)
__pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC) | PTE_PXN | PTE_UXN)
#define pgprot_device(prot) \
__pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_DEVICE_nGnRE) | PTE_PXN | PTE_UXN)
+#define pgprot_tagged(prot) \
+ __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_TAGGED))
+#define pgprot_mhp pgprot_tagged
/*
* DMA allocations for non-coherent devices use what the Arm architecture calls
* "Normal non-cacheable" memory, which permits speculation, unaligned accesses
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 3802cfbdd20d..9c8aa1b44cd5 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -512,7 +512,8 @@ static void __init map_mem(pgd_t *pgdp)
* if MTE is present. Otherwise, it has the same attributes as
* PAGE_KERNEL.
*/
- __map_memblock(pgdp, start, end, PAGE_KERNEL_TAGGED, flags);
+ __map_memblock(pgdp, start, end, pgprot_tagged(PAGE_KERNEL),
+ flags);
}
/*
diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
index cdfc4e9f253e..5e772392a379 100644
--- a/include/linux/pgtable.h
+++ b/include/linux/pgtable.h
@@ -904,6 +904,10 @@ static inline void ptep_modify_prot_commit(struct vm_area_struct *vma,
#define pgprot_device pgprot_noncached
#endif
+#ifndef pgprot_mhp
+#define pgprot_mhp(prot) (prot)
+#endif
+
#ifdef CONFIG_MMU
#ifndef pgprot_modify
#define pgprot_modify pgprot_modify
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 5ba51a8bdaeb..0cdbbfbc5757 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1072,7 +1072,7 @@ static int online_memory_block(struct memory_block *mem, void *arg)
*/
int __ref add_memory_resource(int nid, struct resource *res, mhp_t mhp_flags)
{
- struct mhp_params params = { .pgprot = PAGE_KERNEL };
+ struct mhp_params params = { .pgprot = pgprot_mhp(PAGE_KERNEL) };
u64 start, size;
bool new_node = false;
int ret;
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH] arm64: mte: Map hotplugged memory as Normal Tagged
@ 2021-03-09 12:26 ` Catalin Marinas
0 siblings, 0 replies; 12+ messages in thread
From: Catalin Marinas @ 2021-03-09 12:26 UTC (permalink / raw)
To: linux-arm-kernel
Cc: linux-mm, Anshuman Khandual, Patrick Daly, Will Deacon,
Andrew Morton, Vincenzo Frascino, David Hildenbrand
In a system supporting MTE, the linear map must allow reading/writing
allocation tags by setting the memory type as Normal Tagged. Currently,
this is only handled for memory present at boot. Hotplugged memory uses
Normal non-Tagged memory.
Introduce pgprot_mhp() for hotplugged memory and use it in
add_memory_resource(). The arm64 code maps pgprot_mhp() to
pgprot_tagged().
Note that ZONE_DEVICE memory should not be mapped as Tagged and
therefore setting the memory type in arch_add_memory() is not feasible.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Fixes: 0178dc761368 ("arm64: mte: Use Normal Tagged attributes for the linear map")
Reported-by: Patrick Daly <pdaly@codeaurora.org>
Link: https://lore.kernel.org/r/1614745263-27827-1-git-send-email-pdaly@codeaurora.org
Cc: <stable@vger.kernel.org> # 5.10.x
Cc: Will Deacon <will@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Cc: David Hildenbrand <david@redhat.com>
---
Patrick, could you please give this patch a try on your platform? Thanks.
arch/arm64/include/asm/pgtable-prot.h | 1 -
arch/arm64/include/asm/pgtable.h | 3 +++
arch/arm64/mm/mmu.c | 3 ++-
include/linux/pgtable.h | 4 ++++
mm/memory_hotplug.c | 2 +-
5 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/arch/arm64/include/asm/pgtable-prot.h b/arch/arm64/include/asm/pgtable-prot.h
index 046be789fbb4..9a65fb528110 100644
--- a/arch/arm64/include/asm/pgtable-prot.h
+++ b/arch/arm64/include/asm/pgtable-prot.h
@@ -66,7 +66,6 @@ extern bool arm64_use_ng_mappings;
#define _PAGE_DEFAULT (_PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL))
#define PAGE_KERNEL __pgprot(PROT_NORMAL)
-#define PAGE_KERNEL_TAGGED __pgprot(PROT_NORMAL_TAGGED)
#define PAGE_KERNEL_RO __pgprot((PROT_NORMAL & ~PTE_WRITE) | PTE_RDONLY)
#define PAGE_KERNEL_ROX __pgprot((PROT_NORMAL & ~(PTE_WRITE | PTE_PXN)) | PTE_RDONLY)
#define PAGE_KERNEL_EXEC __pgprot(PROT_NORMAL & ~PTE_PXN)
diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
index e17b96d0e4b5..47027796c2f9 100644
--- a/arch/arm64/include/asm/pgtable.h
+++ b/arch/arm64/include/asm/pgtable.h
@@ -486,6 +486,9 @@ static inline pmd_t pmd_mkdevmap(pmd_t pmd)
__pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC) | PTE_PXN | PTE_UXN)
#define pgprot_device(prot) \
__pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_DEVICE_nGnRE) | PTE_PXN | PTE_UXN)
+#define pgprot_tagged(prot) \
+ __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_TAGGED))
+#define pgprot_mhp pgprot_tagged
/*
* DMA allocations for non-coherent devices use what the Arm architecture calls
* "Normal non-cacheable" memory, which permits speculation, unaligned accesses
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index 3802cfbdd20d..9c8aa1b44cd5 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -512,7 +512,8 @@ static void __init map_mem(pgd_t *pgdp)
* if MTE is present. Otherwise, it has the same attributes as
* PAGE_KERNEL.
*/
- __map_memblock(pgdp, start, end, PAGE_KERNEL_TAGGED, flags);
+ __map_memblock(pgdp, start, end, pgprot_tagged(PAGE_KERNEL),
+ flags);
}
/*
diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
index cdfc4e9f253e..5e772392a379 100644
--- a/include/linux/pgtable.h
+++ b/include/linux/pgtable.h
@@ -904,6 +904,10 @@ static inline void ptep_modify_prot_commit(struct vm_area_struct *vma,
#define pgprot_device pgprot_noncached
#endif
+#ifndef pgprot_mhp
+#define pgprot_mhp(prot) (prot)
+#endif
+
#ifdef CONFIG_MMU
#ifndef pgprot_modify
#define pgprot_modify pgprot_modify
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 5ba51a8bdaeb..0cdbbfbc5757 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1072,7 +1072,7 @@ static int online_memory_block(struct memory_block *mem, void *arg)
*/
int __ref add_memory_resource(int nid, struct resource *res, mhp_t mhp_flags)
{
- struct mhp_params params = { .pgprot = PAGE_KERNEL };
+ struct mhp_params params = { .pgprot = pgprot_mhp(PAGE_KERNEL) };
u64 start, size;
bool new_node = false;
int ret;
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] arm64: mte: Map hotplugged memory as Normal Tagged
2021-03-09 12:26 ` Catalin Marinas
@ 2021-03-09 12:28 ` David Hildenbrand
-1 siblings, 0 replies; 12+ messages in thread
From: David Hildenbrand @ 2021-03-09 12:28 UTC (permalink / raw)
To: Catalin Marinas, linux-arm-kernel
Cc: linux-mm, Anshuman Khandual, Patrick Daly, Will Deacon,
Andrew Morton, Vincenzo Frascino
On 09.03.21 13:26, Catalin Marinas wrote:
> In a system supporting MTE, the linear map must allow reading/writing
> allocation tags by setting the memory type as Normal Tagged. Currently,
> this is only handled for memory present at boot. Hotplugged memory uses
> Normal non-Tagged memory.
>
> Introduce pgprot_mhp() for hotplugged memory and use it in
> add_memory_resource(). The arm64 code maps pgprot_mhp() to
> pgprot_tagged().
>
> Note that ZONE_DEVICE memory should not be mapped as Tagged and
> therefore setting the memory type in arch_add_memory() is not feasible.
>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> Fixes: 0178dc761368 ("arm64: mte: Use Normal Tagged attributes for the linear map")
> Reported-by: Patrick Daly <pdaly@codeaurora.org>
> Link: https://lore.kernel.org/r/1614745263-27827-1-git-send-email-pdaly@codeaurora.org
> Cc: <stable@vger.kernel.org> # 5.10.x
> Cc: Will Deacon <will@kernel.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
> Cc: David Hildenbrand <david@redhat.com>
> ---
>
> Patrick, could you please give this patch a try on your platform? Thanks.
>
> arch/arm64/include/asm/pgtable-prot.h | 1 -
> arch/arm64/include/asm/pgtable.h | 3 +++
> arch/arm64/mm/mmu.c | 3 ++-
> include/linux/pgtable.h | 4 ++++
> mm/memory_hotplug.c | 2 +-
> 5 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm64/include/asm/pgtable-prot.h b/arch/arm64/include/asm/pgtable-prot.h
> index 046be789fbb4..9a65fb528110 100644
> --- a/arch/arm64/include/asm/pgtable-prot.h
> +++ b/arch/arm64/include/asm/pgtable-prot.h
> @@ -66,7 +66,6 @@ extern bool arm64_use_ng_mappings;
> #define _PAGE_DEFAULT (_PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL))
>
> #define PAGE_KERNEL __pgprot(PROT_NORMAL)
> -#define PAGE_KERNEL_TAGGED __pgprot(PROT_NORMAL_TAGGED)
> #define PAGE_KERNEL_RO __pgprot((PROT_NORMAL & ~PTE_WRITE) | PTE_RDONLY)
> #define PAGE_KERNEL_ROX __pgprot((PROT_NORMAL & ~(PTE_WRITE | PTE_PXN)) | PTE_RDONLY)
> #define PAGE_KERNEL_EXEC __pgprot(PROT_NORMAL & ~PTE_PXN)
> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
> index e17b96d0e4b5..47027796c2f9 100644
> --- a/arch/arm64/include/asm/pgtable.h
> +++ b/arch/arm64/include/asm/pgtable.h
> @@ -486,6 +486,9 @@ static inline pmd_t pmd_mkdevmap(pmd_t pmd)
> __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC) | PTE_PXN | PTE_UXN)
> #define pgprot_device(prot) \
> __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_DEVICE_nGnRE) | PTE_PXN | PTE_UXN)
> +#define pgprot_tagged(prot) \
> + __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_TAGGED))
> +#define pgprot_mhp pgprot_tagged
> /*
> * DMA allocations for non-coherent devices use what the Arm architecture calls
> * "Normal non-cacheable" memory, which permits speculation, unaligned accesses
> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> index 3802cfbdd20d..9c8aa1b44cd5 100644
> --- a/arch/arm64/mm/mmu.c
> +++ b/arch/arm64/mm/mmu.c
> @@ -512,7 +512,8 @@ static void __init map_mem(pgd_t *pgdp)
> * if MTE is present. Otherwise, it has the same attributes as
> * PAGE_KERNEL.
> */
> - __map_memblock(pgdp, start, end, PAGE_KERNEL_TAGGED, flags);
> + __map_memblock(pgdp, start, end, pgprot_tagged(PAGE_KERNEL),
> + flags);
> }
>
> /*
> diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
> index cdfc4e9f253e..5e772392a379 100644
> --- a/include/linux/pgtable.h
> +++ b/include/linux/pgtable.h
> @@ -904,6 +904,10 @@ static inline void ptep_modify_prot_commit(struct vm_area_struct *vma,
> #define pgprot_device pgprot_noncached
> #endif
>
> +#ifndef pgprot_mhp
> +#define pgprot_mhp(prot) (prot)
> +#endif
> +
> #ifdef CONFIG_MMU
> #ifndef pgprot_modify
> #define pgprot_modify pgprot_modify
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 5ba51a8bdaeb..0cdbbfbc5757 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1072,7 +1072,7 @@ static int online_memory_block(struct memory_block *mem, void *arg)
> */
> int __ref add_memory_resource(int nid, struct resource *res, mhp_t mhp_flags)
> {
> - struct mhp_params params = { .pgprot = PAGE_KERNEL };
> + struct mhp_params params = { .pgprot = pgprot_mhp(PAGE_KERNEL) };
> u64 start, size;
> bool new_node = false;
> int ret;
>
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] arm64: mte: Map hotplugged memory as Normal Tagged
@ 2021-03-09 12:28 ` David Hildenbrand
0 siblings, 0 replies; 12+ messages in thread
From: David Hildenbrand @ 2021-03-09 12:28 UTC (permalink / raw)
To: Catalin Marinas, linux-arm-kernel
Cc: linux-mm, Anshuman Khandual, Patrick Daly, Will Deacon,
Andrew Morton, Vincenzo Frascino
On 09.03.21 13:26, Catalin Marinas wrote:
> In a system supporting MTE, the linear map must allow reading/writing
> allocation tags by setting the memory type as Normal Tagged. Currently,
> this is only handled for memory present at boot. Hotplugged memory uses
> Normal non-Tagged memory.
>
> Introduce pgprot_mhp() for hotplugged memory and use it in
> add_memory_resource(). The arm64 code maps pgprot_mhp() to
> pgprot_tagged().
>
> Note that ZONE_DEVICE memory should not be mapped as Tagged and
> therefore setting the memory type in arch_add_memory() is not feasible.
>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> Fixes: 0178dc761368 ("arm64: mte: Use Normal Tagged attributes for the linear map")
> Reported-by: Patrick Daly <pdaly@codeaurora.org>
> Link: https://lore.kernel.org/r/1614745263-27827-1-git-send-email-pdaly@codeaurora.org
> Cc: <stable@vger.kernel.org> # 5.10.x
> Cc: Will Deacon <will@kernel.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
> Cc: David Hildenbrand <david@redhat.com>
> ---
>
> Patrick, could you please give this patch a try on your platform? Thanks.
>
> arch/arm64/include/asm/pgtable-prot.h | 1 -
> arch/arm64/include/asm/pgtable.h | 3 +++
> arch/arm64/mm/mmu.c | 3 ++-
> include/linux/pgtable.h | 4 ++++
> mm/memory_hotplug.c | 2 +-
> 5 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm64/include/asm/pgtable-prot.h b/arch/arm64/include/asm/pgtable-prot.h
> index 046be789fbb4..9a65fb528110 100644
> --- a/arch/arm64/include/asm/pgtable-prot.h
> +++ b/arch/arm64/include/asm/pgtable-prot.h
> @@ -66,7 +66,6 @@ extern bool arm64_use_ng_mappings;
> #define _PAGE_DEFAULT (_PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL))
>
> #define PAGE_KERNEL __pgprot(PROT_NORMAL)
> -#define PAGE_KERNEL_TAGGED __pgprot(PROT_NORMAL_TAGGED)
> #define PAGE_KERNEL_RO __pgprot((PROT_NORMAL & ~PTE_WRITE) | PTE_RDONLY)
> #define PAGE_KERNEL_ROX __pgprot((PROT_NORMAL & ~(PTE_WRITE | PTE_PXN)) | PTE_RDONLY)
> #define PAGE_KERNEL_EXEC __pgprot(PROT_NORMAL & ~PTE_PXN)
> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
> index e17b96d0e4b5..47027796c2f9 100644
> --- a/arch/arm64/include/asm/pgtable.h
> +++ b/arch/arm64/include/asm/pgtable.h
> @@ -486,6 +486,9 @@ static inline pmd_t pmd_mkdevmap(pmd_t pmd)
> __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC) | PTE_PXN | PTE_UXN)
> #define pgprot_device(prot) \
> __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_DEVICE_nGnRE) | PTE_PXN | PTE_UXN)
> +#define pgprot_tagged(prot) \
> + __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_TAGGED))
> +#define pgprot_mhp pgprot_tagged
> /*
> * DMA allocations for non-coherent devices use what the Arm architecture calls
> * "Normal non-cacheable" memory, which permits speculation, unaligned accesses
> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> index 3802cfbdd20d..9c8aa1b44cd5 100644
> --- a/arch/arm64/mm/mmu.c
> +++ b/arch/arm64/mm/mmu.c
> @@ -512,7 +512,8 @@ static void __init map_mem(pgd_t *pgdp)
> * if MTE is present. Otherwise, it has the same attributes as
> * PAGE_KERNEL.
> */
> - __map_memblock(pgdp, start, end, PAGE_KERNEL_TAGGED, flags);
> + __map_memblock(pgdp, start, end, pgprot_tagged(PAGE_KERNEL),
> + flags);
> }
>
> /*
> diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
> index cdfc4e9f253e..5e772392a379 100644
> --- a/include/linux/pgtable.h
> +++ b/include/linux/pgtable.h
> @@ -904,6 +904,10 @@ static inline void ptep_modify_prot_commit(struct vm_area_struct *vma,
> #define pgprot_device pgprot_noncached
> #endif
>
> +#ifndef pgprot_mhp
> +#define pgprot_mhp(prot) (prot)
> +#endif
> +
> #ifdef CONFIG_MMU
> #ifndef pgprot_modify
> #define pgprot_modify pgprot_modify
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 5ba51a8bdaeb..0cdbbfbc5757 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1072,7 +1072,7 @@ static int online_memory_block(struct memory_block *mem, void *arg)
> */
> int __ref add_memory_resource(int nid, struct resource *res, mhp_t mhp_flags)
> {
> - struct mhp_params params = { .pgprot = PAGE_KERNEL };
> + struct mhp_params params = { .pgprot = pgprot_mhp(PAGE_KERNEL) };
> u64 start, size;
> bool new_node = false;
> int ret;
>
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Thanks,
David / dhildenb
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] arm64: mte: Map hotplugged memory as Normal Tagged
2021-03-09 12:26 ` Catalin Marinas
@ 2021-03-09 12:35 ` Vincenzo Frascino
-1 siblings, 0 replies; 12+ messages in thread
From: Vincenzo Frascino @ 2021-03-09 12:35 UTC (permalink / raw)
To: Catalin Marinas, linux-arm-kernel
Cc: linux-mm, Anshuman Khandual, Patrick Daly, Will Deacon,
Andrew Morton, David Hildenbrand
On 3/9/21 12:26 PM, Catalin Marinas wrote:
> In a system supporting MTE, the linear map must allow reading/writing
> allocation tags by setting the memory type as Normal Tagged. Currently,
> this is only handled for memory present at boot. Hotplugged memory uses
> Normal non-Tagged memory.
>
> Introduce pgprot_mhp() for hotplugged memory and use it in
> add_memory_resource(). The arm64 code maps pgprot_mhp() to
> pgprot_tagged().
>
> Note that ZONE_DEVICE memory should not be mapped as Tagged and
> therefore setting the memory type in arch_add_memory() is not feasible.
>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> Fixes: 0178dc761368 ("arm64: mte: Use Normal Tagged attributes for the linear map")
> Reported-by: Patrick Daly <pdaly@codeaurora.org>
> Link: https://lore.kernel.org/r/1614745263-27827-1-git-send-email-pdaly@codeaurora.org
> Cc: <stable@vger.kernel.org> # 5.10.x
> Cc: Will Deacon <will@kernel.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
> Cc: David Hildenbrand <david@redhat.com>
Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
> ---
>
> Patrick, could you please give this patch a try on your platform? Thanks.
>
> arch/arm64/include/asm/pgtable-prot.h | 1 -
> arch/arm64/include/asm/pgtable.h | 3 +++
> arch/arm64/mm/mmu.c | 3 ++-
> include/linux/pgtable.h | 4 ++++
> mm/memory_hotplug.c | 2 +-
> 5 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm64/include/asm/pgtable-prot.h b/arch/arm64/include/asm/pgtable-prot.h
> index 046be789fbb4..9a65fb528110 100644
> --- a/arch/arm64/include/asm/pgtable-prot.h
> +++ b/arch/arm64/include/asm/pgtable-prot.h
> @@ -66,7 +66,6 @@ extern bool arm64_use_ng_mappings;
> #define _PAGE_DEFAULT (_PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL))
>
> #define PAGE_KERNEL __pgprot(PROT_NORMAL)
> -#define PAGE_KERNEL_TAGGED __pgprot(PROT_NORMAL_TAGGED)
> #define PAGE_KERNEL_RO __pgprot((PROT_NORMAL & ~PTE_WRITE) | PTE_RDONLY)
> #define PAGE_KERNEL_ROX __pgprot((PROT_NORMAL & ~(PTE_WRITE | PTE_PXN)) | PTE_RDONLY)
> #define PAGE_KERNEL_EXEC __pgprot(PROT_NORMAL & ~PTE_PXN)
> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
> index e17b96d0e4b5..47027796c2f9 100644
> --- a/arch/arm64/include/asm/pgtable.h
> +++ b/arch/arm64/include/asm/pgtable.h
> @@ -486,6 +486,9 @@ static inline pmd_t pmd_mkdevmap(pmd_t pmd)
> __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC) | PTE_PXN | PTE_UXN)
> #define pgprot_device(prot) \
> __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_DEVICE_nGnRE) | PTE_PXN | PTE_UXN)
> +#define pgprot_tagged(prot) \
> + __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_TAGGED))
> +#define pgprot_mhp pgprot_tagged
> /*
> * DMA allocations for non-coherent devices use what the Arm architecture calls
> * "Normal non-cacheable" memory, which permits speculation, unaligned accesses
> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> index 3802cfbdd20d..9c8aa1b44cd5 100644
> --- a/arch/arm64/mm/mmu.c
> +++ b/arch/arm64/mm/mmu.c
> @@ -512,7 +512,8 @@ static void __init map_mem(pgd_t *pgdp)
> * if MTE is present. Otherwise, it has the same attributes as
> * PAGE_KERNEL.
> */
> - __map_memblock(pgdp, start, end, PAGE_KERNEL_TAGGED, flags);
> + __map_memblock(pgdp, start, end, pgprot_tagged(PAGE_KERNEL),
> + flags);
> }
>
> /*
> diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
> index cdfc4e9f253e..5e772392a379 100644
> --- a/include/linux/pgtable.h
> +++ b/include/linux/pgtable.h
> @@ -904,6 +904,10 @@ static inline void ptep_modify_prot_commit(struct vm_area_struct *vma,
> #define pgprot_device pgprot_noncached
> #endif
>
> +#ifndef pgprot_mhp
> +#define pgprot_mhp(prot) (prot)
> +#endif
> +
> #ifdef CONFIG_MMU
> #ifndef pgprot_modify
> #define pgprot_modify pgprot_modify
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 5ba51a8bdaeb..0cdbbfbc5757 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1072,7 +1072,7 @@ static int online_memory_block(struct memory_block *mem, void *arg)
> */
> int __ref add_memory_resource(int nid, struct resource *res, mhp_t mhp_flags)
> {
> - struct mhp_params params = { .pgprot = PAGE_KERNEL };
> + struct mhp_params params = { .pgprot = pgprot_mhp(PAGE_KERNEL) };
> u64 start, size;
> bool new_node = false;
> int ret;
>
--
Regards,
Vincenzo
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] arm64: mte: Map hotplugged memory as Normal Tagged
@ 2021-03-09 12:35 ` Vincenzo Frascino
0 siblings, 0 replies; 12+ messages in thread
From: Vincenzo Frascino @ 2021-03-09 12:35 UTC (permalink / raw)
To: Catalin Marinas, linux-arm-kernel
Cc: linux-mm, Anshuman Khandual, Patrick Daly, Will Deacon,
Andrew Morton, David Hildenbrand
On 3/9/21 12:26 PM, Catalin Marinas wrote:
> In a system supporting MTE, the linear map must allow reading/writing
> allocation tags by setting the memory type as Normal Tagged. Currently,
> this is only handled for memory present at boot. Hotplugged memory uses
> Normal non-Tagged memory.
>
> Introduce pgprot_mhp() for hotplugged memory and use it in
> add_memory_resource(). The arm64 code maps pgprot_mhp() to
> pgprot_tagged().
>
> Note that ZONE_DEVICE memory should not be mapped as Tagged and
> therefore setting the memory type in arch_add_memory() is not feasible.
>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> Fixes: 0178dc761368 ("arm64: mte: Use Normal Tagged attributes for the linear map")
> Reported-by: Patrick Daly <pdaly@codeaurora.org>
> Link: https://lore.kernel.org/r/1614745263-27827-1-git-send-email-pdaly@codeaurora.org
> Cc: <stable@vger.kernel.org> # 5.10.x
> Cc: Will Deacon <will@kernel.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
> Cc: David Hildenbrand <david@redhat.com>
Reviewed-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
> ---
>
> Patrick, could you please give this patch a try on your platform? Thanks.
>
> arch/arm64/include/asm/pgtable-prot.h | 1 -
> arch/arm64/include/asm/pgtable.h | 3 +++
> arch/arm64/mm/mmu.c | 3 ++-
> include/linux/pgtable.h | 4 ++++
> mm/memory_hotplug.c | 2 +-
> 5 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm64/include/asm/pgtable-prot.h b/arch/arm64/include/asm/pgtable-prot.h
> index 046be789fbb4..9a65fb528110 100644
> --- a/arch/arm64/include/asm/pgtable-prot.h
> +++ b/arch/arm64/include/asm/pgtable-prot.h
> @@ -66,7 +66,6 @@ extern bool arm64_use_ng_mappings;
> #define _PAGE_DEFAULT (_PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL))
>
> #define PAGE_KERNEL __pgprot(PROT_NORMAL)
> -#define PAGE_KERNEL_TAGGED __pgprot(PROT_NORMAL_TAGGED)
> #define PAGE_KERNEL_RO __pgprot((PROT_NORMAL & ~PTE_WRITE) | PTE_RDONLY)
> #define PAGE_KERNEL_ROX __pgprot((PROT_NORMAL & ~(PTE_WRITE | PTE_PXN)) | PTE_RDONLY)
> #define PAGE_KERNEL_EXEC __pgprot(PROT_NORMAL & ~PTE_PXN)
> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
> index e17b96d0e4b5..47027796c2f9 100644
> --- a/arch/arm64/include/asm/pgtable.h
> +++ b/arch/arm64/include/asm/pgtable.h
> @@ -486,6 +486,9 @@ static inline pmd_t pmd_mkdevmap(pmd_t pmd)
> __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC) | PTE_PXN | PTE_UXN)
> #define pgprot_device(prot) \
> __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_DEVICE_nGnRE) | PTE_PXN | PTE_UXN)
> +#define pgprot_tagged(prot) \
> + __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_TAGGED))
> +#define pgprot_mhp pgprot_tagged
> /*
> * DMA allocations for non-coherent devices use what the Arm architecture calls
> * "Normal non-cacheable" memory, which permits speculation, unaligned accesses
> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> index 3802cfbdd20d..9c8aa1b44cd5 100644
> --- a/arch/arm64/mm/mmu.c
> +++ b/arch/arm64/mm/mmu.c
> @@ -512,7 +512,8 @@ static void __init map_mem(pgd_t *pgdp)
> * if MTE is present. Otherwise, it has the same attributes as
> * PAGE_KERNEL.
> */
> - __map_memblock(pgdp, start, end, PAGE_KERNEL_TAGGED, flags);
> + __map_memblock(pgdp, start, end, pgprot_tagged(PAGE_KERNEL),
> + flags);
> }
>
> /*
> diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
> index cdfc4e9f253e..5e772392a379 100644
> --- a/include/linux/pgtable.h
> +++ b/include/linux/pgtable.h
> @@ -904,6 +904,10 @@ static inline void ptep_modify_prot_commit(struct vm_area_struct *vma,
> #define pgprot_device pgprot_noncached
> #endif
>
> +#ifndef pgprot_mhp
> +#define pgprot_mhp(prot) (prot)
> +#endif
> +
> #ifdef CONFIG_MMU
> #ifndef pgprot_modify
> #define pgprot_modify pgprot_modify
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 5ba51a8bdaeb..0cdbbfbc5757 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1072,7 +1072,7 @@ static int online_memory_block(struct memory_block *mem, void *arg)
> */
> int __ref add_memory_resource(int nid, struct resource *res, mhp_t mhp_flags)
> {
> - struct mhp_params params = { .pgprot = PAGE_KERNEL };
> + struct mhp_params params = { .pgprot = pgprot_mhp(PAGE_KERNEL) };
> u64 start, size;
> bool new_node = false;
> int ret;
>
--
Regards,
Vincenzo
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] arm64: mte: Map hotplugged memory as Normal Tagged
2021-03-09 12:26 ` Catalin Marinas
` (3 preceding siblings ...)
(?)
@ 2021-03-10 6:16 ` Patrick Daly
-1 siblings, 0 replies; 12+ messages in thread
From: Patrick Daly @ 2021-03-10 6:16 UTC (permalink / raw)
To: Catalin Marinas
Cc: linux-arm-kernel, linux-mm, Anshuman Khandual, Will Deacon,
Andrew Morton, Vincenzo Frascino, David Hildenbrand
On Tue, Mar 09, 2021 at 12:26:01PM +0000, Catalin Marinas wrote:
> In a system supporting MTE, the linear map must allow reading/writing
> allocation tags by setting the memory type as Normal Tagged. Currently,
> this is only handled for memory present at boot. Hotplugged memory uses
> Normal non-Tagged memory.
>
> Introduce pgprot_mhp() for hotplugged memory and use it in
> add_memory_resource(). The arm64 code maps pgprot_mhp() to
> pgprot_tagged().
>
> Note that ZONE_DEVICE memory should not be mapped as Tagged and
> therefore setting the memory type in arch_add_memory() is not feasible.
>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> Fixes: 0178dc761368 ("arm64: mte: Use Normal Tagged attributes for the linear map")
> Reported-by: Patrick Daly <pdaly@codeaurora.org>
> Link: https://lore.kernel.org/r/1614745263-27827-1-git-send-email-pdaly@codeaurora.org
> Cc: <stable@vger.kernel.org> # 5.10.x
> Cc: Will Deacon <will@kernel.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
> Cc: David Hildenbrand <david@redhat.com>
> ---
>
> Patrick, could you please give this patch a try on your platform? Thanks.
>
Worked for me.
> arch/arm64/include/asm/pgtable-prot.h | 1 -
> arch/arm64/include/asm/pgtable.h | 3 +++
> arch/arm64/mm/mmu.c | 3 ++-
> include/linux/pgtable.h | 4 ++++
> mm/memory_hotplug.c | 2 +-
> 5 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm64/include/asm/pgtable-prot.h b/arch/arm64/include/asm/pgtable-prot.h
> index 046be789fbb4..9a65fb528110 100644
> --- a/arch/arm64/include/asm/pgtable-prot.h
> +++ b/arch/arm64/include/asm/pgtable-prot.h
> @@ -66,7 +66,6 @@ extern bool arm64_use_ng_mappings;
> #define _PAGE_DEFAULT (_PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL))
>
> #define PAGE_KERNEL __pgprot(PROT_NORMAL)
> -#define PAGE_KERNEL_TAGGED __pgprot(PROT_NORMAL_TAGGED)
> #define PAGE_KERNEL_RO __pgprot((PROT_NORMAL & ~PTE_WRITE) | PTE_RDONLY)
> #define PAGE_KERNEL_ROX __pgprot((PROT_NORMAL & ~(PTE_WRITE | PTE_PXN)) | PTE_RDONLY)
> #define PAGE_KERNEL_EXEC __pgprot(PROT_NORMAL & ~PTE_PXN)
> diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h
> index e17b96d0e4b5..47027796c2f9 100644
> --- a/arch/arm64/include/asm/pgtable.h
> +++ b/arch/arm64/include/asm/pgtable.h
> @@ -486,6 +486,9 @@ static inline pmd_t pmd_mkdevmap(pmd_t pmd)
> __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_NC) | PTE_PXN | PTE_UXN)
> #define pgprot_device(prot) \
> __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_DEVICE_nGnRE) | PTE_PXN | PTE_UXN)
> +#define pgprot_tagged(prot) \
> + __pgprot_modify(prot, PTE_ATTRINDX_MASK, PTE_ATTRINDX(MT_NORMAL_TAGGED))
> +#define pgprot_mhp pgprot_tagged
> /*
> * DMA allocations for non-coherent devices use what the Arm architecture calls
> * "Normal non-cacheable" memory, which permits speculation, unaligned accesses
> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> index 3802cfbdd20d..9c8aa1b44cd5 100644
> --- a/arch/arm64/mm/mmu.c
> +++ b/arch/arm64/mm/mmu.c
> @@ -512,7 +512,8 @@ static void __init map_mem(pgd_t *pgdp)
> * if MTE is present. Otherwise, it has the same attributes as
> * PAGE_KERNEL.
> */
> - __map_memblock(pgdp, start, end, PAGE_KERNEL_TAGGED, flags);
> + __map_memblock(pgdp, start, end, pgprot_tagged(PAGE_KERNEL),
> + flags);
> }
>
> /*
> diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
> index cdfc4e9f253e..5e772392a379 100644
> --- a/include/linux/pgtable.h
> +++ b/include/linux/pgtable.h
> @@ -904,6 +904,10 @@ static inline void ptep_modify_prot_commit(struct vm_area_struct *vma,
> #define pgprot_device pgprot_noncached
> #endif
>
> +#ifndef pgprot_mhp
> +#define pgprot_mhp(prot) (prot)
> +#endif
> +
> #ifdef CONFIG_MMU
> #ifndef pgprot_modify
> #define pgprot_modify pgprot_modify
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 5ba51a8bdaeb..0cdbbfbc5757 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1072,7 +1072,7 @@ static int online_memory_block(struct memory_block *mem, void *arg)
> */
> int __ref add_memory_resource(int nid, struct resource *res, mhp_t mhp_flags)
> {
> - struct mhp_params params = { .pgprot = PAGE_KERNEL };
> + struct mhp_params params = { .pgprot = pgprot_mhp(PAGE_KERNEL) };
> u64 start, size;
> bool new_node = false;
> int ret;
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] arm64: mte: Map hotplugged memory as Normal Tagged
2021-03-09 12:26 ` Catalin Marinas
@ 2021-03-10 7:05 ` Anshuman Khandual
-1 siblings, 0 replies; 12+ messages in thread
From: Anshuman Khandual @ 2021-03-10 7:05 UTC (permalink / raw)
To: Catalin Marinas, linux-arm-kernel
Cc: linux-mm, Patrick Daly, Will Deacon, Andrew Morton,
Vincenzo Frascino, David Hildenbrand
On 3/9/21 5:56 PM, Catalin Marinas wrote:
> In a system supporting MTE, the linear map must allow reading/writing
> allocation tags by setting the memory type as Normal Tagged. Currently,
> this is only handled for memory present at boot. Hotplugged memory uses
> Normal non-Tagged memory.
>
> Introduce pgprot_mhp() for hotplugged memory and use it in
> add_memory_resource(). The arm64 code maps pgprot_mhp() to
> pgprot_tagged().
>
> Note that ZONE_DEVICE memory should not be mapped as Tagged and
> therefore setting the memory type in arch_add_memory() is not feasible.
>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> Fixes: 0178dc761368 ("arm64: mte: Use Normal Tagged attributes for the linear map")
> Reported-by: Patrick Daly <pdaly@codeaurora.org>
> Link: https://lore.kernel.org/r/1614745263-27827-1-git-send-email-pdaly@codeaurora.org
> Cc: <stable@vger.kernel.org> # 5.10.x
> Cc: Will Deacon <will@kernel.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
> Cc: David Hildenbrand <david@redhat.com>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] arm64: mte: Map hotplugged memory as Normal Tagged
@ 2021-03-10 7:05 ` Anshuman Khandual
0 siblings, 0 replies; 12+ messages in thread
From: Anshuman Khandual @ 2021-03-10 7:05 UTC (permalink / raw)
To: Catalin Marinas, linux-arm-kernel
Cc: linux-mm, Patrick Daly, Will Deacon, Andrew Morton,
Vincenzo Frascino, David Hildenbrand
On 3/9/21 5:56 PM, Catalin Marinas wrote:
> In a system supporting MTE, the linear map must allow reading/writing
> allocation tags by setting the memory type as Normal Tagged. Currently,
> this is only handled for memory present at boot. Hotplugged memory uses
> Normal non-Tagged memory.
>
> Introduce pgprot_mhp() for hotplugged memory and use it in
> add_memory_resource(). The arm64 code maps pgprot_mhp() to
> pgprot_tagged().
>
> Note that ZONE_DEVICE memory should not be mapped as Tagged and
> therefore setting the memory type in arch_add_memory() is not feasible.
>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> Fixes: 0178dc761368 ("arm64: mte: Use Normal Tagged attributes for the linear map")
> Reported-by: Patrick Daly <pdaly@codeaurora.org>
> Link: https://lore.kernel.org/r/1614745263-27827-1-git-send-email-pdaly@codeaurora.org
> Cc: <stable@vger.kernel.org> # 5.10.x
> Cc: Will Deacon <will@kernel.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
> Cc: David Hildenbrand <david@redhat.com>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] arm64: mte: Map hotplugged memory as Normal Tagged
2021-03-09 12:26 ` Catalin Marinas
@ 2021-03-10 11:39 ` Will Deacon
-1 siblings, 0 replies; 12+ messages in thread
From: Will Deacon @ 2021-03-10 11:39 UTC (permalink / raw)
To: linux-arm-kernel, Catalin Marinas
Cc: kernel-team, Will Deacon, David Hildenbrand, Vincenzo Frascino,
Andrew Morton, linux-mm, Anshuman Khandual, Patrick Daly
On Tue, 9 Mar 2021 12:26:01 +0000, Catalin Marinas wrote:
> In a system supporting MTE, the linear map must allow reading/writing
> allocation tags by setting the memory type as Normal Tagged. Currently,
> this is only handled for memory present at boot. Hotplugged memory uses
> Normal non-Tagged memory.
>
> Introduce pgprot_mhp() for hotplugged memory and use it in
> add_memory_resource(). The arm64 code maps pgprot_mhp() to
> pgprot_tagged().
>
> [...]
Applied to arm64 (for-next/fixes), thanks!
[1/1] arm64: mte: Map hotplugged memory as Normal Tagged
https://git.kernel.org/arm64/c/d15dfd31384b
Cheers,
--
Will
https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] arm64: mte: Map hotplugged memory as Normal Tagged
@ 2021-03-10 11:39 ` Will Deacon
0 siblings, 0 replies; 12+ messages in thread
From: Will Deacon @ 2021-03-10 11:39 UTC (permalink / raw)
To: linux-arm-kernel, Catalin Marinas
Cc: kernel-team, Will Deacon, David Hildenbrand, Vincenzo Frascino,
Andrew Morton, linux-mm, Anshuman Khandual, Patrick Daly
On Tue, 9 Mar 2021 12:26:01 +0000, Catalin Marinas wrote:
> In a system supporting MTE, the linear map must allow reading/writing
> allocation tags by setting the memory type as Normal Tagged. Currently,
> this is only handled for memory present at boot. Hotplugged memory uses
> Normal non-Tagged memory.
>
> Introduce pgprot_mhp() for hotplugged memory and use it in
> add_memory_resource(). The arm64 code maps pgprot_mhp() to
> pgprot_tagged().
>
> [...]
Applied to arm64 (for-next/fixes), thanks!
[1/1] arm64: mte: Map hotplugged memory as Normal Tagged
https://git.kernel.org/arm64/c/d15dfd31384b
Cheers,
--
Will
https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] arm64: mte: Map hotplugged memory as Normal Tagged
@ 2021-03-09 12:26 ` Catalin Marinas
0 siblings, 0 replies; 12+ messages in thread
From: Patrick Daly @ 2021-03-10 19:24 UTC (permalink / raw)
To: catalin.marinas, linux-arm-kernel
Cc: akpm, anshuman.khandual, david, linux-mm, pdaly, vincenzo.frascino, will
From: Catalin Marinas <catalin.marinas@arm.com>
> In a system supporting MTE, the linear map must allow reading/writing
> allocation tags by setting the memory type as Normal Tagged. Currently,
> this is only handled for memory present at boot. Hotplugged memory uses
> Normal non-Tagged memory.
>
> Introduce pgprot_mhp() for hotplugged memory and use it in
> add_memory_resource(). The arm64 code maps pgprot_mhp() to
> pgprot_tagged().
>
> Note that ZONE_DEVICE memory should not be mapped as Tagged and
> therefore setting the memory type in arch_add_memory() is not feasible.
>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> Fixes: 0178dc761368 ("arm64: mte: Use Normal Tagged attributes for the linear map")
> Reported-by: Patrick Daly <pdaly@codeaurora.org>
> Link: https://lore.kernel.org/r/1614745263-27827-1-git-send-email-pdaly@codeaurora.org
> Cc: <stable@vger.kernel.org> # 5.10.x
> Cc: Will Deacon <will@kernel.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
> Cc: David Hildenbrand <david@redhat.com>
> ---
>
> Patrick, could you please give this patch a try on your platform? Thanks.
It works for me. Sry for the double reply.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2021-03-10 19:25 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09 12:26 [PATCH] arm64: mte: Map hotplugged memory as Normal Tagged Catalin Marinas
2021-03-10 19:24 ` Patrick Daly
2021-03-09 12:26 ` Catalin Marinas
2021-03-09 12:28 ` David Hildenbrand
2021-03-09 12:28 ` David Hildenbrand
2021-03-09 12:35 ` Vincenzo Frascino
2021-03-09 12:35 ` Vincenzo Frascino
2021-03-10 6:16 ` Patrick Daly
2021-03-10 7:05 ` Anshuman Khandual
2021-03-10 7:05 ` Anshuman Khandual
2021-03-10 11:39 ` Will Deacon
2021-03-10 11:39 ` 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.