From nobody Fri Jul 07 19:25:05 2023 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 4QyNdZ60C0z4lVy9; Fri, 7 Jul 2023 19:25:06 +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 4QyNdZ1mFDz3q4v; Fri, 7 Jul 2023 19:25:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688757906; 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=ArK7XRQ/RgzVxOGVnhyJJ3NkJuQknzkyen3lNniamuc=; b=mkNfItwBcvfm9pn2D8DDqLuH0Ou6MXwlWMd/cOy3FN1Zha7mmGuqJ1N017Fgf30owxPyjl R4dwBCmChU08zEm7Ffw7HWOK7cQccTVOBx4pn/DGQYM46V+/W+UPlEbSKwykQC3Lr3WYNh I6BYbAbQ8tsshASHYB0xZkap669c28S3HupEyQYie/uFskedGC1ks8gnYDKmdrImnK1eZ5 pyaVaqHxrozlWe/2gp3CYyTjPHCfcAegn+smB28DaBb+N2vZvfzRDKZuzzQxrgx6IgE1eF IIZpOatbkLJ84FauHX7ylstoIqtiVFciknucg0BWR3aDVk8rtMwDN1xikagDHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1688757906; 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=ArK7XRQ/RgzVxOGVnhyJJ3NkJuQknzkyen3lNniamuc=; b=WzqXNt7QKA/61w0+Qf6JEEORU23TrJN6RBSpRw+6o6zNqRrA68M1xizJAC/0W5cqFqP4xC 0hTWfy6FCAXY893zGdxAwS9LFLQbgGIY4IDAU29GtwcWEQOfegXlrK4Rwlp/0sS5Vz6Kk9 CzvZz+mMjB9A0GQon0EDAWTQuBAbeuCJjbdv2YnKYsm/J0mBzjdGVDOI36tcbb2PGzhpHg PuxszpHoERKLolJopmn/btKIdtYpsReLYN2CJ3MqpEx4LsHKxBsfcSz6ujnJiMpr7kOGdY p0oAvJQUiQ6xKkV+tNx2KTgB5bJLqxXg16DqY/NpSl2+GcXdTDdLE8nxGeEwRA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1688757906; a=rsa-sha256; cv=none; b=UqVG25J9t53Nmv8yAKM4KhD9rC89UPmdIJFsp+QbsBaFU9CxY5mdwnVfvvRxoqMBP0TjA3 Jyy3ai/mNDvPze0i5u6ajpFqo+XPzOoSUstAynVwVFc8GnttZ5HYduBcpSqNaK35zNvMQ+ CazEun+N1bBJMdIqfnpiRflefWXBYYeJ4Uo2dp2HgL0i5dZRNROQLew6ofMUNdAzMf4BRW OWBL21BDqc82riSP/YuaAaRRY/oIacBUlaJUTu64PAsspfjUGHb4KAREHQBTENhaexJiX/ 0LUwXBZSok75i02UCoqoSeJfT9a1Mj+9Y1zORe3qqET72KIqeT44fDPjO7kg3A== 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 4QyNdZ0XgWzqvC; Fri, 7 Jul 2023 19:25:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 367JP5fE062330; Fri, 7 Jul 2023 19:25:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 367JP5p7062329; Fri, 7 Jul 2023 19:25:05 GMT (envelope-from git) Date: Fri, 7 Jul 2023 19:25:05 GMT Message-Id: <202307071925.367JP5p7062329@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: dfea72b70f3f - stable/13 - riscv: improve KTR_TRAP trace entries 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: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dfea72b70f3fd83426d71252fa33f8f04b3d90c9 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=dfea72b70f3fd83426d71252fa33f8f04b3d90c9 commit dfea72b70f3fd83426d71252fa33f8f04b3d90c9 Author: Mitchell Horne AuthorDate: 2023-06-20 14:52:26 +0000 Commit: Mitchell Horne CommitDate: 2023-07-07 19:20:51 +0000 riscv: improve KTR_TRAP trace entries For more informative records of exceptions, include key details such as the exception code and stval register contents. Remove the curthread argument as it is redundant (saved with every ktr entry), and the trapframe as it is somewhat meaningless. Add a new KTR_TRAP trace record for interrupts. Reviewed by: markj, jhb MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40584 (cherry picked from commit 7756232199adf60343ae0b940e2b27fe363905bc) --- sys/riscv/riscv/intr_machdep.c | 3 +++ sys/riscv/riscv/trap.c | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/sys/riscv/riscv/intr_machdep.c b/sys/riscv/riscv/intr_machdep.c index d84f4ea1cb91..1ee2c0984205 100644 --- a/sys/riscv/riscv/intr_machdep.c +++ b/sys/riscv/riscv/intr_machdep.c @@ -163,6 +163,9 @@ riscv_cpu_intr(struct trapframe *frame) active_irq = frame->tf_scause & SCAUSE_CODE; + CTR3(KTR_TRAP, "%s: irq=%d, umode=%d", __func__, active_irq, + TRAPF_USERMODE(frame)); + switch (active_irq) { case IRQ_SOFTWARE_USER: case IRQ_SOFTWARE_SUPERVISOR: diff --git a/sys/riscv/riscv/trap.c b/sys/riscv/riscv/trap.c index 4da6c9d21502..9e75f0e0530d 100644 --- a/sys/riscv/riscv/trap.c +++ b/sys/riscv/riscv/trap.c @@ -292,8 +292,8 @@ do_trap_supervisor(struct trapframe *frame) return; #endif - CTR3(KTR_TRAP, "do_trap_supervisor: curthread: %p, sepc: %lx, frame: %p", - curthread, frame->tf_sepc, frame); + CTR4(KTR_TRAP, "%s: exception=%lu, sepc=%lx, stval=%lx", __func__, + exception, frame->tf_sepc, frame->tf_stval); switch (exception) { case SCAUSE_LOAD_ACCESS_FAULT: @@ -366,8 +366,8 @@ do_trap_user(struct trapframe *frame) } intr_enable(); - CTR3(KTR_TRAP, "do_trap_user: curthread: %p, sepc: %lx, frame: %p", - curthread, frame->tf_sepc, frame); + CTR4(KTR_TRAP, "%s: exception=%lu, sepc=%lx, stval=%lx", __func__, + exception, frame->tf_sepc, frame->tf_stval); switch (exception) { case SCAUSE_LOAD_ACCESS_FAULT: