From nobody Tue Nov 30 15:16:19 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 F20FD18B654C; Tue, 30 Nov 2021 15:16:19 +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 4J3Qm31SyTz3J5d; Tue, 30 Nov 2021 15:16:19 +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 126C4183D3; Tue, 30 Nov 2021 15:16:19 +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 1AUFGJfK048234; Tue, 30 Nov 2021 15:16:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1AUFGJG2048233; Tue, 30 Nov 2021 15:16:19 GMT (envelope-from git) Date: Tue, 30 Nov 2021 15:16:19 GMT Message-Id: <202111301516.1AUFGJG2048233@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: b02908b051c8 - main - 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/main X-Git-Reftype: branch X-Git-Commit: b02908b051c897117ebbc3dcb55848383b17c435 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638285379; 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=agvHzUFKI2c+RkZfg8Zn+1D1WsjQWHahDr+x0gNSrhY=; b=vgeY1/s6mboM6MxZYHddfj61hBjmDBPFjvTtr6GUXlDh41St7/bTFyBGbrJNU6IQHm6bl9 AyosHYwwkpJy9/pT5ZQktAVsl5NClIG6Trgq73jL+wBDUZLlqNsTktIGjMkU/f1U4AM4q7 g9gzLI6MLOM4M+38FQMkBb5Ujlt53Wt3UPQ9erlH0jL+czuvIv9KiEPxsLx04IXX1mFSVv HsWpE3VM29nthEg8IpFxE/2DEDd4DyPZs5Uf4uXXfb+z11yXsziQiALOlMayK9Je2Sz2oh 6lbCjrtwxM3nqOJcoGgexzo8BzH1p/UFTASEIrF5FE5IUMPItdY34oK1qD6OBA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638285379; a=rsa-sha256; cv=none; b=wTgOVTisW0JWCrmfs9pcWTtJOC1RCXYg14oDaPDTW3E3nDL9+n1YzjSC/9uS4O2kTTV/9l KOI6ezxHXiPC2lDGu8HknnRmnTdHs20w8ruNmG/DoLp+9xR55eMnUzTK/yUpuEJdP3T517 qI0pqTYl0WXtLJj4HIZC3wqqPJgRVqo/5NyVs94Z+Lm+BpaNDDIgKZgHAMwcdPXAtpJoP8 KOLBmpSPiBRYuOnjMKV1Ddv+luh7S/bIgaZPkmIfq6I7qKBI2RqyHK2A5tMYnbIq891Ro6 V+VPLC43XgGWLoStwarlQ5P5j0TeB9DImmW8PDJqTPWpKvWG6Ezalzqr+7pJ9g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=b02908b051c897117ebbc3dcb55848383b17c435 commit b02908b051c897117ebbc3dcb55848383b17c435 Author: Mitchell Horne AuthorDate: 2021-11-30 15:15:44 +0000 Commit: Mitchell Horne CommitDate: 2021-11-30 15:15:44 +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 --- 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 43200fd115fc..95485483084a 100644 --- a/sys/arm64/include/proc.h +++ b/sys/arm64/include/proc.h @@ -62,9 +62,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 aac4e66b39fc..1dd52895bb9e 100644 --- a/sys/powerpc/include/proc.h +++ b/sys/powerpc/include/proc.h @@ -75,9 +75,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