Messages in this thread | | | From | Thomas Gleixner <> | Subject | Re: [PATCH] Documentation: Fill the gaps about entry/noinstr constraints | Date | Wed, 01 Dec 2021 19:14:41 +0100 |
| |
Mark,
On Wed, Dec 01 2021 at 10:56, Mark Rutland wrote: > On Tue, Nov 30, 2021 at 11:31:30PM +0100, Thomas Gleixner wrote: >> --- >> Documentation/core-api/entry.rst | 268 +++++++++++++++++++++++++++++++++++++++ >> Documentation/core-api/index.rst | 8 + >> kernel/entry/common.c | 1 > > I think the change to kernel/entry/common.c got included by accident?
That's what I get from doing such things 30 minutes before midnight...
>> + >> +Syscall entry exit code starts obviously in low level architecture specific > > As a small nit, can we remove the "obviously"? It's certainly obvious to you > and me, but it doesn't meaningfully affect the sentence either way.
Indeed.
>> +assembly code and calls out into C-code after establishing low level >> +architecture specific state and stack frames. This low level code must not >> +be instrumented. A typical syscall handling function invoked from low level >> +assembly code looks like this:: >> + >> + noinstr void do_syscall(struct pt_regs \*regs, int nr) > ^^ > > Is `\*` necessary here? ... and/or should this be an explicit code block (which > IIUC doesn't require this esacping), e.g. > > .. code-block:: c
Right. Let me try that.
> noinstr void do_syscall(struct pt_regs *regs, int nr) >> + >> +If the interrupt is raised while the CPU executes in kernel space the entry >> +and exit handling is slightly different. RCU state is only updated when the >> +interrupt was raised in context of the idle task because that's the only > > Since we have an idle task for each cpu, perhaps either: > > s/the idle task/an idle task/ > s/the idle task/the CPU's idle task/
Yes, that's more precise
>> +Note, that the update of the preemption counter has to be the first >> +operation on enter and the last operation on exit. The reason is that both >> +lockdep and RCU rely on in_nmi() returning true in this case. The >> +preemption count modification in the NMI entry/exit case can obviously not >> +be traced. > > Could we say "must not" instead of "can not", e.g. > > The preemption count modification in the NMI entry/exit must not be traced. > > That way it's clearly a requirement, rather than a limitation.
Yes.
>> +Architecture specific code looks like this:: >> + >> + noinstr void do_nmi(struct pt_regs \*regs) >> + { >> + arch_nmi_enter(regs); >> + state = irqentry_nmi_enter(regs); >> + >> + instrumentation_begin(); >> + >> + invoke_nmi_handler(regs); >> + >> + instrumentation_end(); >> + irqentry_nmi_exit(regs); >> + } > > To keep the begin/end and enter/exit calls visually balanced, should the > instrumentation_end() call have trailing a line space, e.g.
Yup.
Thanks,
tglx
| |