From nobody Tue Dec 14 16:34:03 2021 X-Original-To: dev-commits-src-all@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 9E47518E182E; Tue, 14 Dec 2021 16:34:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JD3qH2kWcz3gxr; Tue, 14 Dec 2021 16:34:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3D64733DB; Tue, 14 Dec 2021 16:34:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1BEGY3i7080393; Tue, 14 Dec 2021 16:34:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BEGY3lD080392; Tue, 14 Dec 2021 16:34:03 GMT (envelope-from git) Date: Tue, 14 Dec 2021 16:34:03 GMT Message-Id: <202112141634.1BEGY3lD080392@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: e3ccf4f9dee9 - main - Fix dtrace fbt return probes on arm64 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e3ccf4f9dee9ae39774639407264199a07fa41ff Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639499643; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8T8e+nmLIi4uEZV33M+HjdY4OwSucnu/yKjQ/H00+1I=; b=hCiaZs+JDNujwSR5/R6tOttDBsnfdqP8N4UADJmPF2GO7A5Gbf1Ylm+yChen8KYbGhfWe6 W6P817aPKczzMZl/9Q5k8QkuKGLqd86RI5B3sB3Us8GG+cQIC3UnN72VVbGBO9noi9O62r +yJGDnTTdHx3+ty0Fe1azBHxvQnJ0Jk4rPpgmovv9mPOGgW1JhIfWyfrgaEU4yAuVPQwgv YyJZG0aUUfWs2ydVnjR6rS06Wvd8oUYAc82okZ3ylcodUpVMuFQz1jECiGHAG0XdFf8xuX NzCyGzR+xhglCVeXCay1W6UdVBHRV7s8zcOszd9wf0tG50pl30yDsBb5eWM+aw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639499643; a=rsa-sha256; cv=none; b=TX33VHEZSQ6I1ZzHgsdNDwA1EyIa4h30JpSabD49OCf1qV3H692aGoSI1kDCaBS5/nIgRM dHwuO4r4t9IUtjzOIAHOOZBfu1/ZlO5UX5hCHKMuSUKiChsHE9HrtgGuvdOXlgULjrvbqj zW+JaZH68ge7nlr3dHT4lX/25lbLEHq3MzR5KH4Lb6UIfDBAcHdETrcP9lKAEDND9CXen9 UvH0BdCcTytgdkp7PKCsyov6OlcXwaOoUYuPNnM5J4jMG25ffByOfdOyaBgvHDim3wgAR7 rYDO777k3tVRMksQZ7HNDbNsWJO/E1eWBQu3zTT1FGMc/zEgmNgtGP72y2oGDA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=e3ccf4f9dee9ae39774639407264199a07fa41ff commit e3ccf4f9dee9ae39774639407264199a07fa41ff Author: Andrew Turner AuthorDate: 2021-12-14 15:49:07 +0000 Commit: Andrew Turner CommitDate: 2021-12-14 16:32:12 +0000 Fix dtrace fbt return probes on arm64 As with arm and riscv fix return fbt probes on arm64. arg0 should be the offset within the function of the return instruction and arg1 should be the return value. Reviewed by: kp, markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33440 --- sys/cddl/dev/dtrace/aarch64/dtrace_subr.c | 2 +- sys/cddl/dev/fbt/aarch64/fbt_isa.c | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c b/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c index 58d33511560b..74b3bf7ed7d1 100644 --- a/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c +++ b/sys/cddl/dev/dtrace/aarch64/dtrace_subr.c @@ -270,7 +270,7 @@ dtrace_invop_start(struct trapframe *frame) int tmp; int i; - invop = dtrace_invop(frame->tf_elr, frame, frame->tf_elr); + invop = dtrace_invop(frame->tf_elr, frame, frame->tf_x[0]); tmp = (invop & LDP_STP_MASK); if (tmp == STP_64 || tmp == LDP_64) { diff --git a/sys/cddl/dev/fbt/aarch64/fbt_isa.c b/sys/cddl/dev/fbt/aarch64/fbt_isa.c index 4d22f1d584d3..d00aabf0cc81 100644 --- a/sys/cddl/dev/fbt/aarch64/fbt_isa.c +++ b/sys/cddl/dev/fbt/aarch64/fbt_isa.c @@ -56,16 +56,21 @@ fbt_invop(uintptr_t addr, struct trapframe *frame, uintptr_t rval) fbt = fbt_probetab[FBT_ADDR2NDX(addr)]; for (; fbt != NULL; fbt = fbt->fbtp_hashnext) { - if ((uintptr_t)fbt->fbtp_patchpoint == addr) { - cpu->cpu_dtrace_caller = addr; + if ((uintptr_t)fbt->fbtp_patchpoint != addr) + continue; + cpu->cpu_dtrace_caller = addr; + + if (fbt->fbtp_roffset == 0) { dtrace_probe(fbt->fbtp_id, frame->tf_x[0], frame->tf_x[1], frame->tf_x[2], frame->tf_x[3], frame->tf_x[4]); - - cpu->cpu_dtrace_caller = 0; - return (fbt->fbtp_savedval); + } else { + dtrace_probe(fbt->fbtp_id, fbt->fbtp_roffset, rval, + 0, 0, 0); } + cpu->cpu_dtrace_caller = 0; + return (fbt->fbtp_savedval); } return (0); @@ -216,6 +221,7 @@ again: fbt->fbtp_rval = DTRACE_INVOP_B; else fbt->fbtp_rval = DTRACE_INVOP_RET; + fbt->fbtp_roffset = (uintptr_t)instr - (uintptr_t)symval->value; fbt->fbtp_savedval = *instr; fbt->fbtp_patchval = FBT_PATCHVAL; fbt->fbtp_hashnext = fbt_probetab[FBT_ADDR2NDX(instr)];