linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: dave.martin@linaro.org (Dave Martin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 9/9] ARM: add uprobes support
Date: Mon, 15 Oct 2012 18:44:50 +0100	[thread overview]
Message-ID: <20121015174450.GB18614@linaro.org> (raw)
In-Reply-To: <CAH+eYFC1fr0vpK2T4hz9LK=Nz5bzQBQ4O-o0f9tsnj-_D9ZEJg@mail.gmail.com>

On Mon, Oct 15, 2012 at 01:44:55PM +0200, Rabin Vincent wrote:
> 2012/10/15 Dave Martin <dave.martin@linaro.org>:
> > On Sun, Oct 14, 2012 at 09:23:13PM +0200, Rabin Vincent wrote:
> >> Add basic uprobes support for ARM.
> >>
> >> perf probe --exec and SystemTap's userspace probing work.  The ARM
> >> kprobes test code has also been run in a userspace harness to test the
> >> uprobe instruction decoding.
> >
> > The assumption that the target code is ARM appears to be buried all over
> > the place.
> 
> Right, as stated:
> 
> >> Caveats:
> >>  - Thumb is not supported
> 
> > Certainly this code as currently written must depend on !THUMB2_KERNEL.
> 
> Why?  It currently works for ARM userspace even if the kernel is
> Thumb-2.

My bad, I misread what was happening in the Makefile changes.

My concern is about whether we can build the ARM and Thumb-2 kprobes
code into the same kernel.  If so, no problem, but I believe this is
not a tested configuration for kprobes itself.

If you've not already done so, it should be possible to test this
by adding CONFIG_THUMB2_KERNEL=y to your config, providing your
hardware is Thumb-2 capable.

> > However, there's an underlying problem here which we'd need to solve.
> > The kprobes code can take advantage of the fact that the kernel is all
> > ARM or (almost) all Thumb code.  So there is no support for kprobes
> > supporting ARM and Thumb at the same time.
> >
> > With userspace, we don't have this luxury.  With Debian armhf, Ubuntu
> > and Linaro building Thumb-2 userspaces, it may be an increasingly common
> > configuration independently of whether the kernel is built in Thumb-2
> > or not.
> >
> > Furthermode, there is no such thing as a pure Thumb-2 system in practice:
> > PLTs are always ARM, for example.  For uprobes to work well in userspace,
> > both should be supported together.
> 
> Right.  I don't think it's difficult to support both of them together,
> my thought was just to have userspace tell us if they want to probe a
> Thumb instruction via the usual 0th-bit set convention, and then take it
> from there.  I didn't do the Thumb handling currently because I didn't
> really look into modifying the kprobes Thumb instruction decoding and
> the IT handling for uprobes.

Having looked at the code a little more closely, it looks more closely
aligned with this goal than I thought at first.

I agree with your suggestion to require the caller to specify explicitly
whether they want to insert an ARM or Thumb probe (indeed, I think
there's no other way to do it, since guessing the target instruction
set can't be done reliably).  The code for setting a probe can then
switch trivially on that low bit.

Additional undef_hooks would be needed for the Thumb case, but this
looks relatively straightforward, as you say.


General question which I'm not sure I understand yet: is is possible
to combine uprobes/kprobes decode more completely?  It's not obvious
to me whether the uprobes-specific decoding only relates to features
which architecturally execute differently in user mode versus
privileged mode.  Some explanation somewhere could be helpful.

Cheers
---Dave

  reply	other threads:[~2012-10-15 17:44 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-14 19:23 [PATCH 1/9] uprobes: move function declarations out of arch Rabin Vincent
2012-10-14 19:23 ` [PATCH 2/9] uprobes: check for single step support Rabin Vincent
2012-10-17 16:40   ` Srikar Dronamraju
2012-10-17 17:02     ` Oleg Nesterov
2012-10-14 19:23 ` [PATCH 3/9] uprobes: allow ignoring of probe hits Rabin Vincent
2012-10-15 16:52   ` Oleg Nesterov
2012-10-16 20:11     ` Rabin Vincent
2012-10-17 17:35       ` Oleg Nesterov
2012-10-21 18:15         ` Rabin Vincent
2012-10-21 19:40           ` Oleg Nesterov
2012-10-17 16:52   ` Srikar Dronamraju
2012-10-14 19:23 ` [PATCH 4/9] uprobes: allow arch access to xol slot Rabin Vincent
2012-10-17 17:17   ` Srikar Dronamraju
2012-10-14 19:23 ` [PATCH 5/9] uprobes: allow arch-specific initialization Rabin Vincent
2012-10-18  9:39   ` Srikar Dronamraju
2012-10-14 19:23 ` [PATCH 6/9] uprobes: flush cache after xol write Rabin Vincent
2012-10-15 16:57   ` Oleg Nesterov
2012-10-16 20:29     ` Rabin Vincent
2012-10-25 14:58       ` Oleg Nesterov
2012-10-26  5:52         ` Ananth N Mavinakayanahalli
2012-10-26 16:39           ` Oleg Nesterov
2012-10-29  5:35             ` Ananth N Mavinakayanahalli
2012-11-03 16:33               ` Oleg Nesterov
2012-11-04 14:29                 ` Ananth N Mavinakayanahalli
2012-11-14 17:37                   ` Oleg Nesterov
2012-10-14 19:23 ` [PATCH 7/9] uprobes: add arch write opcode hook Rabin Vincent
2012-10-14 19:23 ` [PATCH 8/9] ARM: support uprobe handling Rabin Vincent
2012-11-04 10:13   ` Russell King - ARM Linux
2012-11-12 17:26     ` Rabin Vincent
2012-10-14 19:23 ` [PATCH 9/9] ARM: add uprobes support Rabin Vincent
2012-10-15 11:14   ` Dave Martin
2012-10-15 11:44     ` Rabin Vincent
2012-10-15 17:44       ` Dave Martin [this message]
2012-10-17 14:50         ` Jon Medhurst (Tixy)
2012-10-21 18:43           ` Rabin Vincent
2012-10-21 18:59         ` Rabin Vincent
2012-10-15 17:31   ` Dave Martin
2012-10-21 18:27     ` Rabin Vincent
2012-10-17 17:54   ` Oleg Nesterov
2012-10-15 17:19 ` [PATCH 1/9] uprobes: move function declarations out of arch Srikar Dronamraju
2012-10-16 20:30   ` Rabin Vincent
  -- strict thread matches above, loose matches on Subject: below --
2013-08-01 23:45 [PATCH 0/9] uprobes: Add uprobes support for ARM David Long
2013-08-01 23:45 ` [PATCH 9/9] ARM: add uprobes support David Long
2013-08-29 14:54   ` Jon Medhurst (Tixy)

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=20121015174450.GB18614@linaro.org \
    --to=dave.martin@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.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 NNTP newsgroup(s).