From nobody Tue Dec 07 18:14:26 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 D1F0D18B6C08; Tue, 7 Dec 2021 18:14:26 +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 4J7pNL3XW5z4YSm; Tue, 7 Dec 2021 18:14:26 +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 5A80A246E6; Tue, 7 Dec 2021 18:14:26 +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 1B7IEQ6F047906; Tue, 7 Dec 2021 18:14:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1B7IEQWY047905; Tue, 7 Dec 2021 18:14:26 GMT (envelope-from git) Date: Tue, 7 Dec 2021 18:14:26 GMT Message-Id: <202112071814.1B7IEQWY047905@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: 8dba6a20205d - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: 8dba6a20205dc277aa02fa8c7c56a04cc3715dcd Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638900866; 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=MQ3sn9nKNtzDF3CMBV5+lMZNnbPkWkiPE7ibDzz/6V8=; b=hiC1juqZ4XJuj3VBv40cQpkZLw/4LQaby6wf6+xAG+VGf32fi8EczTXvMnJDGjmK04taBy YLHpeFKict6PK3UyEX7HDC8qZtl32ev1lsMpvnFlUieGI0YqcoMSG9WXNWpQI5GVhITvjC 4OlYDiGtKg09lS5dJlDsAbtCYmhDFIqlDgr9bcizVOQHF3s4ogV8dyXjrsGlePBNuZF3hd 4TBMgX86zNl9VAf4gPWtg/ZJQBDv7JwsCNdH4fJit8yXMkkpd1uR7uHLQ0uexBWVG2EQGU BZEl00q3mKuy3fmmKUmRHhwjbQ8iEHXyzJtPfLGHXpq6zqzLp+oi/uZ+Wt6Krw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638900866; a=rsa-sha256; cv=none; b=NGbkP55rRjhJEbMyWptdWngGMMgbKwtKVCIU0rXZlghKkSMIWiT1FzyXNO71I90I9pitet jsuoBIIbwx+Q+469h7WYLGNYre9lYu31T8Ovxjnm/9PAdVciq/thpy7YnmlZAk2sL7BXqB OactLnHKxKWcpMm05zuLV0FioR3Qy9YvzeLeX2TXuNlaz8oRj1zttcWu35Z5FS8XaUIfSw GLKfPFvHjtA1JePdoTAV+FAdPnDfNAd+xr4atuTl+DnFKvxH4Q1jLiZ9wzr2sgphJKyt/V YaJHgTzGbZ3K0CxHD6hdzgjjwnMBeZQZdiWfZ43ltj2rqfYqAUc5IypLHnPtDg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=8dba6a20205dc277aa02fa8c7c56a04cc3715dcd commit 8dba6a20205dc277aa02fa8c7c56a04cc3715dcd Author: Mitchell Horne AuthorDate: 2021-11-25 15:54:33 +0000 Commit: Mitchell Horne CommitDate: 2021-12-07 18:13:46 +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 2950946ff155..4be836886b21 100644 --- a/sys/i386/include/proc.h +++ b/sys/i386/include/proc.h @@ -70,13 +70,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 *);