* [PATCH 0/5] ARM64 MM Random Cleanups
@ 2018-09-22 15:39 Anshuman Khandual
2018-09-22 15:39 ` [PATCH 1/5] arm64/mm: Use ESR_ELx_FSC macro while decoding fault exception Anshuman Khandual
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Anshuman Khandual @ 2018-09-22 15:39 UTC (permalink / raw)
To: linux-arm-kernel
This just contains some unrelated cleanup patches on memory.
Anshuman Khandual (5):
arm64/mm: Use ESR_ELx_FSC macro while decoding fault exception
arm64/mm: Reorganize arguments for is_el1_permission_fault()
arm64/mm: Define esr_to_debug_fault_info()
arm64/numa: Report correct memblock range for the dummy node
arm64/numa: Unify common error path in numa_init()
arch/arm64/mm/fault.c | 19 ++++++++++++-------
arch/arm64/mm/numa.c | 13 ++++++++-----
2 files changed, 20 insertions(+), 12 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/5] arm64/mm: Use ESR_ELx_FSC macro while decoding fault exception
2018-09-22 15:39 [PATCH 0/5] ARM64 MM Random Cleanups Anshuman Khandual
@ 2018-09-22 15:39 ` Anshuman Khandual
2018-09-22 15:39 ` [PATCH 2/5] arm64/mm: Reorganize arguments for is_el1_permission_fault() Anshuman Khandual
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Anshuman Khandual @ 2018-09-22 15:39 UTC (permalink / raw)
To: linux-arm-kernel
Just replace hard code value of 63 (0x111111) with an existing macro
ESR_ELx_FSC when parsing for the status code during fault exception.
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
arch/arm64/mm/fault.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index 50b30ff..75b8794 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -59,7 +59,7 @@ static const struct fault_info fault_info[];
static inline const struct fault_info *esr_to_fault_info(unsigned int esr)
{
- return fault_info + (esr & 63);
+ return fault_info + (esr & ESR_ELx_FSC);
}
#ifdef CONFIG_KPROBES
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/5] arm64/mm: Reorganize arguments for is_el1_permission_fault()
2018-09-22 15:39 [PATCH 0/5] ARM64 MM Random Cleanups Anshuman Khandual
2018-09-22 15:39 ` [PATCH 1/5] arm64/mm: Use ESR_ELx_FSC macro while decoding fault exception Anshuman Khandual
@ 2018-09-22 15:39 ` Anshuman Khandual
2018-09-22 15:39 ` [PATCH 3/5] arm64/mm: Define esr_to_debug_fault_info() Anshuman Khandual
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Anshuman Khandual @ 2018-09-22 15:39 UTC (permalink / raw)
To: linux-arm-kernel
Most memory abort exception handling related functions have the arguments
in the order (addr, esr, regs) except is_el1_permission_fault(). This
changes the argument order in this function as (addr, esr, regs) like
others.
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
arch/arm64/mm/fault.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index 75b8794..30e040c 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -235,9 +235,8 @@ static bool is_el1_instruction_abort(unsigned int esr)
return ESR_ELx_EC(esr) == ESR_ELx_EC_IABT_CUR;
}
-static inline bool is_el1_permission_fault(unsigned int esr,
- struct pt_regs *regs,
- unsigned long addr)
+static inline bool is_el1_permission_fault(unsigned long addr, unsigned int esr,
+ struct pt_regs *regs)
{
unsigned int ec = ESR_ELx_EC(esr);
unsigned int fsc_type = esr & ESR_ELx_FSC_TYPE;
@@ -283,7 +282,7 @@ static void __do_kernel_fault(unsigned long addr, unsigned int esr,
if (!is_el1_instruction_abort(esr) && fixup_exception(regs))
return;
- if (is_el1_permission_fault(esr, regs, addr)) {
+ if (is_el1_permission_fault(addr, esr, regs)) {
if (esr & ESR_ELx_WNR)
msg = "write to read-only memory";
else
@@ -454,7 +453,7 @@ static int __kprobes do_page_fault(unsigned long addr, unsigned int esr,
mm_flags |= FAULT_FLAG_WRITE;
}
- if (addr < TASK_SIZE && is_el1_permission_fault(esr, regs, addr)) {
+ if (addr < TASK_SIZE && is_el1_permission_fault(addr, esr, regs)) {
/* regs->orig_addr_limit may be 0 if we entered from EL0 */
if (regs->orig_addr_limit == KERNEL_DS)
die_kernel_fault("access to user memory with fs=KERNEL_DS",
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/5] arm64/mm: Define esr_to_debug_fault_info()
2018-09-22 15:39 [PATCH 0/5] ARM64 MM Random Cleanups Anshuman Khandual
2018-09-22 15:39 ` [PATCH 1/5] arm64/mm: Use ESR_ELx_FSC macro while decoding fault exception Anshuman Khandual
2018-09-22 15:39 ` [PATCH 2/5] arm64/mm: Reorganize arguments for is_el1_permission_fault() Anshuman Khandual
@ 2018-09-22 15:39 ` Anshuman Khandual
2018-09-22 15:39 ` [PATCH 4/5] arm64/numa: Report correct memblock range for the dummy node Anshuman Khandual
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Anshuman Khandual @ 2018-09-22 15:39 UTC (permalink / raw)
To: linux-arm-kernel
fault_info[] and debug_fault_info[] are static arrays defining memory abort
exception handling functions looking into ESR fault status code encodings.
As esr_to_fault_info() is already available providing fault_info[] array
lookup, it really makes sense to have a corresponding debug_fault_info[]
array lookup function as well. This just adds an equivalent helper function
esr_to_debug_fault_info().
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
arch/arm64/mm/fault.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/mm/fault.c b/arch/arm64/mm/fault.c
index 30e040c..9c64f93 100644
--- a/arch/arm64/mm/fault.c
+++ b/arch/arm64/mm/fault.c
@@ -56,12 +56,18 @@ struct fault_info {
};
static const struct fault_info fault_info[];
+static struct fault_info debug_fault_info[];
static inline const struct fault_info *esr_to_fault_info(unsigned int esr)
{
return fault_info + (esr & ESR_ELx_FSC);
}
+static inline const struct fault_info *esr_to_debug_fault_info(unsigned int esr)
+{
+ return debug_fault_info + DBG_ESR_EVT(esr);
+}
+
#ifdef CONFIG_KPROBES
static inline int notify_page_fault(struct pt_regs *regs, unsigned int esr)
{
@@ -830,7 +836,7 @@ asmlinkage int __exception do_debug_exception(unsigned long addr,
unsigned int esr,
struct pt_regs *regs)
{
- const struct fault_info *inf = debug_fault_info + DBG_ESR_EVT(esr);
+ const struct fault_info *inf = esr_to_debug_fault_info(esr);
int rv;
/*
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/5] arm64/numa: Report correct memblock range for the dummy node
2018-09-22 15:39 [PATCH 0/5] ARM64 MM Random Cleanups Anshuman Khandual
` (2 preceding siblings ...)
2018-09-22 15:39 ` [PATCH 3/5] arm64/mm: Define esr_to_debug_fault_info() Anshuman Khandual
@ 2018-09-22 15:39 ` Anshuman Khandual
2018-09-22 15:39 ` [PATCH 5/5] arm64/numa: Unify common error path in numa_init() Anshuman Khandual
2018-10-01 12:54 ` [PATCH 0/5] ARM64 MM Random Cleanups Catalin Marinas
5 siblings, 0 replies; 7+ messages in thread
From: Anshuman Khandual @ 2018-09-22 15:39 UTC (permalink / raw)
To: linux-arm-kernel
The dummy node ID is marked into all memory ranges on the system. So the
dummy node really extends the entire memblock.memory. Hence report correct
extent information for the dummy node using memblock range helper functions
instead of the range [0LLU, PFN_PHYS(max_pfn) - 1)].
Fixes: 1a2db30034 ("arm64, numa: Add NUMA support for arm64 platforms")
Acked-by: Punit Agrawal <punit.agrawal@arm.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
arch/arm64/mm/numa.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c
index 146c04c..54529b4 100644
--- a/arch/arm64/mm/numa.c
+++ b/arch/arm64/mm/numa.c
@@ -432,7 +432,7 @@ static int __init dummy_numa_init(void)
if (numa_off)
pr_info("NUMA disabled\n"); /* Forced off on command line. */
pr_info("Faking a node at [mem %#018Lx-%#018Lx]\n",
- 0LLU, PFN_PHYS(max_pfn) - 1);
+ memblock_start_of_DRAM(), memblock_end_of_DRAM() - 1);
for_each_memblock(memory, mblk) {
ret = numa_add_memblk(0, mblk->base, mblk->base + mblk->size);
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 5/5] arm64/numa: Unify common error path in numa_init()
2018-09-22 15:39 [PATCH 0/5] ARM64 MM Random Cleanups Anshuman Khandual
` (3 preceding siblings ...)
2018-09-22 15:39 ` [PATCH 4/5] arm64/numa: Report correct memblock range for the dummy node Anshuman Khandual
@ 2018-09-22 15:39 ` Anshuman Khandual
2018-10-01 12:54 ` [PATCH 0/5] ARM64 MM Random Cleanups Catalin Marinas
5 siblings, 0 replies; 7+ messages in thread
From: Anshuman Khandual @ 2018-09-22 15:39 UTC (permalink / raw)
To: linux-arm-kernel
At present numa_free_distance() is being called before numa_distance is
even initialized with numa_alloc_distance() which is really pointless.
Instead lets call numa_free_distance() on the common error path inside
numa_init() after numa_alloc_distance() has been successful.
Fixes: 1a2db30034 ("arm64, numa: Add NUMA support for arm64 platforms")
Acked-by: Punit Agrawal <punit.agrawal@arm.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
arch/arm64/mm/numa.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c
index 54529b4..d7b66fc 100644
--- a/arch/arm64/mm/numa.c
+++ b/arch/arm64/mm/numa.c
@@ -391,7 +391,6 @@ static int __init numa_init(int (*init_func)(void))
nodes_clear(numa_nodes_parsed);
nodes_clear(node_possible_map);
nodes_clear(node_online_map);
- numa_free_distance();
ret = numa_alloc_distance();
if (ret < 0)
@@ -399,20 +398,24 @@ static int __init numa_init(int (*init_func)(void))
ret = init_func();
if (ret < 0)
- return ret;
+ goto out_free_distance;
if (nodes_empty(numa_nodes_parsed)) {
pr_info("No NUMA configuration found\n");
- return -EINVAL;
+ ret = -EINVAL;
+ goto out_free_distance;
}
ret = numa_register_nodes();
if (ret < 0)
- return ret;
+ goto out_free_distance;
setup_node_to_cpumask_map();
return 0;
+out_free_distance:
+ numa_free_distance();
+ return ret;
}
/**
--
2.7.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 0/5] ARM64 MM Random Cleanups
2018-09-22 15:39 [PATCH 0/5] ARM64 MM Random Cleanups Anshuman Khandual
` (4 preceding siblings ...)
2018-09-22 15:39 ` [PATCH 5/5] arm64/numa: Unify common error path in numa_init() Anshuman Khandual
@ 2018-10-01 12:54 ` Catalin Marinas
5 siblings, 0 replies; 7+ messages in thread
From: Catalin Marinas @ 2018-10-01 12:54 UTC (permalink / raw)
To: linux-arm-kernel
On Sat, Sep 22, 2018 at 09:09:51PM +0530, Anshuman Khandual wrote:
> This just contains some unrelated cleanup patches on memory.
>
> Anshuman Khandual (5):
> arm64/mm: Use ESR_ELx_FSC macro while decoding fault exception
> arm64/mm: Reorganize arguments for is_el1_permission_fault()
> arm64/mm: Define esr_to_debug_fault_info()
> arm64/numa: Report correct memblock range for the dummy node
> arm64/numa: Unify common error path in numa_init()
Queued for 4.20. Thanks.
--
Catalin
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2018-10-01 12:54 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-22 15:39 [PATCH 0/5] ARM64 MM Random Cleanups Anshuman Khandual
2018-09-22 15:39 ` [PATCH 1/5] arm64/mm: Use ESR_ELx_FSC macro while decoding fault exception Anshuman Khandual
2018-09-22 15:39 ` [PATCH 2/5] arm64/mm: Reorganize arguments for is_el1_permission_fault() Anshuman Khandual
2018-09-22 15:39 ` [PATCH 3/5] arm64/mm: Define esr_to_debug_fault_info() Anshuman Khandual
2018-09-22 15:39 ` [PATCH 4/5] arm64/numa: Report correct memblock range for the dummy node Anshuman Khandual
2018-09-22 15:39 ` [PATCH 5/5] arm64/numa: Unify common error path in numa_init() Anshuman Khandual
2018-10-01 12:54 ` [PATCH 0/5] ARM64 MM Random Cleanups Catalin Marinas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).