2020-08-15 21:54:28

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH RFC 02/12] entry/idle: Add a common function for activites during idle entry/exit

On Fri, Aug 14, 2020 at 11:18:58PM -0400, Joel Fernandes (Google) wrote:
> Currently only RCU hooks for idle entry/exit are called. In later
> patches, kernel-entry protection functionality will be added.
>
> Signed-off-by: Joel Fernandes (Google) <[email protected]>

NAK, rcu_idle_enter() is broken where it is now, it needs to be pushed
in deeper:

http://lkml.kernel.org/r/[email protected]


2020-08-17 02:21:12

by Joel Fernandes

[permalink] [raw]
Subject: Re: [PATCH RFC 02/12] entry/idle: Add a common function for activites during idle entry/exit

Hello Peter,

On Sat, Aug 15, 2020 at 10:14:41AM +0200, [email protected] wrote:
> On Fri, Aug 14, 2020 at 11:18:58PM -0400, Joel Fernandes (Google) wrote:
> > Currently only RCU hooks for idle entry/exit are called. In later
> > patches, kernel-entry protection functionality will be added.
> >
> > Signed-off-by: Joel Fernandes (Google) <[email protected]>
>
> NAK, rcu_idle_enter() is broken where it is now, it needs to be pushed
> in deeper:
>
> http://lkml.kernel.org/r/[email protected]

Thank you for pointing it out. Not a huge problem, a couple ways I can do it:
1. Move the calls to sched_core_unsafe_{enter,exit}() deeper into the idle loop.
2. Keep the calls to sched_core_unsafe_{enter,exit}() where they are now as
in this patch, but leave out the rcu_idle_{enter,exit}() calls alone so
they can be moved deeper as you mentioned.

#1 is not necessary for these patches to work and might be overkill.

I'll go the #2 route then. Let me know any other ideas you might have.

What I am trying to do here is to handle a case where task is switching to
idle (say it went to sleep) and wakes up later.

usermode -> syscall (kernel mode - so mark unsafe) -> idle (mark safe).

idle -> syscall wakes (kernel mode - so mark unsafe) -> usermode (mark safe).

Thank you,

- Joel