[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130324144144.GA17037@redhat.com>
Date: Sun, 24 Mar 2013 15:41:44 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Anton Arapov <anton@...hat.com>
Cc: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
LKML <linux-kernel@...r.kernel.org>,
Josh Stone <jistone@...hat.com>,
Frank Eigler <fche@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...e.hu>,
Ananth N Mavinakayanahalli <ananth@...ibm.com>,
adrian.m.negreanu@...el.com, Torsten.Polle@....de
Subject: Re: [PATCH 2/7] uretprobes: extract fill_page() and trampoline
implementation
On 03/22, Anton Arapov wrote:
>
> +static void fill_page(struct page *page, unsigned long offset, uprobe_opcode_t *insn)
^^^^^^^^^^^^^^^
Well, it should be "u8 *insn" or "char *".
xol_get_insn_slot() passes arch.insn, and this is not uprobe_opcode_t
in general (see arch/powerpc/include/asm/uprobes.h)
> +{
> + void *vaddr;
> +
> + vaddr = kmap_atomic(page);
> + memcpy(vaddr + offset, insn, MAX_UINSN_BYTES);
^^^^^^^^^^^^^^^
OK, but see below...
> + kunmap_atomic(vaddr);
> +
> + /*
> + * We probably need flush_icache_user_range() but it needs vma.
> + * This should work on supported architectures too.
> + */
> + flush_dcache_page(page);
> +}
Please do not move flush_dcache_page() from xol_get_insn_slot(),
this is not needed.
Unlike xol_get_insn_slot(), get_xol_area() calls fill_page() before
xol_add_vma().
> static int xol_add_vma(struct xol_area *area)
> {
> @@ -1122,6 +1137,7 @@ static struct xol_area *get_xol_area(void)
> {
> struct mm_struct *mm = current->mm;
> struct xol_area *area;
> + uprobe_opcode_t insn = UPROBE_SWBP_INSN;
>
> area = mm->uprobes_state.xol_area;
> if (area)
> @@ -1139,6 +1155,10 @@ static struct xol_area *get_xol_area(void)
> if (!area->page)
> goto free_bitmap;
>
> + /* pre-allocate for return probes */
> + set_bit(0, area->bitmap);
> + fill_page(area->page, 0, &insn);
sizeof(insn) == UPROBE_SWBP_INSN_SIZE != MAX_UINSN_BYTES. See also the
comments above.
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists