From nobody Tue Jan 24 16:15:46 2023 X-Original-To: freebsd-dtrace@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4P1XBw5Yhhz30yYd for ; Tue, 24 Jan 2023 16:15:52 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4P1XBw27pwz3HZ3 for ; Tue, 24 Jan 2023 16:15:52 +0000 (UTC) (envelope-from markjdb@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-il1-x12a.google.com with SMTP id g16so1753542ilr.1 for ; Tue, 24 Jan 2023 08:15:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=N38FsS8tSnAs6n3VIGUS211qVYaLm5Kj2/WypwExfwI=; b=N5ihvJHhArkvQWeFWv9opK1ATLV9h10CIzAvIkWukOJo6x5UNOdEDIT/SFLue7W1bj 4KECcMwpjlLx/iY0ntyg4JZ2pPNI40u1Xo00vCblsSS5zkDrrbl/fQOWjK5QpS1YLcxq s0rMjPJfjiP+TGptB5Yi9YWcS3rQSoFA8q3kM8Bstk7YvzTtd6in/k/j1d4grFS5hesu id66/uj256iUJZoUf4hyZ0Km048oUatQWU6j2+twWUldOGy4BlQUcdEQ0ZpbdRrv3Niu t+OgPGxGkuy6qysQRPhdZkDcEyhS5NS5b5DkZpnDBaUw2rH32yt1PZxq00V2+NVzIibY lFhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N38FsS8tSnAs6n3VIGUS211qVYaLm5Kj2/WypwExfwI=; b=Hc5WlfacXZES1fKfYBxo3vlG9oBZg+/rR4PFDJObsjWNKK87Pt8N+Bz0OeW0w+Fffa e4gHhAeBu7gLsLxX/sIKb3Tbirij74E6VDXJXzAp7HmRtaf7LXy9wYNk4o9aWa1irEgQ NxcMAh0BLP3tNQT3PvRzoP05oV8AejnAbbygnov4+Nss+43jDfcsF+dF7WmCrMfosj2V xxRIi9FtlrGZr4MiNhGnTg4ytrAdKqRCb5szHdYWSOzRysUTHlKOgQ/qoPBvAuJO6mhD P7kkrj+YSNIzgYiHtrb6pI21DQuL5Ve9dfPdnQwEyMVd0CAY1ZXmIc7u0jJMrna5x+XT z6Ww== X-Gm-Message-State: AFqh2kqYZh6pNACgJewKrfo1PbYXfvbz5l1t38LOC0bYAQ8iP8bgHyvh 6VpuXx7eGMO/t0KaFEUZsmPB6WZY5gw= X-Google-Smtp-Source: AMrXdXub2pfVCAqB1WryMiOnY25GEERaNefoEwuKlOHjrKw1zTuG9swogOp+XjOqq21FQdVEP5dWjw== X-Received: by 2002:a92:c048:0:b0:30c:54a1:e5d8 with SMTP id o8-20020a92c048000000b0030c54a1e5d8mr22225799ilf.30.1674576951011; Tue, 24 Jan 2023 08:15:51 -0800 (PST) Received: from nuc (192-0-220-237.cpe.teksavvy.com. [192.0.220.237]) by smtp.gmail.com with ESMTPSA id bq9-20020a056638468900b003a7cb4337c4sm777050jab.137.2023.01.24.08.15.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Jan 2023 08:15:50 -0800 (PST) Date: Tue, 24 Jan 2023 11:15:46 -0500 From: Mark Johnston To: Martin Cracauer Cc: freebsd-dtrace@freebsd.org Subject: Re: DTrace - capturing two userspace strack frames on top of system call Message-ID: References: List-Id: A discussion list for developers working on DTrace in FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-dtrace List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-dtrace@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4P1XBw27pwz3HZ3 X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On Mon, Jan 23, 2023 at 04:54:05PM -0500, Martin Cracauer wrote: > Mark Johnston wrote on Mon, Jan 23, 2023 at 11:52:12AM -0500: > > On Sun, Jan 22, 2023 at 10:04:50PM -0500, Martin Cracauer wrote: > > > Actually the error only appears on arm64 for me. I moved the script > > > to amd64 and it works as I thought. > > > > Support for userspace tracing on arm64 is definitely less mature than on > > amd64, so this isn't too surprising, unfortunately. > > > > Is the problem reproducible with a trivial program compiled with > > -fno-omit-frame-pointer? > > Yes: > $ gcc -O2 -fno-omit-frame-pointer -Wall -Werror -o crasparse crasparse.c > # dtrace -n 'syscall::write*:entry /arg1/ { @traces[ustack()] = count(); }' -c ./crasparse > dtrace: error on enabled probe ID 1 (ID 57136: syscall:freebsd:writev:entry): invalid address (0x0) in action #2 > [...] > > Should I make a bugzilla entry out of this? Yes please, that would be helpful. From nobody Mon Feb 13 15:03:36 2023 X-Original-To: freebsd-dtrace@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PFnfh1TRCz3rF0f for ; Mon, 13 Feb 2023 15:03:56 +0000 (UTC) (envelope-from christos@freebsd.org) Received: from margiolis.net (mail.margiolis.net [95.179.159.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4PFnff6pPWz4Kvw; Mon, 13 Feb 2023 15:03:54 +0000 (UTC) (envelope-from christos@freebsd.org) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=margiolis.net header.s=default header.b=eXA5WSKi; spf=softfail (mx1.freebsd.org: 95.179.159.8 is neither permitted nor denied by domain of christos@freebsd.org) smtp.mailfrom=christos@freebsd.org; dmarc=none DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=default; bh=ndDQk9IG3Zbc lB3lKfm2oYJilW/S74lr3LXz581DUwY=; h=subject:cc:to:from:date; d=margiolis.net; b=eXA5WSKiTFyhTbrcM6fyIVIzuVym/2gQvybqmQD4iylXO05dwm7 tLpCmoA/9PHHvBdBYtUAhoZZPdhqHn//V+eHNNZ1NT+zFago8XlNy2LMEb1MveGb8bunKJ hVyc+tERwDYq2w41PT16ALdvO2tHU7jxluqqFdMAZbENFn7LG8= Received: from pleb (ppp-94-66-59-44.home.otenet.gr [94.66.59.44]) by margiolis.net (OpenSMTPD) with ESMTPSA id 8f3e161d (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Mon, 13 Feb 2023 15:03:46 +0000 (UTC) Date: Mon, 13 Feb 2023 17:03:36 +0200 From: Christos Margiolis To: status-updates@freebsdfoundation.org Cc: freebsd-dtrace@freebsd.org, markj@freebsd.org Subject: [Development report #1] Improve the kinst DTrace provider Message-ID: <20230213150336.x2pugvnzdfpgvspr@pleb> List-Id: A discussion list for developers working on DTrace in FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-dtrace List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-dtrace@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spamd-Result: default: False [-2.80 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-0.999]; MID_RHS_NOT_FQDN(0.50)[]; R_DKIM_ALLOW(-0.20)[margiolis.net:s=default]; MIME_GOOD(-0.10)[text/plain]; MLMMJ_DEST(0.00)[freebsd-dtrace@freebsd.org]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DKIM_TRACE(0.00)[margiolis.net:+]; ASN(0.00)[asn:20473, ipnet:95.179.144.0/20, country:US]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DMARC_NA(0.00)[freebsd.org]; RCVD_COUNT_TWO(0.00)[2]; FREEFALL_USER(0.00)[christos]; ARC_NA(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; FROM_HAS_DN(0.00)[]; TO_DN_NONE(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; RCVD_TLS_ALL(0.00)[] X-Rspamd-Queue-Id: 4PFnff6pPWz4Kvw X-Spamd-Bar: -- X-ThisMailContainsUnwantedMimeParts: N Since February 01, 2023, I've been working on a FreeBSD Foundation sponsored project to extend the kinst DTrace provider. kinst is a new DTrace provider created by me and Mark Johnston (markj@) that allows for arbitrary instruction tracing within a kernel function. kinst probes take the form `kinst:::`, where is the specific instruction. The offsets can be obtained from the function's disassembly using kgdb(1). If no is specified, kinst will trace all instructions in that function. It is part of the base system from FreeBSD 14.0 onwards. This project's goals are to implement inline function tracing, port kinst to riscv and/or arm64, as well as a few additions to the D language. So far, I've been working on a standalone program [1], which uses the DWARF Debugging Standard [2] to find all call sites of a given inline function. I've published some notes [3] on how we can extract useful information about inline functions. The program takes an inline function name and a debug file and outputs all call sites in the following format: compilation_unit1_definition:line [lower_bound - upper_bound] inline_call1_file:line [lower_bound - upper_bound] inline_call2_file:line ... compilation_unit2_definition:line [lower_bound - upper_bound] inline_call1_file:line ... For example: $ inlinecall critical_enter /usr/lib/debug/boot/kernel/kernel.debug /usr/src/sys/sys/systm.h:175 [0xffffffff8086f47a - 0xffffffff8086f48b] /usr/src/sys/sys/buf_ring.h:80 /usr/src/sys/sys/systm.h:175 [0xffffffff808b0b4a - 0xffffffff808b0b5b] /usr/src/sys/sys/buf_ring.h:80 /usr/src/sys/sys/systm.h:175 [0xffffffff80955264 - 0xffffffff80955275] /usr/src/sys/sys/smr.h:111 /usr/src/sys/sys/systm.h:175 [0xffffffff80a051f4 - 0xffffffff80a05208] /usr/src/sys/kern/kern_malloc.c:431 [0xffffffff80a0514c - 0xffffffff80a0515b] /usr/src/sys/kern/kern_malloc.c:388 ...more This program is more of an exercise in libdwarf. Parts of the code will be added to libdtrace in order to implement inline tracing. Christos [1] https://git.sr.ht/~crm/inlinecall [2] https://dwarfstd.org/ [3] https://margiolis.net/w/dwarf_inline/