From: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Oleg Nesterov <oleg@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
Christoph Hellwig <hch@infradead.org>,
Steven Rostedt <rostedt@goodmis.org>,
Thomas Gleixner <tglx@linutronix.de>,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
Anton Arapov <anton@redhat.com>,
Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
Jim Keniston <jkenisto@linux.vnet.ibm.com>,
Jiri Olsa <jolsa@redhat.com>, Josh Stone <jistone@redhat.com>
Subject: [PATCH 2/3] uprobes/core: remove uprobe_opcode_sz
Date: Wed, 22 Feb 2012 14:45:49 +0530 [thread overview]
Message-ID: <20120222091549.15880.67020.sendpatchset@srdronam.in.ibm.com> (raw)
In-Reply-To: <20120222091535.15880.12502.sendpatchset@srdronam.in.ibm.com>
From: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
uprobe_opcode_sz refers to the smallest instruction size for that
architecture. UPROBES_BKPT_INSN_SIZE refers to the size of the breakpoint
instruction for that architecture.
For now we are assuming that both uprobe_opcode_sz and
UPROBES_BKPT_INSN_SIZE are the same for all archs and hence removing
uprobe_opcode_sz in favour of UPROBES_BKPT_INSN_SIZE.
However if we have to support architectures where the smallest instruction
size is different from the size of breakpoint instruction, we may have to
re-introduce uprobe_opcode_sz.
Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
---
include/linux/uprobes.h | 2 --
kernel/uprobes.c | 6 +++---
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index 64e45f1..fd45b70 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -37,8 +37,6 @@ struct uprobe_arch_info {};
#define MAX_UINSN_BYTES 4
#endif
-#define uprobe_opcode_sz sizeof(uprobe_opcode_t)
-
/* flags that denote/change uprobes behaviour */
/* Have a copy of original instruction */
diff --git a/kernel/uprobes.c b/kernel/uprobes.c
index 884817f..ee496ad 100644
--- a/kernel/uprobes.c
+++ b/kernel/uprobes.c
@@ -244,8 +244,8 @@ static int write_opcode(struct mm_struct *mm, struct uprobe *uprobe,
/* poke the new insn in, ASSUMES we don't cross page boundary */
vaddr &= ~PAGE_MASK;
- BUG_ON(vaddr + uprobe_opcode_sz > PAGE_SIZE);
- memcpy(vaddr_new + vaddr, &opcode, uprobe_opcode_sz);
+ BUG_ON(vaddr + UPROBES_BKPT_INSN_SIZE > PAGE_SIZE);
+ memcpy(vaddr_new + vaddr, &opcode, UPROBES_BKPT_INSN_SIZE);
kunmap_atomic(vaddr_new);
kunmap_atomic(vaddr_old);
@@ -293,7 +293,7 @@ static int read_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_
lock_page(page);
vaddr_new = kmap_atomic(page);
vaddr &= ~PAGE_MASK;
- memcpy(opcode, vaddr_new + vaddr, uprobe_opcode_sz);
+ memcpy(opcode, vaddr_new + vaddr, UPROBES_BKPT_INSN_SIZE);
kunmap_atomic(vaddr_new);
unlock_page(page);
next prev parent reply other threads:[~2012-02-22 9:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-22 9:15 [PATCH 1/3] uprobes/core: Make instruction tables volatile Srikar Dronamraju
2012-02-22 9:15 ` Srikar Dronamraju [this message]
2012-02-22 16:05 ` [tip:perf/uprobes] uprobes/core: Remove uprobe_opcode_sz tip-bot for Srikar Dronamraju
2012-02-22 9:16 ` [PATCH 3/3] uprobes/core: move insn to arch specific structure Srikar Dronamraju
2012-02-22 16:06 ` [tip:perf/uprobes] uprobes/core: Move " tip-bot for Srikar Dronamraju
2012-02-22 9:47 ` [PATCH 1/3] uprobes/core: Make instruction tables volatile Ingo Molnar
2012-02-22 10:04 ` Srikar Dronamraju
2012-02-22 16:04 ` [tip:perf/uprobes] " tip-bot for Srikar Dronamraju
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=20120222091549.15880.67020.sendpatchset@srdronam.in.ibm.com \
--to=srikar@linux.vnet.ibm.com \
--cc=ananth@in.ibm.com \
--cc=anton@redhat.com \
--cc=hch@infradead.org \
--cc=jistone@redhat.com \
--cc=jkenisto@linux.vnet.ibm.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@elte.hu \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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