From: Cyril Bur <cyrilbur@gmail.com>
To: wei.guo.simon@gmail.com, linuxppc-dev@lists.ozlabs.org
Cc: Shuah Khan <shuah@kernel.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Chris Smart <chris@distroguy.com>,
Suraj Jitindar Singh <sjitindarsingh@gmail.com>,
Michael Neuling <mikey@neuling.org>,
Anshuman Khandual <khandual@linux.vnet.ibm.com>,
Jack Miller <jack@codezen.org>,
Rashmica Gupta <rashmicy@gmail.com>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v14 07/15] selftests/powerpc: Add ptrace tests for TAR, PPR, DSCR registers
Date: Wed, 14 Sep 2016 14:53:31 +1000 [thread overview]
Message-ID: <1473828811.2554.12.camel@gmail.com> (raw)
In-Reply-To: <1473665605-11890-8-git-send-email-wei.guo.simon@gmail.com>
On Mon, 2016-09-12 at 15:33 +0800, wei.guo.simon@gmail.com wrote:
> From: Anshuman Khandual <khandual@linux.vnet.ibm.com>
>
> This patch adds ptrace interface test for TAR, PPR, DSCR
> registers. This also adds ptrace interface based helper
> functions related to TAR, PPR, DSCR register access.
>
> Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
> Signed-off-by: Simon Guo <wei.guo.simon@gmail.com>
> ---
> tools/testing/selftests/powerpc/ptrace/Makefile | 3 +-
> .../testing/selftests/powerpc/ptrace/ptrace-tar.c | 159
> ++++++++++++++++++
> .../testing/selftests/powerpc/ptrace/ptrace-tar.h | 50 ++++++
> tools/testing/selftests/powerpc/ptrace/ptrace.h | 181
> +++++++++++++++++++++
> 4 files changed, 392 insertions(+), 1 deletion(-)
> create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-
> tar.c
> create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-
> tar.h
>
[snip]
> +
> +void tar(void)
> +{
> + unsigned long reg[3];
> + int ret;
> +
> + cptr = (int *)shmat(shm_id, NULL, 0);
> + printf("%-30s TAR: %u PPR: %lx DSCR: %u\n",
> + user_write, TAR_1, PPR_1, DSCR_1);
> +
> + mtspr(SPRN_TAR, TAR_1);
> + mtspr(SPRN_PPR, PPR_1);
> + mtspr(SPRN_DSCR, DSCR_1);
> +
> + cptr[2] = 1;
> +
> + /* Wait on parent */
> + while (!cptr[0]);
asm volatile("" ::: "memory");
> +
> + reg[0] = mfspr(SPRN_TAR);
> + reg[1] = mfspr(SPRN_PPR);
> + reg[2] = mfspr(SPRN_DSCR);
> +
> + printf("%-30s TAR: %lu PPR: %lx DSCR: %lu\n",
> + user_read, reg[0], reg[1], reg[2]);
> +
> + /* Unblock the parent now */
> + cptr[1] = 1;
> + shmdt((int *)cptr);
> +
> + ret = validate_tar_registers(reg, TAR_2, PPR_2, DSCR_2);
> + if (ret)
> + exit(1);
> + exit(0);
> +}
> +
> +int trace_tar(pid_t child)
> +{
> + unsigned long reg[3];
> + int ret;
> +
> + ret = start_trace(child);
> + if (ret)
> + return TEST_FAIL;
> +
> + ret = show_tar_registers(child, reg);
> + if (ret)
> + return TEST_FAIL;
> +
> + printf("%-30s TAR: %lu PPR: %lx DSCR: %lu\n",
> + ptrace_read_running, reg[0], reg[1],
> reg[2]);
> +
> + ret = validate_tar_registers(reg, TAR_1, PPR_1, DSCR_1);
> + if (ret)
> + return TEST_FAIL;
> +
> + ret = stop_trace(child);
> + if (ret)
> + return TEST_FAIL;
> +
> + return TEST_PASS;
> +}
> +
> +int trace_tar_write(pid_t child)
> +{
> + int ret;
> +
> + ret = start_trace(child);
> + if (ret)
> + return TEST_FAIL;
> +
> + ret = write_tar_registers(child, TAR_2, PPR_2, DSCR_2);
> + if (ret)
> + return TEST_FAIL;
> +
> + printf("%-30s TAR: %u PPR: %lx DSCR: %u\n",
> + ptrace_write_running, TAR_2, PPR_2, DSCR_2);
> +
> + ret = stop_trace(child);
> + if (ret)
> + return TEST_FAIL;
> +
> + return TEST_PASS;
> +}
More comments about calling TEST_FAIL(x)
> +
> +int ptrace_tar(void)
> +{
> + pid_t pid;
> + int ret, status;
> +
> + shm_id = shmget(IPC_PRIVATE, sizeof(int) * 3,
> 0777|IPC_CREAT);
> + pid = fork();
> + if (pid < 0) {
> + perror("fork() failed");
> + return TEST_FAIL;
> + }
> +
> + if (pid == 0)
> + tar();
> +
> + if (pid) {
>
[snip]
next prev parent reply other threads:[~2016-09-14 4:53 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-12 7:33 [PATCH v14 00/15] selftests/powerpc: Add ptrace tests for ppc registers wei.guo.simon
2016-09-12 7:33 ` [PATCH v14 01/15] selftests/powerpc: Add more SPR numbers, TM & VMX instructions to 'reg.h' wei.guo.simon
2016-09-14 4:48 ` Cyril Bur
2016-09-12 7:33 ` [PATCH v14 02/15] selftests/powerpc: Use the new SPRN_DSCR_PRIV definiton wei.guo.simon
2016-09-12 7:33 ` [PATCH v14 03/15] selftests/powerpc: Add ptrace tests for EBB wei.guo.simon
2016-09-12 7:33 ` [PATCH v14 04/15] selftests/powerpc: Add ptrace tests for GPR/FPR registers wei.guo.simon
2016-09-14 4:50 ` Cyril Bur
2016-09-12 7:33 ` [PATCH v14 05/15] selftests/powerpc: Add ptrace tests for GPR/FPR registers in TM wei.guo.simon
2016-09-14 4:51 ` Cyril Bur
2016-09-12 7:33 ` [PATCH v14 06/15] selftests/powerpc: Add ptrace tests for GPR/FPR registers in suspended TM wei.guo.simon
2016-09-12 7:33 ` [PATCH v14 07/15] selftests/powerpc: Add ptrace tests for TAR, PPR, DSCR registers wei.guo.simon
2016-09-14 4:53 ` Cyril Bur [this message]
2016-09-12 7:33 ` [PATCH v14 08/15] selftests/powerpc: Add ptrace tests for TAR, PPR, DSCR in TM wei.guo.simon
2016-09-12 7:33 ` [PATCH v14 09/15] selftests/powerpc: Add ptrace tests for TAR, PPR, DSCR in suspended TM wei.guo.simon
2016-09-12 7:33 ` [PATCH v14 10/15] selftests/powerpc: Add ptrace tests for VSX, VMX registers wei.guo.simon
2016-09-12 7:33 ` [PATCH v14 11/15] selftests/powerpc: Add ptrace tests for VSX, VMX registers in TM wei.guo.simon
2016-09-12 7:33 ` [PATCH v14 12/15] selftests/powerpc: Add ptrace tests for VSX, VMX registers in suspended TM wei.guo.simon
2016-09-12 7:33 ` [PATCH v14 13/15] selftests/powerpc: Add ptrace tests for TM SPR registers wei.guo.simon
2016-09-14 5:04 ` Cyril Bur
2016-09-19 2:33 ` Simon Guo
2016-09-30 2:17 ` Simon Guo
2016-09-12 7:33 ` [PATCH v14 14/15] selftests/powerpc: Add .gitignore file for ptrace executables wei.guo.simon
2016-09-12 7:33 ` [PATCH v14 15/15] selftests/powerpc: Fix a build issue wei.guo.simon
2016-09-14 4:55 ` Cyril Bur
2016-09-13 5:49 ` [PATCH v14 00/15] selftests/powerpc: Add ptrace tests for ppc registers Cyril Bur
2016-09-12 17:01 ` Simon Guo
2016-09-14 4:09 ` Cyril Bur
2016-09-14 7:06 ` Michael Ellerman
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=1473828811.2554.12.camel@gmail.com \
--to=cyrilbur@gmail.com \
--cc=chris@distroguy.com \
--cc=jack@codezen.org \
--cc=khandual@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mikey@neuling.org \
--cc=mpe@ellerman.id.au \
--cc=rashmicy@gmail.com \
--cc=shuah@kernel.org \
--cc=sjitindarsingh@gmail.com \
--cc=wei.guo.simon@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.