public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: William Cohen <wcohen@redhat.com>
To: systemtap@sourceware.org, Dave Long <dave.long@linaro.org>,
	       Pratyush Anand <panand@redhat.com>,
	Mark Brown <broonie@linaro.org>
Subject: exercising current aarch64 kprobe support with systemtap
Date: Thu, 09 Jun 2016 16:17:00 -0000	[thread overview]
Message-ID: <befacf57-b8eb-2926-8f4f-742f0f055a4c@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 3537 bytes --]

I have been exercising the current kprobes and uprobe patches for
arm64 that are in the test_upstream_arm64_devel branch of
https://github.com/pratyushanand/linux with systemtap.  There are a
two issues that I have seen on this kernel with systemtap.  There are
some cases where kprobes fail to register at places that appear to be
reasonable places for a kprobe.  The other issue is that kernel starts
having soft lockups when the hw_watch_addr.stp tests runs.  To get
systemtap with the newer kernels need the attached hack because of
changes in the aarch64 macro args.

EINVAL for seemingly valid kprobe registration

Below shows the bz1027459.stp failing because of the some of the kprobes not registering.

# make installcheck RUNTESTFLAGS="--debug systemtap.base/bz1027459.exp"
...


spawn stap /root/systemtap_write/systemtap/testsuite/systemtap.base/bz1027459.stp
WARNING: probe kernel.function("SyS_set_tid_address@kernel/fork.c:1236").call (address 0xfffffc00080c9578) registration error (rc -22)
WARNING: probe kernel.function("SyS_sched_setaffinity@kernel/sched/core.c:4690").call (address 0xfffffc0008104d58) registration error (rc -22)
WARNING: probe kernel.function("SyS_sched_get_priority_min@kernel/sched/core.c:5013").call (address 0xfffffc0008105250) registration error (rc -22)
WARNING: probe kernel.function("SyS_sched_get_priority_max@kernel/sched/core.c:4986").call (address 0xfffffc00081051e8) registration error (rc -22)
hi
FAIL: bz1027459 -p5 (0)

area around  Sys_set_tid_address

fffffc00080c956c:	d503201f 	nop
fffffc00080c9570:	08dc4c80 	.word	0x08dc4c80
fffffc00080c9574:	fffffc00 	.word	0xfffffc00

