From nobody Tue Dec 07 18:19:38 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 70A8B18C0C5F; Tue, 7 Dec 2021 18:19:39 +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 4J7pVM0Q75z4bN3; Tue, 7 Dec 2021 18:19:39 +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 E417F2465A; Tue, 7 Dec 2021 18:19:38 +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 1B7IJcOp048454; Tue, 7 Dec 2021 18:19:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1B7IJcre048453; Tue, 7 Dec 2021 18:19:38 GMT (envelope-from git) Date: Tue, 7 Dec 2021 18:19:38 GMT Message-Id: <202112071819.1B7IJcre048453@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: eb1ad1b3b93e - stable/12 - 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/12 X-Git-Reftype: branch X-Git-Commit: eb1ad1b3b93ece25a049ce8efe73bc6caff1fd3d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638901179; 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=hlCbbvs+jFsJ1+8Mplrp6/1+yBf1XgbX4vf9qlslRiU=; b=KdVWSBquHpO841MyJuwwDE7ZhlOEZ9r4oZ8h9sM8ojA9Fp5FMwR1Dt8o29VroJvjsw5JNX vLiS+Lazd9U47UmDQYKJqwpEtcOr+kznjpAn0NHFR+H1v68HJWyANHJ9e3y3KdUk8yTB+C Z2TGvkiNCwjUqe/aYyToqkhZGWGeAhmS6/JshoXJQy6370a/y1t434EQchWUw17sv4dCFz G2kE3+JP23PjirBFb5mTiq/qRfxdpCwCMfZSknxTSIWWYa+IvtAolML5tChai0wJlKFkva oocsTlplbgJfIaIz55qgorKMncMc8IzOJax1ohwZJFIJIxNcb8k+PfXHN9FShg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638901179; a=rsa-sha256; cv=none; b=w7rIJxfo06FQGVhaepdpzYQ8cD+WLhxuXejFVIMF7nWv23ynSO160SpqTkuSUXjlWfTdfo OnkBQakqj6XT7dvYg3N2yRtoQex62i8JpkFo9DQYPM6aBQP32Z3pDrZnKtH1Eh79p0DNgu 9hvjkSFXdPb2lYMoZuFlZnSndRCyZTnm//lj7zGq0ZGODDQTUV7tQtVbW+dEj0vgWw56oi AYZ4SHZS9sEmli7HUeQ5eY/mbERx2q6Ya9dLt3nNlxl6Zi/xFxblKx0M9p9wfP8tmbaQ24 yyGUXCFq/RYB6GCfYP6m7ZpFfz22cyIV4unmnB16tulppqyVzlwAQfR8LxAIcw== 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=eb1ad1b3b93ece25a049ce8efe73bc6caff1fd3d commit eb1ad1b3b93ece25a049ce8efe73bc6caff1fd3d Author: Mitchell Horne AuthorDate: 2021-11-30 15:15:44 +0000 Commit: Mitchell Horne CommitDate: 2021-12-07 18:15:58 +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 52d60b00dcfb..2dcd3760714d 100644 --- a/sys/arm64/include/proc.h +++ b/sys/arm64/include/proc.h @@ -61,9 +61,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 d01b6cda4dcd..c86d935f471b 100644 --- a/sys/powerpc/include/proc.h +++ b/sys/powerpc/include/proc.h @@ -70,9 +70,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