mm: Introduce ARCH_HAS_VARIABLE_STACK_SIZE

In prepration of making THREAD_SHIFT and friends variable size (set
from command line) on arm64. Introduce ARCH_HAS_VARIABLE_STACK_SIZE
that will be set from arm64 and it will be to make parts in the code
that use THREAD_SHIFT as a compile time constant still works
correctly if it was a variable.

Some still rely on THREAD_SIZE as a compile time const:
- CONFIG_DEBUG_STACK_USAGE: To have the value for stack at the init
  of stack tracking, this is fixed by introducing another compile
  time constant MAX_THREAD_SIZE that must be defined for archs
  with ARCH_HAS_VARIABLE_STACK_SIZE.

- CONFIG_LKDTM: In EXHAUST_STACK test, that also can be replaced with
  the MAX_THREAD_SIZE as will still generate the overflow.

At this point all usage of THREAD_SHIFT, THREAD_ALIGN, THREAD_SIZE
does not assume it’s a compile time constant with
ARCH_HAS_VARIABLE_STACK_SIZE, except for two places in arm64 entry
code:
- stack overflow detection.
- Boot of secondary CPUs in SMP

They are fixed next.

Signed-off-by: Mostafa Saleh <smostafa@google.com>
8 files changed