arm64: entry: refine comment of stack overflow check
authorHeyi Guo <guoheyi@huawei.com>
Mon, 2 Dec 2019 11:37:02 +0000 (19:37 +0800)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 6 Dec 2019 14:11:31 +0000 (14:11 +0000)
Stack overflow checking can be done by testing sp & (1 << THREAD_SHIFT)
only for the stacks are aligned to (2 << THREAD_SHIFT) with size of
(1 << THREAD_SIZE), and this is the case when CONFIG_VMAP_STACK is set.

Fix the code comment to avoid confusion.

Cc: Will Deacon <will@kernel.org>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Heyi Guo <guoheyi@huawei.com>
[catalin.marinas@arm.com: Updated comment following Mark's suggestion]
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/kernel/entry.S

index 583f71abbe98d7b130a38ffd4915a95110169fcc..7c6a0a41676f83ce0f40cfc1e3197a03e6ca3570 100644 (file)
@@ -76,7 +76,8 @@ alternative_else_nop_endif
 #ifdef CONFIG_VMAP_STACK
        /*
         * Test whether the SP has overflowed, without corrupting a GPR.
-        * Task and IRQ stacks are aligned to (1 << THREAD_SHIFT).
+        * Task and IRQ stacks are aligned so that SP & (1 << THREAD_SHIFT)
+        * should always be zero.
         */
        add     sp, sp, x0                      // sp' = sp + x0
        sub     x0, sp, x0                      // x0' = sp' - x0 = (sp + x0) - x0 = sp