From: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
To: linux-ia64@vger.kernel.org
Subject: RE: [PATCH] IA64 trap code 16 bytes atomic copy on montecito
Date: Tue, 31 Oct 2006 07:53:50 +0000 [thread overview]
Message-ID: <000101c6fcc1$b47cc000$5181030a@amr.corp.intel.com> (raw)
In-Reply-To: <4546E55E.3050207@intel.com>
bibo,mao wrote on Monday, October 30, 2006 9:56 PM
> On IA64 kprobe can not insert trap code on slot 1 because
> opcode of slot 1 crosses over two consecutive 8-bytes. On
> montecito machine 16 bytes atomic operation is avaiable,
> This patch implements 16 bytes atomic copy on montecito
> machine, so that kprobe can probe any slot on montecito
> machine.
>
> +/* this function uses st16/ld16 to atomically copy one bundle
> + * to code area, it requires src address and dest address is
> + * not in UC/UCE/WC area. Currently kernel physical memory
> + * identified map is cachable and WB, so there is no such check.
> + * input0: represents whether this cpu supports atomic
> + * st16/ld16 instruction
> + * input1: destionation address of bundle copy
> + * input2: source address of bundle copy
> + * return: -1 failed, 0 succeed
> + */
> +GLOBAL_ENTRY(kprobe_update_inst_bundle)
Hmm, the description doesn't match with implementation. I'm really
confused to the purpose of this asm function. It is using a pair of
ld8/st8 or using ld16/st16 depends on cpu feature. It returns error
only on address mis-alignment. There is no atomicity in there as
claimed in the description.
> @@ -460,10 +465,12 @@ void __kprobes arch_arm_kprobe(struct kp
> {
> unsigned long addr = (unsigned long)p->addr;
> unsigned long arm_addr = addr & ~0xFULL;
> + int atomic;
>
> + atomic = local_cpu_data->features & ITANIUM_CPUID4_AO;
> flush_icache_range((unsigned long)p->ainsn.insn,
> (unsigned long)p->ainsn.insn + sizeof(kprobe_opcode_t));
> - memcpy((char *)arm_addr, &p->opcode, sizeof(kprobe_opcode_t));
> + kprobe_update_inst_bundle(atomic, (void *)arm_addr, (void *)&p->opcode);
> flush_icache_range(arm_addr, arm_addr + sizeof(kprobe_opcode_t));
> }
Return value of kprobe_update_inst_bundle() is not used here. I suggest
re-design the function prototype. What does it mean to have an error? If
it is non-fatal, then why bother return a value?
> @@ -471,10 +478,11 @@ void __kprobes arch_disarm_kprobe(struct
> {
> unsigned long addr = (unsigned long)p->addr;
> unsigned long arm_addr = addr & ~0xFULL;
> + int atomic;
>
> + atomic = local_cpu_data->features & ITANIUM_CPUID4_AO;
> /* p->ainsn.insn contains the original unaltered kprobe_opcode_t */
> - memcpy((char *) arm_addr, (char *) p->ainsn.insn,
> - sizeof(kprobe_opcode_t));
> + kprobe_update_inst_bundle(atomic, (void *)arm_addr, (void *) p->ainsn.insn);
> flush_icache_range(arm_addr, arm_addr + sizeof(kprobe_opcode_t));
> }
Same here with kprobe_update_inst_bundle().
next prev parent reply other threads:[~2006-10-31 7:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-31 5:55 [PATCH] IA64 trap code 16 bytes atomic copy on montecito bibo,mao
2006-10-31 6:18 ` Keith Owens
2006-10-31 7:53 ` Chen, Kenneth W [this message]
2006-10-31 8:09 ` Chen, Kenneth W
2006-10-31 8:19 ` bibo,mao
2006-10-31 8:40 ` Chen, Kenneth W
2006-10-31 12:48 ` bibo,mao
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='000101c6fcc1$b47cc000$5181030a@amr.corp.intel.com' \
--to=kenneth.w.chen@intel.com \
--cc=linux-ia64@vger.kernel.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