From nobody Tue Dec 07 18:19:37 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 3655718C0A65; Tue, 7 Dec 2021 18:19:38 +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 4J7pVK6q2Mz4b8B; Tue, 7 Dec 2021 18:19:37 +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 CA42F24659; Tue, 7 Dec 2021 18:19:37 +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 1B7IJbwg048430; Tue, 7 Dec 2021 18:19:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1B7IJbcO048429; Tue, 7 Dec 2021 18:19:37 GMT (envelope-from git) Date: Tue, 7 Dec 2021 18:19:37 GMT Message-Id: <202112071819.1B7IJbcO048429@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: 2bb54c1646c7 - stable/12 - i386: take pcb and fpu area into account in GET_STACK_USAGE 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/12 X-Git-Reftype: branch X-Git-Commit: 2bb54c1646c7f28460d18a21289587523ac6aef9 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638901178; 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=vKsz0Lv5njfehTXxup7fbXNrr/oFIvm9n4lOOlNWlCo=; b=Ojm4uvBfqjv5dA+N97Fpqe94vx8QKUd597dcP0NermVBSBX6Ou5bn92dG7LZYZNvjaKqq8 XOInJoIiWtg5PZwgbAjprZNbB+0CMk9tz+1IDlSOrKcFYKilr4fXeymjpQsoxCcdu/bWjr yY+kEeKe+JsaMUdCRFtsTjn72MkvHzewTkLpHhzoIT8L4ysz32tfy4xeEJgHTeTxKUUvM8 Ic7JebdsE2BPAZC04VWmCtOFjGUpFkgJzvxrx5Z/vJWpxxLSjxVCCqNWMlTObsoc2DgGnf yE5GmzTf/nkvnnILYqiDk81vQ3+QJ4o2Gk++l+hJjHDoHF56+zx6QBHpnX5YBw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638901178; a=rsa-sha256; cv=none; b=NMFrXP2pAVPLw1akmvUiDqwK+am3Kj1A9O+vz2KKW6I9Ny4eE5O7VY8Lk7NOdDiaxQDB7l 6rKs7/BK57f87Fjfhy2WmQkhLAmMEKjrSeM9uGg2/KeKGLBueVQsOYB0nHv/kmDeoLDstg nCsrnCtPaeQKO9yiDe+5oBAf5xL6rdva2iWM+C6mjgA8OPBFmUlz+h8w1ZSjNs1Ao/1jnh nY1qqWwlQbksCLE1gTeKTXlOT/uP/kCRC5ykltRqMYaY9kayKr5X3apVYXyc8Cs6hEsEdJ c+ZVtPypOshB99FAVc3OHDLDGF1GsBpNTc/aNBCz0bB/trfq4RxhDuZ5yvNxsw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=2bb54c1646c7f28460d18a21289587523ac6aef9 commit 2bb54c1646c7f28460d18a21289587523ac6aef9 Author: Mitchell Horne AuthorDate: 2021-11-25 15:54:33 +0000 Commit: Mitchell Horne CommitDate: 2021-12-07 18:15:58 +0000 i386: take pcb and fpu area into account in GET_STACK_USAGE On this platform, the pcb and FPU save area are allocated from the top of each kernel stack, so they should be excluded from the calculation of the total and used stack sizes. Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32581 (cherry picked from commit 8bc792b3845ecf64145fda7964a7b5cc54dea777) --- sys/i386/include/proc.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/i386/include/proc.h b/sys/i386/include/proc.h index 71b199603f51..f7b5db555c29 100644 --- a/sys/i386/include/proc.h +++ b/sys/i386/include/proc.h @@ -71,13 +71,13 @@ struct syscall_args { #ifdef _KERNEL +#include + /* Get the current kernel thread stack usage. */ #define GET_STACK_USAGE(total, used) do { \ struct thread *td = curthread; \ - (total) = td->td_kstack_pages * PAGE_SIZE; \ - (used) = (char *)td->td_kstack + \ - td->td_kstack_pages * PAGE_SIZE - \ - (char *)&td; \ + (total) = (vm_offset_t)get_pcb_td(td) - td->td_kstack; \ + (used) = (vm_offset_t)get_pcb_td(td) - (vm_offset_t)&td; \ } while (0) void set_user_ldt(struct mdproc *);