Re: [PATCH v2] split up lockdep and syscall related functionality in generic entry code

From: Thomas Gleixner
Date: Tue Dec 01 2020 - 18:18:05 EST


On Tue, Dec 01 2020 at 15:27, Sven Schnelle wrote:
> __do_syscall is the function which gets called by low level entry.S code:
>
> void noinstr __do_syscall(struct pt_regs *regs)
> {
> enter_from_user_mode(regs); /* sets lockdep state, and other initial stuff */
>
> /*
> * functions that need to run with irqs disabled,
> * but lockdep state and other stuff set up
> */
> memcpy(&regs->gprs[8], S390_lowcore.save_area_sync, 8 * sizeof(unsigned long));
> memcpy(&regs->int_code, &S390_lowcore.svc_ilc, sizeof(regs->int_code));
> regs->psw = S390_lowcore.svc_old_psw;

As __do_syscall() is marked noinstr you want to add

instrumentation_begin();
>
> update_timer_sys();
>
> local_irq_enable();
>
> regs->orig_gpr2 = regs->gprs[2];
>
> do {
> regs->flags = _PIF_SYSCALL;
> do_syscall(regs);
> } while (test_pt_regs_flag(regs, PIF_SYSCALL_RESTART));

instrumentation_end();

for two reasons:

- it clearly documents the boundaries in the code

- it will make objtool happy.

I know it does not have s390 support yet, but I only can recommend
to add that. It's annoying to analyze all the spots it complains
about violating the noinstr rules, but it's way more reliable than
human inspection.


> exit_to_user_mode();
> }

Thanks,

tglx