Re: [PATCH v2 02/24] objtool: Introduce CFI hash

Peter Zijlstra
2021-08-25T10:18:02Z

On Fri, Aug 20, 2021 at 03:27:55PM -0700, Josh Poimboeuf wrote:

> > @@ -2725,15 +2820,24 @@ static int validate_branch(struct objtoo
> >
> > if (insn->visited & visited)
> > return 0;
> > - }
> > + } else
> > + nr_visited++;
> >
> > if (state.noinstr)
> > state.instr += insn->instr;
> >
> > - if (insn->hint)
> > - state.cfi = insn->cfi;
> > - else
> > - insn->cfi = state.cfi;
> > + if (insn->hint) {
> > + state.cfi = *insn->cfip;
> > + } else {
> > + /* XXX track if we actually changed state.cfi */
>
> Why would we do that?

Saves on the memcmp()..

> > +++ b/tools/objtool/include/objtool/check.h
> > @@ -60,9 +60,11 @@ struct instruction {
> > struct list_head alts;
> > struct symbol *func;
> > struct list_head stack_ops;
> > - struct cfi_state cfi;
> > + struct cfi_state *cfip;
>
> Not sure about this rename. Pointers generally don't need a 'p' postfix.

It was a dev thing, meant I typically rename a member when I change
type; easy for compiler and grep.

I can s/cfip/cfi/ on the patch, no biggie.