Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Porting DTrace to ARM





(2014/01/27 19:57), Ryota Ozaki wrote:


(2014/01/27 14:43), Ryota Ozaki wrote:
Hi Matt,

Thank you very much for your kind reviewing.

(2014/01/24 23:03), Matt Thomas wrote:

On Jan 24, 2014, at 2:34 AM, Ryota Ozaki <ozaki-r%iij.ad.jp@localhost> wrote:

Updated as I planned, there is no curious update though.

Use of curcpu() or cpu_number() without having done kpreempt_disable()
is unsafe.

All the functions that I added and calls cpu_number() are
called from an interrupt handler, xc_unicast(XC_HIGHPRI, ...)
or dtrace_probe() that calls interrupt_disable() prior to
calling the functions.

In these cases, we don't need kpreempt_disable(), right?


dtrace_asm.S doesn't "assym.h"

Do you mean dtrace_asm.S doesn't need "assym.h"?

assembly routines should have a END(name) as well.
Use of =foo is frowned upon.

ENTRY(dtrace_invop_init)
    #ldr    r0, dtrace_invop_start
    ldr    r1, .Ldtrace_invop
    ldr    r2, .Ldtrace_invop_jump_addr
    str    r1, [r2]
    RET
    .align    0
.Ldtrace_invop:
    .word    dtrace_invop
.Ldtrace_invop_jump_addr
    .word    dtrace_invop_jump_addr
END(dtrace_invop_init)

ENTRY(dtrace_invop_uninit)
    mov    r0, #0
    ldr    r1, .Ldtrace_invop_jump_addr
    str    r0, [r1]
      RET
END(dtrace_invop_uninit)

Thanks, it works. The code is what I wanted to
do initially.



external/cddl/osnet/dev/fbt/fbt.c:

Don't use u_int{8,16,32}_t

OK. Will fix.


Makefiles:

Use include <bsd.own.mk>, then use

.if exists(${.CURDIR}/${MACHINE})
ARCHDIR=${MACHINE}
.elif exists(${.CURDIR}/${MACHINE_CPU})
ARCHDIR=${MACHINE_CPU}
.else
.error ${MACHINE} or ${MACHINE_CPU} not supported.
.endif


Followed you suggestion, I changed Makefile like this:

OSNETDIR=${NETBSDSRCDIR}/external/cddl/osnet

.if exists(${OSNETDIR}/dev/cyclic/${MACHINE:S/amd64/i386/})
ARCH=${MACHINE:S/amd64/i386/}
.elif exists(${OSNETDIR}/dev/cyclic/${MACHINE_CPU})
ARCH=${MACHINE_CPU}
.else
.error ${MACHINE} or ${MACHINE_CPU} not supported.
.endif

Two notes; .CURDIR is changed to the corresponding directory
and ARCHDIR is changed to ARCH because for arm ARCHDIR
is already defined in share/mk/bsd.kmodule.mk.

Updated the patch at https://gist.github.com/ozaki-r/8535846,
which reflects the above comments.

Now the patch can run some simple D scripts (by fixing
dtrace_cas32), although there still remain some (many?)
problems, for example, dtrace -n fbt::: cannot be handled
correctly.

https://gist.github.com/ozaki-r/8535846

The patch is getting in good shape. The version of arm works
as well as that of i386/arm64. At least the sample scripts(*)
now work fine on it.

(*) http://wiki.netbsd.org/tutorials/how_to_enable_and_run_dtrace/

Major changes since the previous version:
- move the instruction emulation code to fbt.c from undefined.c
  - to make easy to debug
  - to use definitions of dtrace.h under external/cddl/osnet/
- reject some functions from probing
  - dtrace doesn't work for the functions
  - see fbt.c
- don't enable interrupts before running dtrace_trapper
  in undefinedinstruction()
  - dtrace requires it
  - the patch is dirty :-(
- correct instruction emulations


Thanks,
  ozaki-r


Home | Main Index | Thread Index | Old Index