From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Anton Blanchard <anton@samba.org>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] powerpc: added DSCR support to ptrace
Date: Tue, 20 Nov 2012 12:18:09 +1100 [thread overview]
Message-ID: <50AADA51.7020101@ozlabs.ru> (raw)
In-Reply-To: <1350281910-5238-1-git-send-email-aik@ozlabs.ru>
Ping?
On 15/10/12 17:18, Alexey Kardashevskiy wrote:
> The DSCR (aka Data Stream Control Register) is supported on some
> server PowerPC chips and allow some control over the prefetch
> of data streams.
>
> The kernel already supports DSCR value per thread but there is also
> a need in a ability to change it from an external process for
> the specific pid.
>
> The patch adds new register index PT_DSCR (index=44) which can be
> set/get by:
> ptrace(PTRACE_POKEUSER, traced_process, PT_DSCR << 3, dscr);
> dscr = ptrace(PTRACE_PEEKUSER, traced_process, PT_DSCR << 3, NULL);
>
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
> arch/powerpc/include/asm/ptrace.h | 3 ++-
> arch/powerpc/kernel/ptrace.c | 16 ++++++++++++++++
> 2 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/include/asm/ptrace.h b/arch/powerpc/include/asm/ptrace.h
> index 84cc784..946c556 100644
> --- a/arch/powerpc/include/asm/ptrace.h
> +++ b/arch/powerpc/include/asm/ptrace.h
> @@ -276,7 +276,8 @@ static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
> #define PT_DAR 41
> #define PT_DSISR 42
> #define PT_RESULT 43
> -#define PT_REGS_COUNT 44
> +#define PT_DSCR 44
> +#define PT_REGS_COUNT 45
>
> #define PT_FPR0 48 /* each FP reg occupies 2 slots in this space */
>
> diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
> index 8d8e028..4798acf 100644
> --- a/arch/powerpc/kernel/ptrace.c
> +++ b/arch/powerpc/kernel/ptrace.c
> @@ -179,6 +179,17 @@ static int set_user_msr(struct task_struct *task, unsigned long msr)
> return 0;
> }
>
> +static unsigned long get_user_dscr(struct task_struct *task)
> +{
> + return task->thread.dscr;
> +}
> +
> +static int set_user_dscr(struct task_struct *task, unsigned long dscr)
> +{
> + task->thread.dscr = dscr;
> + return 0;
> +}
> +
> /*
> * We prevent mucking around with the reserved area of trap
> * which are used internally by the kernel.
> @@ -200,6 +211,9 @@ unsigned long ptrace_get_reg(struct task_struct *task, int regno)
> if (regno == PT_MSR)
> return get_user_msr(task);
>
> + if (regno == PT_DSCR)
> + return get_user_dscr(task);
> +
> if (regno < (sizeof(struct pt_regs) / sizeof(unsigned long)))
> return ((unsigned long *)task->thread.regs)[regno];
>
> @@ -218,6 +232,8 @@ int ptrace_put_reg(struct task_struct *task, int regno, unsigned long data)
> return set_user_msr(task, data);
> if (regno == PT_TRAP)
> return set_user_trap(task, data);
> + if (regno == PT_DSCR)
> + return set_user_dscr(task, data);
>
> if (regno <= PT_MAX_PUT_REG) {
> ((unsigned long *)task->thread.regs)[regno] = data;
>
--
Alexey
next prev parent reply other threads:[~2012-11-20 1:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-15 6:18 [PATCH] powerpc: added DSCR support to ptrace Alexey Kardashevskiy
2012-11-20 1:18 ` Alexey Kardashevskiy [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-12-13 3:50 Alexey Kardashevskiy
2012-12-13 5:34 Alexey Kardashevskiy
2013-01-11 4:18 Alexey Kardashevskiy
2013-01-11 6:29 Alexey Kardashevskiy
2013-01-15 18:17 ` Benjamin Herrenschmidt
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=50AADA51.7020101@ozlabs.ru \
--to=aik@ozlabs.ru \
--cc=anton@samba.org \
--cc=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=paulus@samba.org \
/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