linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
To: Oleg Nesterov <oleg@redhat.com>,
	tip-bot for Marcin Nowakowski <tipbot@zytor.com>
Cc: <linux-tip-commits@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <peterz@infradead.org>,
	<alexander.shishkin@linux.intel.com>, <acme@kernel.org>,
	<acme@redhat.com>, <mingo@kernel.org>,
	<victor.kamensky@linaro.org>, <jolsa@redhat.com>, <hpa@zytor.com>,
	<torvalds@linux-foundation.org>, <tglx@linutronix.de>
Subject: Re: [tip:perf/urgent] uprobes: Fix uprobes on MIPS, allow for a cache flush after ixol breakpoint creation
Date: Tue, 20 Dec 2016 16:21:44 +0100	[thread overview]
Message-ID: <8707b178-15e0-1ca0-5612-f42d771446cc@imgtec.com> (raw)
In-Reply-To: <20161220130820.GA24822@redhat.com>

Hi Oleg,

On 20.12.2016 14:08, Oleg Nesterov wrote:
> On 12/19, tip-bot for Marcin Nowakowski wrote:
>>
>> uprobes: Fix uprobes on MIPS, allow for a cache flush after ixol breakpoint creation
>>
>> Commit:
>>
>>   72e6ae285a1d ('ARM: 8043/1: uprobes need icache flush after xol write'
>>
>> ... has introduced an arch-specific method to ensure all caches are
>> flushed appropriately after an instruction is written to an XOL page.
>
> when this page is already mmaped,
>
>> However, when the XOL area is created and the out-of-line breakpoint
>> instruction is copied, caches are not flushed at all and stale data may
>> be found in icache.
>
> but in this case the page is not mmaped yet, the probed application will
> take a page fault if it tries to execute this insn,

In case of MIPS (and AFAICT ARM as well, and these are the only 
architectures that implement arch_uprobe_copy_ixol), the cache flushing 
is done through the kernel addresses of that page, so the fact that it 
is not mapped yet is not an issue.

Do I understand correctly that your statement implies that after the 
page fault and mmapping the xol page, the page is guaranteed to be 
updated in the cache? As definitely that is not something that is 
happening at the moment.


>> Replace a simple copy_to_page() with arch_uprobe_copy_ixol() to allow
>> the arch to ensure all caches are updated accordingly.
>>
>> This change fixes uprobes on MIPS InterAptiv (tested on Creator Ci40).
>
> OK, I know nothing about MIPS, but could you help me understand this change?
>
> See above. If we really need flush_icache_range() here then perhaps we should
> modify install_special_mapping() and/or __do_fault/special_mapping_fault paths
> instead?

Are you suggesting that those should be updated to force a cache update?

Marcin

  reply	other threads:[~2016-12-20 15:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-13 10:40 [PATCH] uprobes: " Marcin Nowakowski
2016-12-20  7:58 ` [tip:perf/urgent] uprobes: Fix uprobes on MIPS, " tip-bot for Marcin Nowakowski
2016-12-20 13:08   ` Oleg Nesterov
2016-12-20 15:21     ` Marcin Nowakowski [this message]
2016-12-20 17:50       ` Oleg Nesterov
2016-12-21 11:24         ` Ralf Baechle

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=8707b178-15e0-1ca0-5612-f42d771446cc@imgtec.com \
    --to=marcin.nowakowski@imgtec.com \
    --cc=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=tipbot@zytor.com \
    --cc=torvalds@linux-foundation.org \
    --cc=victor.kamensky@linaro.org \
    --subject='Re: [tip:perf/urgent] uprobes: Fix uprobes on MIPS, allow for a cache flush after ixol breakpoint creation' \
    /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

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).