Re: [PATCH v6 47/76] x86/dumpstack/64: Add noinstr version of get_stack_info()

Borislav Petkov
2020-08-31T11:27:01Z

On Mon, Aug 24, 2020 at 10:54:42AM +0200, Joerg Roedel wrote:
> diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
> index c49cf594714b..5a85730eb0ca 100644
> --- a/arch/x86/kernel/dumpstack_64.c
> +++ b/arch/x86/kernel/dumpstack_64.c
> @@ -85,7 +85,7 @@ struct estack_pages estack_pages[CEA_ESTACK_PAGES] ____cacheline_aligned = {
> EPAGERANGE(VC2),
> };
>
> -static bool in_exception_stack(unsigned long *stack, struct stack_info *info)
> +static bool __always_inline in_exception_stack(unsigned long *stack, struct stack_info *info)

Yeah, checkpatch seems to complain correctly here:

ERROR: inline keyword should sit between storage class and type
#88: FILE: arch/x86/kernel/dumpstack_64.c:88:
+static bool __always_inline in_exception_stack(unsigned long *stack, struct stack_info *info)

ERROR: inline keyword should sit between storage class and type
#97: FILE: arch/x86/kernel/dumpstack_64.c:129:
+static bool __always_inline in_irq_stack(unsigned long *stack, struct stack_info *info)

> +int get_stack_info(unsigned long *stack, struct task_struct *task,
> + struct stack_info *info, unsigned long *visit_mask)
> +{
> + task = task ? : current;
> +
> + if (!stack)
> + goto unknown;
> +
> + if (!get_stack_info_noinstr(stack, task, info))
> + goto unknown;
>
> -recursion_check:
> /*
> * Make sure we don't iterate through any given stack more than once.
> * If it comes up a second time then there's something wrong going on:
> @@ -196,4 +202,5 @@ int get_stack_info(unsigned long *stack, struct task_struct *task,
> unknown:
> info->type = STACK_TYPE_UNKNOWN;
> return -EINVAL;
> +
^ Superfluous newline.

--
Regards/Gruss,
Boris.