All of lore.kernel.org
 help / color / mirror / Atom feed
From: ananth@in.ibm.com (Ananth N Mavinakayanahalli)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 6/9] uprobes: flush cache after xol write
Date: Sun, 4 Nov 2012 19:59:27 +0530	[thread overview]
Message-ID: <20121104142927.GA4087@in.ibm.com> (raw)
In-Reply-To: <20121103163301.GA9496@redhat.com>

On Sat, Nov 03, 2012 at 05:33:01PM +0100, Oleg Nesterov wrote:
> On 10/29, Ananth N Mavinakayanahalli wrote:
> >
> > On Fri, Oct 26, 2012 at 06:39:51PM +0200, Oleg Nesterov wrote:
> > > >
> > > > > OTOH, I do not understand this stuff, everything is nop on x86. And
> > > > > when I look into Documentation/cachetlb.txt I am starting to think
> > > > > that may be this needs flush_icache_user_range instead?
> > > > >
> > > > > Rabin, Ananth could you clarify this?
> > > >
> > > > Yes. We need flush_icache_user_range(). Though for x86 its always been a
> > > > nop, one never knows if there is some Power4 or older machine out there
> > > > that is still being used. We are fine for Power5 and later.
> > >
> > > This is bad...
> > >
> > > flush_icache_user needs vma. perhaps just to check VM_EXEC...
> > >
> > > So let me repeat to be sure I really understand, do you confirm that
> > > _in general_ flush_dcache_page() is not enough?
> >
> > flush_dcache_page() on powerpc already checks for
> > CPU_FTR_COHERENT_ICACHE. So, yes, that is enough.
> 
> Thanks Ananth.
> 
> Still it is not clear to me if flush_dcache_page() would be always right
> if we add the new port.
> 
> OK. So I assume we need the fix and I am going to apply the patch below.
> 
> Ananth, Rabin, will you ack it (including the comment I affed) ?
> 
> Oleg.
> 
> ------------------------------------------------------------------------------
> [PATCH] uprobes: flush cache after xol write
> 
> From: Rabin Vincent <rabin@rab.in>
> 
> Flush the cache so that the instructions written to the XOL area are
> visible.
> 
> Signed-off-by: Rabin Vincent <rabin@rab.in>

Acked-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>

> 
> --- x/kernel/events/uprobes.c
> +++ x/kernel/events/uprobes.c
> @@ -1199,6 +1199,11 @@ static unsigned long xol_get_insn_slot(s
>  	vaddr = kmap_atomic(area->page);
>  	memcpy(vaddr + offset, uprobe->arch.insn, MAX_UINSN_BYTES);
>  	kunmap_atomic(vaddr);
> +	/*
> +	 * We probably need flush_icache_user_range() but it needs vma.
> +	 * This should work on supported architectures too.
> +	 */
> +	flush_dcache_page(area->page);
> 
>  	return current->utask->xol_vaddr;
>  }

WARNING: multiple messages have this Message-ID (diff)
From: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
To: Oleg Nesterov <oleg@redhat.com>
Cc: Rabin Vincent <rabin@rab.in>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Peter Zijlstra <peterz@infradead.org>,
	Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Subject: Re: [PATCH 6/9] uprobes: flush cache after xol write
Date: Sun, 4 Nov 2012 19:59:27 +0530	[thread overview]
Message-ID: <20121104142927.GA4087@in.ibm.com> (raw)
In-Reply-To: <20121103163301.GA9496@redhat.com>

On Sat, Nov 03, 2012 at 05:33:01PM +0100, Oleg Nesterov wrote:
> On 10/29, Ananth N Mavinakayanahalli wrote:
> >
> > On Fri, Oct 26, 2012 at 06:39:51PM +0200, Oleg Nesterov wrote:
> > > >
> > > > > OTOH, I do not understand this stuff, everything is nop on x86. And
> > > > > when I look into Documentation/cachetlb.txt I am starting to think
> > > > > that may be this needs flush_icache_user_range instead?
> > > > >
> > > > > Rabin, Ananth could you clarify this?
> > > >
> > > > Yes. We need flush_icache_user_range(). Though for x86 its always been a
> > > > nop, one never knows if there is some Power4 or older machine out there
> > > > that is still being used. We are fine for Power5 and later.
> > >
> > > This is bad...
> > >
> > > flush_icache_user needs vma. perhaps just to check VM_EXEC...
> > >
> > > So let me repeat to be sure I really understand, do you confirm that
> > > _in general_ flush_dcache_page() is not enough?
> >
> > flush_dcache_page() on powerpc already checks for
> > CPU_FTR_COHERENT_ICACHE. So, yes, that is enough.
> 
> Thanks Ananth.
> 
> Still it is not clear to me if flush_dcache_page() would be always right
> if we add the new port.
> 
> OK. So I assume we need the fix and I am going to apply the patch below.
> 
> Ananth, Rabin, will you ack it (including the comment I affed) ?
> 
> Oleg.
> 
> ------------------------------------------------------------------------------
> [PATCH] uprobes: flush cache after xol write
> 
> From: Rabin Vincent <rabin@rab.in>
> 
> Flush the cache so that the instructions written to the XOL area are
> visible.
> 
> Signed-off-by: Rabin Vincent <rabin@rab.in>

