From nobody Tue Dec 07 18:14:27 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 1ECB018B69CE; Tue, 7 Dec 2021 18:14:28 +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 4J7pNM4P0jz4YfC; Tue, 7 Dec 2021 18:14:27 +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 7683124750; Tue, 7 Dec 2021 18:14:27 +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 1B7IERTI047932; Tue, 7 Dec 2021 18:14:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1B7IERj7047931; Tue, 7 Dec 2021 18:14:27 GMT (envelope-from git) Date: Tue, 7 Dec 2021 18:14:27 GMT Message-Id: <202112071814.1B7IERj7047931@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: a8adbe528446 - stable/13 - arm64, powerpc: fix calculation of 'used' 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: a8adbe528446352a27e774c7c33bea027e7a7c15 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638900867; 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=xPOw0GM6SYZWerpWNnfiZjSACVjlq4pb1TFr5OqOjlo=; b=lx2UmCenEed69m/BOyWQsG/nYE1z9WfjvVgsHGhdZ7Ukn/fXfe1Pi9gq1V+i+pLs6hVr/V 1HXQREvLrLPB7BEYqbNnmB8L82LMapOMKSViTa3PXMLGtRca+8rZSOuHOremCYM7/7mPcr 8bseuwtDVHaX0n7vn7jN1IJ9E6A53v+NYOeMhJPGZRrn9gQSST3dgr/ku5jpMlsG3Cvreh cWA08PnzJlUxQkvbfWZndCNgE+qBRQ3maoNmyM7oGHVodajS396ql3yRsO+qinwniJstMu Cl0IHHT/Cp93rj1IU4Tu3q23sjjBxPQKiBHkPo7Ad2fblWtQRV3SBR5Lf1MIeg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638900867; a=rsa-sha256; cv=none; b=ClnfPm+JuJvtA4hz3r3StMjus1AfDSolKqbQ2f3dnlEJP8LWPGuplRgFGTab9PqNS/9BXQ RJD/iW057anfiZADJ6H1VSb1NA5hes4cxviCrAT1POpwp4R6d3yuM//pvI9fXY9rhg+5J6 feddd+vBCoGi9anoR6wwKFvlyC8IP9MgCzGVwe2tXpr1CSFInXgyVF2P76OvX5nLnD+pKD H8NV10Y0rgEqMntaweN3VEHKkYGyh8QGUdsaK5HmYExzsod/UrpqeTS4A2kcdEpyHYfmnG PvTSewbjsZ9SOdjlx42f39ma+H2jkaGOoiDNGEFUuFQmQvqrQbCsaCNAuJp0QA== 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=a8adbe528446352a27e774c7c33bea027e7a7c15 commit a8adbe528446352a27e774c7c33bea027e7a7c15 Author: Mitchell Horne AuthorDate: 2021-11-30 15:15:44 +0000 Commit: Mitchell Horne CommitDate: 2021-12-07 18:13:47 +0000 arm64, powerpc: fix calculation of 'used' in GET_STACK_USAGE We do not consider the space reserved for the pcb to be part of the total kstack size, so it should not be included in the calculation of the used stack size. MFC after: 1 week Sponsored by: The FreeBSD Foundation (cherry picked from commit b02908b051c897117ebbc3dcb55848383b17c435) --- sys/arm64/include/proc.h | 4 +--- sys/powerpc/include/proc.h | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/sys/arm64/include/proc.h b/sys/arm64/include/proc.h index bb933dc98241..b34581f0bd8b 100644 --- a/sys/arm64/include/proc.h +++ b/sys/arm64/include/proc.h @@ -60,9 +60,7 @@ struct syscall_args { #define GET_STACK_USAGE(total, used) do { \ struct thread *td = curthread; \ (total) = td->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb); \ - (used) = (char *)td->td_kstack + \ - td->td_kstack_pages * PAGE_SIZE - \ - (char *)&td; \ + (used) = td->td_kstack + (total) - (vm_offset_t)&td; \ } while (0) #endif diff --git a/sys/powerpc/include/proc.h b/sys/powerpc/include/proc.h index d4df3ccfefef..097891253009 100644 --- a/sys/powerpc/include/proc.h +++ b/sys/powerpc/include/proc.h @@ -74,9 +74,7 @@ struct syscall_args { #define GET_STACK_USAGE(total, used) do { \ struct thread *td = curthread; \ (total) = td->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb); \ - (used) = (char *)td->td_kstack + \ - td->td_kstack_pages * PAGE_SIZE - \ - (char *)&td; \ + (used) = td->td_kstack + (total) - (vm_offset_t)&td; \ } while (0) #endif