public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@linaro.org>
To: Larry Bassel <larry.bassel@linaro.org>
Cc: catalin.marinas@arm.com, will.deacon@arm.com,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linaro-kernel@lists.linaro.org
Subject: Re: [PATCH v6 2/2] arm64: enable context tracking
Date: Thu, 29 May 2014 13:37:10 -0700	[thread overview]
Message-ID: <7hzji0z5hl.fsf@paris.lan> (raw)
In-Reply-To: <1401394139-23469-3-git-send-email-larry.bassel@linaro.org> (Larry Bassel's message of "Thu, 29 May 2014 13:08:59 -0700")

Larry Bassel <larry.bassel@linaro.org> writes:

> 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 and all of the "error" paths).
>
> These macros expand to function calls which will only work
> properly if el0_sync and related code has been rearranged
> (in a previous patch of this series).
>
> The calls to ct_user_exit are made after hw debugging has been
> enabled (enable_dbg_and_irq).
>
> The call to ct_user_enter is made at the beginning of the
> kernel_exit macro.
>
> This patch is based on earlier work by Kevin Hilman.
> Save/restore optimizations were also done by Kevin.
>
> Signed-off-by: Kevin Hilman <khilman@linaro.org>
> Signed-off-by: Larry Bassel <larry.bassel@linaro.org>
> ---
>  arch/arm64/Kconfig                   |  1 +
>  arch/arm64/include/asm/thread_info.h |  4 ++++
>  arch/arm64/kernel/entry.S            | 39 +++++++++++++++++++++++++++++++++++-
>  3 files changed, 43 insertions(+), 1 deletion(-)
>
> diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
> index e759af5..ef18ae5 100644
> --- a/arch/arm64/Kconfig
> +++ b/arch/arm64/Kconfig
> @@ -55,6 +55,7 @@ config ARM64
>  	select RTC_LIB
>  	select SPARSE_IRQ
>  	select SYSCTL_EXCEPTION_TRACE
> +	select HAVE_CONTEXT_TRACKING
>  	help
>  	  ARM 64-bit (AArch64) Linux support.
>  
> diff --git a/arch/arm64/include/asm/thread_info.h b/arch/arm64/include/asm/thread_info.h
> index 720e70b..8363f34 100644
> --- a/arch/arm64/include/asm/thread_info.h
> +++ b/arch/arm64/include/asm/thread_info.h
> @@ -100,6 +100,7 @@ static inline struct thread_info *current_thread_info(void)
>  #define TIF_SIGPENDING		0
>  #define TIF_NEED_RESCHED	1
>  #define TIF_NOTIFY_RESUME	2	/* callback before returning to user */
> +#define TIF_NOHZ                7

FWIW, in earlier versions this was bit 24, but we had to move it into
the first 2 bytes..

>  #define TIF_SYSCALL_TRACE	8
>  #define TIF_POLLING_NRFLAG	16
>  #define TIF_MEMDIE		18	/* is terminating due to OOM killer */
> @@ -113,9 +114,12 @@ static inline struct thread_info *current_thread_info(void)
>  #define _TIF_NEED_RESCHED	(1 << TIF_NEED_RESCHED)
>  #define _TIF_NOTIFY_RESUME	(1 << TIF_NOTIFY_RESUME)
>  #define _TIF_32BIT		(1 << TIF_32BIT)
> +#define _TIF_SYSCALL_TRACE      (1 << TIF_SYSCALL_TRACE)
> +#define _TIF_NOHZ               (1 << TIF_NOHZ)
>  
>  #define _TIF_WORK_MASK		(_TIF_NEED_RESCHED | _TIF_SIGPENDING | \
>  				 _TIF_NOTIFY_RESUME)
> +#define _TIF_SYSCALL_WORK       (_TIF_SYSCALL_TRACE | _TIF_NOHZ)

...so that when this is used...

[...]

> @@ -616,9 +651,11 @@ el0_svc:
>  el0_svc_naked:					// compat entry point
>  	stp	x0, scno, [sp, #S_ORIG_X0]	// save the original x0 and syscall number
>  	enable_dbg_and_irq
> +	ct_user_exit 1
>  
>  	ldr	x16, [tsk, #TI_FLAGS]		// check for syscall tracing
> -	tbnz	x16, #TIF_SYSCALL_TRACE, __sys_trace // are we tracing syscalls?
> +	and	x16, x16, #_TIF_SYSCALL_WORK    // are we tracing syscalls?
> +	cbnz	x16, __sys_trace

...here, it doesn't get something like this:

entry.S:697: Error: immediate out of range at operand 3 -- `and x16,x16,#((1<<8)|(1<<24))'

Kevin

  reply	other threads:[~2014-05-29 20:37 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-29 20:08 [PATCH v6 0/2] context tracker support for arm64 Larry Bassel
2014-05-29 20:08 ` [PATCH v6 1/2] arm64: adjust el0_sync so that a function can be called Larry Bassel
2014-05-29 20:08 ` [PATCH v6 2/2] arm64: enable context tracking Larry Bassel
2014-05-29 20:37   ` Kevin Hilman [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-05-29 21:45 [PATCH v6 0/2] context tracker support for arm64 Larry Bassel
2014-05-29 21:45 ` [PATCH v6 2/2] arm64: enable context tracking Larry Bassel
2014-05-30 18:23   ` Will Deacon
     [not found]     ` <7hioonythl.fsf@paris.lan>
2014-06-03 10:26       ` Will Deacon
2014-06-03 17:34         ` Kevin Hilman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7hzji0z5hl.fsf@paris.lan \
    --to=khilman@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=larry.bassel@linaro.org \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=will.deacon@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox