2020-04-28 19:23:02

by Peter Zijlstra

[permalink] [raw]
Subject: [PATCH v2 07/14] objtool: Make handle_insn_ops() unconditional

Now that every instruction has a list of stack_ops; we can trivially
distinquish those instructions that do not have stack_ops, their list
is empty.

This means we can now call handle_insn_ops() unconditionally.

Suggested-by: Julien Thierry <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
---
tools/objtool/check.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -2247,6 +2247,9 @@ static int validate_branch(struct objtoo
return 0;
}

+ if (handle_insn_ops(insn, &state))
+ return 1;
+
switch (insn->type) {

case INSN_RETURN:
@@ -2306,9 +2309,6 @@ static int validate_branch(struct objtoo
break;

case INSN_EXCEPTION_RETURN:
- if (handle_insn_ops(insn, &state))
- return 1;
-
/*
* This handles x86's sync_core() case, where we use an
* IRET to self. All 'normal' IRET instructions are in
@@ -2328,8 +2328,6 @@ static int validate_branch(struct objtoo
return 0;

case INSN_STACK:
- if (handle_insn_ops(insn, &state))
- return 1;
break;

case INSN_STAC:



2020-05-01 18:27:10

by tip-bot2 for Haifeng Xu

[permalink] [raw]
Subject: [tip: objtool/core] objtool: Make handle_insn_ops() unconditional

The following commit has been merged into the objtool/core branch of tip:

Commit-ID: 60041bcd8f5ab560dabf44dc384f58bbeb5a6a30
Gitweb: https://git.kernel.org/tip/60041bcd8f5ab560dabf44dc384f58bbeb5a6a30
Author: Peter Zijlstra <[email protected]>
AuthorDate: Fri, 24 Apr 2020 16:16:41 +02:00
Committer: Peter Zijlstra <[email protected]>
CommitterDate: Thu, 30 Apr 2020 20:14:32 +02:00

objtool: Make handle_insn_ops() unconditional

Now that every instruction has a list of stack_ops; we can trivially
distinquish those instructions that do not have stack_ops, their list
is empty.

This means we can now call handle_insn_ops() unconditionally.

Suggested-by: Julien Thierry <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Reviewed-by: Miroslav Benes <[email protected]>
Acked-by: Josh Poimboeuf <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
---
tools/objtool/check.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 068897d..6591c2d 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -2259,6 +2259,9 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
return 0;
}

+ if (handle_insn_ops(insn, &state))
+ return 1;
+
switch (insn->type) {

case INSN_RETURN:
@@ -2318,9 +2321,6 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
break;

case INSN_EXCEPTION_RETURN:
- if (handle_insn_ops(insn, &state))
- return 1;
-
/*
* This handles x86's sync_core() case, where we use an
* IRET to self. All 'normal' IRET instructions are in
@@ -2340,8 +2340,6 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
return 0;

case INSN_STACK:
- if (handle_insn_ops(insn, &state))
- return 1;
break;

case INSN_STAC:

2020-05-07 12:41:31

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [tip: objtool/core] objtool: Make handle_insn_ops() unconditional

On Fri, May 01, 2020 at 06:22:21PM -0000, tip-bot2 for Peter Zijlstra wrote:
> diff --git a/tools/objtool/check.c b/tools/objtool/check.c
> index 068897d..6591c2d 100644
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -2259,6 +2259,9 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
> return 0;
> }
>
> + if (handle_insn_ops(insn, &state))
> + return 1;
> +
> switch (insn->type) {
>
> case INSN_RETURN:

Fun question; when an instruction has both a hint and ops, who should
win? I'm currently in that situation and I'd like the hint to win, but
is that 'right' ?