Acked-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>

> 
> --- x/kernel/events/uprobes.c
> +++ x/kernel/events/uprobes.c
> @@ -1199,6 +1199,11 @@ static unsigned long xol_get_insn_slot(s
>  	vaddr = kmap_atomic(area->page);
>  	memcpy(vaddr + offset, uprobe->arch.insn, MAX_UINSN_BYTES);
>  	kunmap_atomic(vaddr);
> +	/*
> +	 * We probably need flush_icache_user_range() but it needs vma.
> +	 * This should work on supported architectures too.
> +	 */
> +	flush_dcache_page(area->page);
> 
>  	return current->utask->xol_vaddr;
>  }


  reply	other threads:[~2012-11-04 14:29 UTC|newest]

Thread overview: 82+ 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 ` Rabin Vincent
2012-10-14 19:23 ` [PATCH 2/9] uprobes: check for single step support Rabin Vincent
2012-10-14 19:23   ` Rabin Vincent
2012-10-17 16:40   ` Srikar Dronamraju
2012-10-17 16:40     ` Srikar Dronamraju
2012-10-17 17:02     ` Oleg Nesterov
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-14 19:23   ` Rabin Vincent
2012-10-15 16:52   ` Oleg Nesterov
2012-10-15 16:52     ` Oleg Nesterov
2012-10-16 20:11     ` Rabin Vincent
2012-10-16 20:11       ` Rabin Vincent
2012-10-17 17:35       ` Oleg Nesterov
2012-10-17 17:35         ` Oleg Nesterov
2012-10-21 18:15         ` Rabin Vincent
2012-10-21 18:15           ` Rabin Vincent
2012-10-21 19:40           ` Oleg Nesterov
2012-10-21 19:40             ` Oleg Nesterov
2012-10-17 16:52   ` Srikar Dronamraju
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-14 19:23   ` Rabin Vincent
2012-10-17 17:17   ` Srikar Dronamraju
2012-10-17 17:17     ` Srikar Dronamraju
2012-10-14 19:23 ` [PATCH 5/9] uprobes: allow arch-specific initialization Rabin Vincent
2012-10-14 19:23   ` Rabin Vincent
2012-10-18  9:39   ` Srikar Dronamraju
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-14 19:23   ` Rabin Vincent
2012-10-15 16:57   ` Oleg Nesterov
2012-10-15 16:57     ` Oleg Nesterov
2012-10-16 20:29     ` Rabin Vincent
2012-10-16 20:29       ` Rabin Vincent
2012-10-25 14:58       ` Oleg Nesterov
2012-10-25 14:58         ` Oleg Nesterov
2012-10-26  5:52         ` Ananth N Mavinakayanahalli
2012-10-26  5:52           ` Ananth N Mavinakayanahalli
2012-10-26 16:39           ` Oleg Nesterov
2012-10-26 16:39             ` Oleg Nesterov
2012-10-29  5:35             ` Ananth N Mavinakayanahalli
2012-10-29  5:35               ` Ananth N Mavinakayanahalli
2012-11-03 16:33               ` Oleg Nesterov
2012-11-03 16:33                 ` Oleg Nesterov
2012-11-04 14:29                 ` Ananth N Mavinakayanahalli [this message]
2012-11-04 14:29                   ` Ananth N Mavinakayanahalli
2012-11-14 17:37                   ` Oleg Nesterov
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   ` Rabin Vincent
2012-10-14 19:23 ` [PATCH 8/9] ARM: support uprobe handling Rabin Vincent
2012-10-14 19:23   ` Rabin Vincent
2012-11-04 10:13   ` Russell King - ARM Linux
2012-11-04 10:13     ` Russell King - ARM Linux
2012-11-12 17:26     ` Rabin Vincent
2012-11-12 17:26       ` Rabin Vincent
2012-10-14 19:23 ` [PATCH 9/9] ARM: add uprobes support Rabin Vincent
2012-10-14 19:23   ` Rabin Vincent
2012-10-15 11:14   ` Dave Martin
2012-10-15 11:14     ` Dave Martin
2012-10-15 11:44     ` Rabin Vincent
2012-10-15 11:44       ` Rabin Vincent
2012-10-15 17:44       ` Dave Martin
2012-10-15 17:44         ` Dave Martin
2012-10-17 14:50         ` Jon Medhurst (Tixy)
2012-10-17 14:50           ` Jon Medhurst (Tixy)
2012-10-21 18:43           ` Rabin Vincent
2012-10-21 18:43             ` Rabin Vincent
2012-10-21 18:59         ` Rabin Vincent
2012-10-21 18:59           ` Rabin Vincent
2012-10-15 17:31   ` Dave Martin
2012-10-15 17:31     ` Dave Martin
2012-10-21 18:27     ` Rabin Vincent
2012-10-21 18:27       ` Rabin Vincent
2012-10-17 17:54   ` Oleg Nesterov
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-15 17:19   ` Srikar Dronamraju
2012-10-16 20:30   ` Rabin Vincent
2012-10-16 20:30     ` Rabin Vincent

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=20121104142927.GA4087@in.ibm.com \
    --to=ananth@in.ibm.com \
    --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 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.