Subject: [PATCH v2 2/2] arm64: enable context tracking

From: [email-masked] (Will Deacon)
Date: Thu, 8 May 2014 11:25:14 +0100

On Thu, May 08, 2014 at 12:49:04AM +0100, Kevin Hilman wrote:
> Hi Will,

Hello Kevin,

> Will Deacon <[email-masked]> writes:
> > On Wed, May 07, 2014 at 12:32:29AM +0100, Larry Bassel wrote:
> >> Make calls to ct_user_enter when the kernel is exited
> >> and ct_user_exit when the kernel is entered (in el0_da,
> >> el0_ia, el0_svc, el0_irq).
> >
> > Why only these entry points? I can reschedule after any exception from EL0,
> > so I'd expect all exceptions from userspace to need annotating, no?
> 
> In my initial approach to this, you might recall (though it was over a
> year ago now) was to just instrument kernel_enter rather than sprinkle
> the instrumentaion in cl0_*.  However, your concern at the time was that
> since it was before debugging was enabled it would complicate debugging
> these paths.
> 
> Any chance you have any other suggestion on how we might do this in
> kernel_entry rather than sprinkling them all over cl0_*?  or is the
> sprinkling the only good way to handle this.

Unfortunately, different exceptions do subtly different things before
invoking the main handler. For example:

 - Stashing the far
 - Enabling IRQs
 - Enabling debug
 - All the stuff on the syscall path

so putting the logic in kernel_entry isn't really do-able, unfortunately.

Will