From nobody Mon Feb 27 12:17:16 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 4PQKJ04HsLz3v3NV for ; Mon, 27 Feb 2023 12:17:20 +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 4PQKHz5KPwz4Lv1; Mon, 27 Feb 2023 12:17:19 +0000 (UTC) (envelope-from christos@freebsd.org) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=margiolis.net header.s=default header.b=PBzSsbCw; 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=tQAOChExuUNj vYdPm7+EN7fnAKGds+YSyFB2VfRz5+s=; h=subject:cc:to:from:date; d=margiolis.net; b=PBzSsbCwv2d8/Ajb/uAeCnY+XKaqxOMiDGr5MgYwkX2v1v8QkzL 84nJr1h3pVvrSGHstqDcFCFd3Qcu6AIw6Rz0J+DvPb3Zb1rtLoRokW5gtzjZSYTLsWTMQW nrY9isv6zNlzsWjP1vWQ6CErFo9UP3QJP9ond882MuPUdhjqoQ= Received: from pleb (ppp-94-66-59-44.home.otenet.gr [94.66.59.44]) by margiolis.net (OpenSMTPD) with ESMTPSA id 7eb124c6 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Mon, 27 Feb 2023 12:17:17 +0000 (UTC) Date: Mon, 27 Feb 2023 14:17:16 +0200 From: Christos Margiolis To: status-updates@freebsdfoundation.org Cc: freebsd-dtrace@freebsd.org, markj@freebsd.org, jrm@freebsd.org Subject: [Development report #3] Improve the kinst DTrace provider Message-ID: <20230227121716.bicoxxvlqit7ktb7@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_SHORT(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; 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)[4]; RCVD_TLS_ALL(0.00)[] X-Rspamd-Queue-Id: 4PQKHz5KPwz4Lv1 X-Spamd-Bar: -- X-ThisMailContainsUnwantedMimeParts: N I started implementing inline function tracing for kinst by making use of the dt_sugar framework in libdtrace. Contrary to how kinst expects a : tuple to create probes (e.g vm_fault:4), for inline functions is replaced by `entry` and `return`. For dt_sugar, `entry` or `return` in a kinst probe mean either of two things: 1) The user requested an entry/return probe but the function is not inline, in which case, the probe will be converted to an FBT one, so that we don't duplicate FBT's functionality in kinst. 2) The function is indeed an inline one, so dt_sugar will find all inline copies of this function and transform D syntax to create new kinst probes for each of them. So if the user requested a entry probe on inline function cam_iosched_has_more_trim_entry(), the resulting D script would look like: # dtrace -dn 'kinst::cam_iosched_has_more_trim:entry' dtrace:::ERROR { ((self->%error) = 0x1); } kinst::cam_iosched_get_trim:13 { } kinst::cam_iosched_next_bio:13 { } kinst::cam_iosched_schedule:40 { } dtrace: description 'kinst::cam_iosched_has_more_trim:entry ' matched 4 probes CPU ID FUNCTION:NAME 0 81502 cam_iosched_schedule:40 0 81501 cam_iosched_next_bio:13 2 81502 cam_iosched_schedule:40 1 81502 cam_iosched_next_bio:13 1 81503 cam_iosched_schedule:40 ^C Currently the code is pretty much a modified version of inlinecall(1)'s code (see previous emails) ported into dt_sugar. Below is the initial commit, it's still a work in progress and there are quite a few bugs (mainly `return` probes) that need fixing: https://github.com/christosmarg/freebsd/commit/bfa507dc22d3856de5af88d0dacaad0f0ab69406 Christos