From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 20 06:00:16 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 150FE1065670 for ; Tue, 20 Jul 2010 06:00:16 +0000 (UTC) (envelope-from shrikanth07@gmail.com) Received: from mail-qy0-f182.google.com (mail-qy0-f182.google.com [209.85.216.182]) by mx1.freebsd.org (Postfix) with ESMTP id C29D68FC08 for ; Tue, 20 Jul 2010 06:00:15 +0000 (UTC) Received: by qyk7 with SMTP id 7so3067977qyk.13 for ; Mon, 19 Jul 2010 23:00:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=PyhRe4AfwTcTgaCVQTECigeCDqJMCm/EXLMw0yqcA+I=; b=UJMMKGC1z1cWwkpxi7sx9SrHtihRddOODp6RnC569hnhR/Nk8/OhFvD4Ww0sEGe+p2 dbAFVmDKFX6eTdw/FWs8p3lkiX2BzGFrdNz1Gp8XeD55fepumRTrZ+0ENE+ywzLDf6tN 1YQrKKmItM1NzzuPQ8o4s6pipaan528e+w7Ao= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=tIKJwamRPCtg3+0oN9jsvqShJjLBxIO6AnGd1bJnwsGBRZ0pI1D25U8bT1TdD9DyHs 1tFxXemUFNI9AQ39XZCZky9rYvw8tOQEywEfTN3Du1hbNeWnyuzZOfHWWRPhXAi+sX9c 4ZTFlkmpAuTNJkpv6fB5NX9C8dXtd2OIdwBrI= MIME-Version: 1.0 Received: by 10.224.53.150 with SMTP id m22mr5293872qag.316.1279605614999; Mon, 19 Jul 2010 23:00:14 -0700 (PDT) Received: by 10.229.84.84 with HTTP; Mon, 19 Jul 2010 23:00:04 -0700 (PDT) Date: Tue, 20 Jul 2010 11:30:04 +0530 Message-ID: From: Shrikanth Kamath To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: [DTrace] DIF DIF_OP_LDUW replaced with DIF_OP_RLDUW X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jul 2010 06:00:16 -0000 I see the the instruction DIF_OP_LDUW (when observed with the option verbose in script) is getting replaced with a DIF_OP_RLDUW. Maybe this is intentional, but with DIF_OP_RLDUW the check 'dtrace_canstore' fails giving 'CPU_DTRACE_KPRIV' fault for whatever variables I query. * Is this intentional replacement? * If yes, then my args[0] variables are all outside the range being checked in dtrace_canstore which gets called when dtrace_dif_emulate sees DIF_OP_RLDUW? ** This is FreeBSD cross compiler environment... Here is the script #pragma D option verbose BEGIN { } fbt::kernel_nudge_client:entry { trace(args[0]->client_num); } --------------------------------------------------------------------------------------- root%dtrace -s fbt_test.d DIFO 0x0x80b1280 returns D type (integer) (size 4) OFF OPCODE INSTRUCTION 00: 25000001 setx DT_INTEGER[0], %r1 ! 0x0 01: 28000101 ldga DT_VAR(0), %r1, %r1 02: 25000102 setx DT_INTEGER[1], %r2 ! 0x20 03: 04010201 sll %r1, %r2, %r1 04: 05010201 srl %r1, %r2, %r1 05: 25000202 setx DT_INTEGER[2], %r2 ! 0xc 06: 07010201 add %r1, %r2, %r1 07: 21010001 lduw [%r1], %r1 <== LDUW here 08: 23000001 ret %r1 dtrace: script 'fbt_test.d' matched 2 probes CPU ID FUNCTION:NAME 0 1 :BEGIN --------------------------------------------------------------------------------------- But when the probe is hit, I compare what DIFO is present in kernel space (kgdb) p /x text[7] $12 = 0x4c010001 whereas the instruction 07 in the above dump is 0x21010001 '4c' says it is a "rlduw" instruction. The problem is the args[0]->client_num address is showing up as [0xc45b3d2c] and the check in dtrace_canstore shows all ranges for 'dtms_scratch_base', 'dtvs_dynvars.dtds_base' are above the "0xc45b3d2c". Hence dtrace_canstore returns 0 and CPU_DTRACE_KPRIV gets returned. (kgdb) fr #3 0xc4ff9863 in dtrace_dif_emulate... (kgdb) p /x 0xc45b3d2c <== &args[0]->client_num $19 = 0xc45b3d2c (kgdb) p /x mstate->dtms_scratch_base $20 = 0xc5cc0008 (kgdb) p /x mstate->dtms_scratch_size $21 = 0xbffff8 (kgdb) p /x vstate->dtvs_dynvars.dtds_base $22 = 0xc74c0000 (kgdb) p /x vstate->dtvs_dynvars.dtds_size $23 = 0x100000 -------------------------------------------------------------------------------------------- Here is o/p for root%dtrace -l -f kernel_nudge_client -v ID PROVIDER MODULE FUNCTION NAME 58 fbt kernel kernel_nudge_client entry Probe Description Attributes Identifier Names: Private Data Semantics: Private Dependency Class: Unknown Argument Attributes Identifier Names: Private Data Semantics: Private Dependency Class: ISA Argument Types args[0]: kernel_client * args[1]: int -- Shrikanth R K