fffffc00080c9578 <SyS_set_tid_address>:
fffffc00080c9578:	a9be7bfd 	stp	x29, x30, [sp,#-32]!
fffffc00080c957c:	910003fd 	mov	x29, sp

area around SyS_sched_setaffiniity

fffffc0008104d4c:	17ffff73 	b	fffffc0008104b18 <sched_setaffinity+0x438>
fffffc0008104d50:	08dd9d80 	.word	0x08dd9d80
fffffc0008104d54:	fffffc00 	.word	0xfffffc00

fffffc0008104d58 <SyS_sched_setaffinity>:
fffffc0008104d58:	a9bb7bfd 	stp	x29, x30, [sp,#-80]!
fffffc0008104d5c:	910003fd 	mov	x29, sp

area around SyS_sched_get_priority_min

fffffc0008105244:	f9400bf3 	ldr	x19, [sp,#16]
fffffc0008105248:	a8c27bfd 	ldp	x29, x30, [sp],#32
fffffc000810524c:	d65f03c0 	ret

fffffc0008105250 <SyS_sched_get_priority_min>:
fffffc0008105250:	a9be7bfd 	stp	x29, x30, [sp,#-32]!
fffffc0008105254:	910003fd 	mov	x29, sp


area around SyS_sched_get_priority_max


fffffc00081051dc:	17ffffe8 	b	fffffc000810517c <sys_sched_yield+0x34>
fffffc00081051e0:	08dd9d80 	.word	0x08dd9d80
fffffc00081051e4:	fffffc00 	.word	0xfffffc00

fffffc00081051e8 <SyS_sched_get_priority_max>:
fffffc00081051e8:	a9be7bfd 	stp	x29, x30, [sp,#-32]!
fffffc00081051ec:	910003fd 	mov	x29, sp


The stp (store pair) instructions at the beginning of these functions
should be fine to instrument.  One thing that I could think of causing
a problem is the test to make sure that the instruction is not inside
a load exclusive/store exclusive region.  The test might be mistaking
some of the data before the start of the function as load exclusive
instructions.



Soft Lookup for the hw_watch_addr.stp

When running the hw_watch_addr.stp tests the machine gets a number of
processes using a lot of sys time and eventually the kernel reports
soft lockup:

http://paste.stg.fedoraproject.org/5323/

The systemtap.base/overload.exp tests all pass, but maybe there is
much work being done to generate the backtraces for hw_watch_addr.stp
and that is triggering the problem.


-Will

[-- Attachment #2: arm64_uaccess.patch --]
[-- Type: text/x-patch, Size: 2671 bytes --]

diff --git a/runtime/linux/loc2c-runtime.h b/runtime/linux/loc2c-runtime.h
index a3bec58..7589026 100644
--- a/runtime/linux/loc2c-runtime.h
+++ b/runtime/linux/loc2c-runtime.h
@@ -589,10 +589,10 @@ extern void __store_deref_bad(void);
     else                                                                      \
       switch (size)                                                           \
         {                                                                     \
-	case 1: __get_user_asm("ldrb", "%w", _v, (unsigned long)addr, _bad); break;\
-	case 2: __get_user_asm("ldrh", "%w",_v, (unsigned long)addr, _bad); break;\
-	case 4: __get_user_asm("ldr", "%w",_v,  (unsigned long)addr, _bad); break;\
-	case 8: __get_user_asm("ldr", "%",_v,  (unsigned long)addr, _bad); break;\
+	case 1: __get_user_asm("ldrb", "ldtrb", "%w", _v, (unsigned long)addr, _bad, ARM64_HAS_UAO); break; \
+	case 2: __get_user_asm("ldrh", "ldtrh", "%w",_v, (unsigned long)addr, _bad, ARM64_HAS_UAO); break; \
+	case 4: __get_user_asm("ldr", "ldtr", "%w",_v,  (unsigned long)addr, _bad, ARM64_HAS_UAO); break; \
+	case 8: __get_user_asm("ldr", "ldtr", "%",_v,  (unsigned long)addr, _bad, ARM64_HAS_UAO); break; \
         default: BUILD_BUG();			                              \
         }                                                                     \
     pagefault_enable();                                                       \
@@ -613,10 +613,10 @@ extern void __store_deref_bad(void);
     else                                                                      \
       switch (size)                                                           \
         {                                                                     \
-	case 1: __put_user_asm("strb", "%w", ((u8)(value)), addr, _bad); break;\
-	case 2: __put_user_asm("strh", "%w", ((u16)(value)), addr, _bad); break;\
-	case 4: __put_user_asm("str", "%w", ((u32)(value)), addr, _bad); break;\
-	case 8: __put_user_asm("str", "%", ((u64)(value)), addr, _bad); break;\
+	case 1: __put_user_asm("strb", "sttrb", "%w", ((u8)(value)), addr, _bad, ARM64_HAS_UAO); break; \
+	case 2: __put_user_asm("strh", "sttrh", "%w", ((u16)(value)), addr, _bad, ARM64_HAS_UAO); break;	\
+	case 4: __put_user_asm("str", "sttr", "%w", ((u32)(value)), addr, _bad, ARM64_HAS_UAO); break; \
+	case 8: __put_user_asm("str", "sttr", "%", ((u64)(value)), addr, _bad, ARM64_HAS_UAO); break; \
         default: BUILD_BUG();                                                 \
         }                                                                     \
     pagefault_enable();                                                       \

             reply	other threads:[~2016-06-09 16:17 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-09 16:17 William Cohen [this message]
2016-06-09 19:52 ` William Cohen
2016-06-10  3:42   ` David Long
2016-06-10  5:49   ` David Long
2016-06-10 13:43     ` Pratyush Anand
2016-06-10 14:03       ` William Cohen
2016-06-10 14:37         ` David Long
2016-06-10 15:27           ` William Cohen
2016-06-10 14:20       ` David Long
2016-06-10 15:11         ` William Cohen
2016-06-10 17:07         ` Pratyush Anand
2016-07-12 14:33     ` William Cohen
2016-07-13 18:26       ` David Long
2016-07-13 18:47         ` Pratyush Anand
2016-07-13 19:45           ` William Cohen
2016-06-10 21:28 ` William Cohen
2016-06-10 21:37   ` William Cohen
2016-06-13  4:28   ` Pratyush Anand
2016-06-13 13:42     ` William Cohen
2016-06-22 20:24   ` William Cohen
2016-06-23  3:19     ` David Long
2016-06-23 13:42       ` William Cohen
2016-06-23 13:47         ` David Smith
2016-06-23 15:49       ` William Cohen
2016-06-23 18:26         ` David Long
2016-06-23 19:22           ` William Cohen
2016-06-27  2:57             ` David Long
2016-06-27 14:18             ` Pratyush Anand
2016-06-28  3:20               ` William Cohen
2016-07-04 12:46                 ` Pratyush Anand
2016-07-07 19:05                   ` David Long
2016-07-07 19:58                     ` Frank Ch. Eigler
2016-08-03 13:13                       ` Pratyush Anand
2016-08-03 14:51                         ` William Cohen
2016-08-03 15:11                           ` David Long
2016-08-03 17:40                         ` William Cohen
2016-08-03 20:00                           ` Lastest kprobes64 patch David Long
2016-08-03 20:01                             ` Frank Ch. Eigler
2016-08-03 20:08                               ` David Long
2016-08-04  5:03                             ` Pratyush Anand
2016-08-04 13:07                               ` David Long
2016-08-04  4:42                           ` exercising current aarch64 kprobe support with systemtap Pratyush Anand
2016-08-04 13:57                             ` William Cohen
2016-08-04 14:36                               ` Pratyush Anand
2016-08-04 14:50                                 ` William Cohen
2016-08-04 20:51                                 ` William Cohen
2016-08-17 14:36                                   ` William Cohen
2016-08-17 18:04                                     ` David Smith
2016-08-17 18:28                                       ` William Cohen
2016-08-18 15:07                                         ` David Smith
2016-08-18 15:16                                           ` William Cohen
2016-08-18 15:39                                             ` David Smith
2016-08-18 14:55                                     ` Pratyush Anand
2016-06-13 16:11 ` William Cohen
2016-06-13 16:15   ` William Cohen
2016-06-14  4:27   ` Pratyush Anand

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=befacf57-b8eb-2926-8f4f-742f0f055a4c@redhat.com \
    --to=wcohen@redhat.com \
    --cc=broonie@linaro.org \
    --cc=dave.long@linaro.org \
    --cc=panand@redhat.com \
    --cc=systemtap@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).