linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: tixy@yxit.co.uk (Tixy)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: kprobes: only patch instructions on one CPU
Date: Wed, 26 Oct 2011 07:28:47 +0100	[thread overview]
Message-ID: <1319610527.2246.17.camel@computer2> (raw)
In-Reply-To: <20111025153652.GA11649@debian>

On Tue, 2011-10-25 at 21:06 +0530, Rabin Vincent wrote:
> On Thu, Oct 13, 2011 at 10:07:32AM +0100, Tixy wrote:
> > As I said in my reply to the other mail, I had missed the fact that it
> > is stop_machine_cpu_stop() which is used to call our function, and this
> > synchronises all cores. Therefore, this patch is correct, assuming that
> > a flush_icache_range executed on one core also flushes I-caches on other
> > cores. (I'm a bit doubtfull of this as I beleive that at least
> > ARM11MPCore requires this to be managed in software and I can't find any
> > code that handles this.)
> 
> If we want kprobes to work correctly on ARM11MPCore, shouldn't we need
> to broadcast the invalidate in arch_prepare_kprobe() and the
> non-stop-machine-using parts of arch_arm_kprobe() too?

We would, though the effect of not doing so would be safer. I.e. we
would just miss triggering kprobes, whereas when removing probes the
effect could be a processes faulting when it executes the 'breakpoint'
instruction still in the I cache.

> Also, it seems odd to perform the instruction write and
> flush_icache_range() on every CPU from stop_machine().  Perhaps it would
> be better if there were a way in stop_machine() to call an I-cache
> invalidation function on all CPUs, after the arm/disarm function is
> called on only one of them.

The arm/disarm functions only writes an instruction to RAM and flushes
the I-cache for it. It doesn't seem worth the effort of adding code to
avoid the couple of instruction required to write the instruction,
especially as stop_machine() is already causing all CPUs to reschedule,
sync with each other, and reschedule again.

As you say though, it should be possible and looks nicer if the disarm
code was only called on one CPU. I'm just trying to point out that there
may be risks and there is little performance benefit.

-- 
Tixy

      reply	other threads:[~2011-10-26  6:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-12 16:12 [PATCH] ARM: kprobes: only patch instructions on one CPU Rabin Vincent
2011-10-13  7:55 ` Tixy
2011-10-13  9:07   ` Tixy
2011-10-25 15:36     ` Rabin Vincent
2011-10-26  6:28       ` Tixy [this message]

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=1319610527.2246.17.camel@computer2 \
    --to=tixy@yxit.co.uk \
    --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).