Re: [PATCH 7/8] tools/objtool: Check for use of the ENQCMD instruction in the kernel

2021-09-23 Thread Fenghua Yu
Hi, Josh, On Thu, Sep 23, 2021 at 05:55:40PM -0700, Josh Poimboeuf wrote: > On Thu, Sep 23, 2021 at 03:26:14PM +, Fenghua Yu wrote: > > > > + } else if (op2 == 0x38 && op3 == 0xf8) { > > > > + if (insn.prefixes.nbytes == 1 && > > > > +

Re: [PATCH 7/8] tools/objtool: Check for use of the ENQCMD instruction in the kernel

2021-09-23 Thread Josh Poimboeuf
On Thu, Sep 23, 2021 at 03:26:14PM +, Fenghua Yu wrote: > > > + } else if (op2 == 0x38 && op3 == 0xf8) { > > > + if (insn.prefixes.nbytes == 1 && > > > + insn.prefixes.bytes[0] == 0xf2) { > > > + /* ENQCMD cannot be used in the

Re: [PATCH 7/8] tools/objtool: Check for use of the ENQCMD instruction in the kernel

2021-09-23 Thread Fenghua Yu
Hi, Peter, On Thu, Sep 23, 2021 at 09:17:01AM +0200, Peter Zijlstra wrote: > On Wed, Sep 22, 2021 at 11:44:41PM +, Fenghua Yu wrote: > > > > Since you're making it a fatal error, before doing much of anything > > > else, you might at well fail decode and keep it all in the x86/decode.c > > >

Re: [PATCH 7/8] tools/objtool: Check for use of the ENQCMD instruction in the kernel

2021-09-23 Thread Peter Zijlstra
On Wed, Sep 22, 2021 at 11:44:41PM +, Fenghua Yu wrote: > > Since you're making it a fatal error, before doing much of anything > > else, you might at well fail decode and keep it all in the x86/decode.c > > file, no need to spread this 'knowledge' any further. > Is the following updated patc

Re: [PATCH 7/8] tools/objtool: Check for use of the ENQCMD instruction in the kernel

2021-09-22 Thread Fenghua Yu
Hi, Peter, On Wed, Sep 22, 2021 at 11:03:43PM +0200, Peter Zijlstra wrote: > On Mon, Sep 20, 2021 at 07:23:48PM +, Fenghua Yu wrote: > > + ret = validate_enqcmd(file); > > + if (ret < 0) > > + goto out; > > + warnings += ret; > > + > > if (vmlinux && !validate_dup) { > >

Re: [PATCH 7/8] tools/objtool: Check for use of the ENQCMD instruction in the kernel

2021-09-22 Thread Peter Zijlstra
On Mon, Sep 20, 2021 at 07:23:48PM +, Fenghua Yu wrote: > diff --git a/tools/objtool/check.c b/tools/objtool/check.c > index e5947fbb9e7a..91d13521d9d6 100644 > --- a/tools/objtool/check.c > +++ b/tools/objtool/check.c > @@ -3133,6 +3133,21 @@ static int validate_reachable_instructions(struct

[PATCH 7/8] tools/objtool: Check for use of the ENQCMD instruction in the kernel

2021-09-20 Thread Fenghua Yu
The ENQCMD implicitly accesses the PASID_MSR to fill in the pasid field of the descriptor being submitted to an accelerator. But there is no precise (and stable across kernel changes) point at which the PASID_MSR is updated from the value for one task to the next. Kernel code that uses accelerator