From nobody Sat May 25 17:25:13 2024 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 4Vmph957tGz5LDTn; Sat, 25 May 2024 17:25:13 +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 4Vmph93QFjz4V1j; Sat, 25 May 2024 17:25:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716657913; 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=xjx72SWzHu/MKRjAR0YMIe2eAgbSGoSG6Hr890+/g6U=; b=k1ywi9ugHcGoVgsvyJhDqQEklMMsSKMuUx2OSxbg7Ra6w8ci8Mz2YSxV+T4/UZBV5GQ4ba mqKo5TccfTR0SdS/pH4gynJztVjsyVO77txKlv4PkstejTHDkgvrfljlh8Eg52Ya9K8OTN c+0OWfD7Plp00+30iSwbbM1zo5cAwALNrgJLNw8vEsnAVw/6puJglI1Z4Es254UGh24NMa PWodTL7SdBT5S9cE+EJ+Ma4gsnL+sDWRUKV+w9g4j2GeAi4CtI5HKjoOSJAj4A12hAU/Go Nwaeqsg7afphU08ztE4vr3cg147W05HKCzTGjArIhMeLAnDwFt5KkzDTxXSqLg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1716657913; a=rsa-sha256; cv=none; b=pqcPGHGP2E4ofq+dwQrC2XAphcZDIcm3jAevln7etTJwXuL2D0CNuN+tbJLlw/SLV31hvC mhSFt9XXwoNLMD3ndfrMZcrZEp/J6KLFslcTPlqRFP6ZuO6U94nzLND8S5AzAKzIMDdKtk he7KLsegceCpP4ULnPy2B1H+BRqPUa2R9hxOvvtmS0oRAWc9PqzaSRHFFgNRTP3xp1BhPn 87UCiU/HPx0DDJbrKQw2uVcU0Cq2I8vJ3oPVF2RPW2gSG8p5yrqMRVSGHP9fE/degy3qQQ hrpbyDvFQ3qyGU4lvPHRis3dVwQZfmqlFhKtu6yz4GM87zKWniqiopci5pgUBw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716657913; 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=xjx72SWzHu/MKRjAR0YMIe2eAgbSGoSG6Hr890+/g6U=; b=AHQiv9TnnluiE2g6tk4aGOKU57E2UMFKMFG1qhM7ok4o9PRgemm8+YDPhnqpwrBZrSwiwv 07h9FwT5a0+9E7cMp3A7/Tz7Jn6uA9E1MhpeXwvLgsTF0opzHFZZBzDVF+v0gZ2CM6HLs5 ITcTcWvH0MY7wf+c0ZHR7U6iRFFIQ2Su03oJ5+3nYDAFOOO9uODA6zPA8oCFdA+E59GQfm Fj7A0LQ1eDM2PAptYBO1lKnRhrihbGSGU/wybe7SBi0k7KeIG+m2K00aSL2FTvDDfEWyPB SGyqCbALhH4efcFiOoEP7fda9OYhEmAtquGCZjbbhEYFdFT+IMgvs92mQjEHdg== 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 4Vmph92xvjzQdC; Sat, 25 May 2024 17:25:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44PHPDIu026695; Sat, 25 May 2024 17:25:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44PHPD4f026692; Sat, 25 May 2024 17:25:13 GMT (envelope-from git) Date: Sat, 25 May 2024 17:25:13 GMT Message-Id: <202405251725.44PHPD4f026692@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bojan =?utf-8?Q?Novkovi=C4=87?= Subject: git: 0a44b8a56d23 - main - vm: Simplify startup page dumping conditional 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bnovkov X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0a44b8a56d23e24b05471ddb038b7dd30b149efe Auto-Submitted: auto-generated The branch main has been updated by bnovkov: URL: https://cgit.FreeBSD.org/src/commit/?id=0a44b8a56d23e24b05471ddb038b7dd30b149efe commit 0a44b8a56d23e24b05471ddb038b7dd30b149efe Author: Bojan Novković AuthorDate: 2024-05-03 17:53:56 +0000 Commit: Bojan Novković CommitDate: 2024-05-25 17:24:55 +0000 vm: Simplify startup page dumping conditional This commit introduces the MINIDUMP_STARTUP_PAGE_TRACKING symbol and uses it to simplify several instances of a complex preprocessor conditional for adding pages allocated when bootstraping the kernel to minidumps. Reviewed by: markj, mhorne Approved by: markj (mentor) Differential Revision: https://reviews.freebsd.org/D45085 --- sys/amd64/include/vmparam.h | 3 ++- sys/arm/include/vmparam.h | 1 + sys/arm64/include/vmparam.h | 1 + sys/i386/include/vmparam.h | 1 + sys/powerpc/include/vmparam.h | 2 ++ sys/riscv/include/vmparam.h | 1 + sys/vm/uma_core.c | 6 ++---- sys/vm/vm_page.c | 12 +++++------- 8 files changed, 15 insertions(+), 12 deletions(-) diff --git a/sys/amd64/include/vmparam.h b/sys/amd64/include/vmparam.h index e5155a7c7d47..93c2648e8fac 100644 --- a/sys/amd64/include/vmparam.h +++ b/sys/amd64/include/vmparam.h @@ -294,7 +294,8 @@ /* * Need a page dump array for minidump. */ -#define MINIDUMP_PAGE_TRACKING 1 +#define MINIDUMP_PAGE_TRACKING 1 +#define MINIDUMP_STARTUP_PAGE_TRACKING 1 #endif /* _MACHINE_VMPARAM_H_ */ diff --git a/sys/arm/include/vmparam.h b/sys/arm/include/vmparam.h index 4ad42cfbe16b..15807923cefb 100644 --- a/sys/arm/include/vmparam.h +++ b/sys/arm/include/vmparam.h @@ -200,5 +200,6 @@ extern vm_offset_t vm_max_kernel_address; * Need a page dump array for minidump. */ #define MINIDUMP_PAGE_TRACKING 1 +#define MINIDUMP_STARTUP_PAGE_TRACKING 0 #endif /* _MACHINE_VMPARAM_H_ */ diff --git a/sys/arm64/include/vmparam.h b/sys/arm64/include/vmparam.h index 0dcd02d63938..0e93e4026d4a 100644 --- a/sys/arm64/include/vmparam.h +++ b/sys/arm64/include/vmparam.h @@ -317,6 +317,7 @@ extern vm_offset_t dmap_max_addr; * Need a page dump array for minidump. */ #define MINIDUMP_PAGE_TRACKING 1 +#define MINIDUMP_STARTUP_PAGE_TRACKING 1 #endif /* !_MACHINE_VMPARAM_H_ */ diff --git a/sys/i386/include/vmparam.h b/sys/i386/include/vmparam.h index 0d9734ae3830..6f8885a539c3 100644 --- a/sys/i386/include/vmparam.h +++ b/sys/i386/include/vmparam.h @@ -246,5 +246,6 @@ * Need a page dump array for minidump. */ #define MINIDUMP_PAGE_TRACKING 1 +#define MINIDUMP_STARTUP_PAGE_TRACKING 0 #endif /* _MACHINE_VMPARAM_H_ */ diff --git a/sys/powerpc/include/vmparam.h b/sys/powerpc/include/vmparam.h index 250da8298610..a612acbef239 100644 --- a/sys/powerpc/include/vmparam.h +++ b/sys/powerpc/include/vmparam.h @@ -308,11 +308,13 @@ extern int vm_level_0_order; * Need a page dump array for minidump. */ #define MINIDUMP_PAGE_TRACKING 1 +#define MINIDUMP_STARTUP_PAGE_TRACKING 1 #else /* * No minidump with 32-bit powerpc. */ #define MINIDUMP_PAGE_TRACKING 0 +#define MINIDUMP_STARTUP_PAGE_TRACKING 0 #endif #define PMAP_HAS_DMAP (hw_direct_map) diff --git a/sys/riscv/include/vmparam.h b/sys/riscv/include/vmparam.h index 5711bc8c347e..5092977d0669 100644 --- a/sys/riscv/include/vmparam.h +++ b/sys/riscv/include/vmparam.h @@ -257,5 +257,6 @@ extern vm_offset_t init_pt_va; * Need a page dump array for minidump. */ #define MINIDUMP_PAGE_TRACKING 1 +#define MINIDUMP_STARTUP_PAGE_TRACKING 1 #endif /* !_MACHINE_VMPARAM_H_ */ diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index f9b6e18899c6..59066eb96ae9 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -1890,8 +1890,7 @@ startup_alloc(uma_zone_t zone, vm_size_t bytes, int domain, uint8_t *pflag, pa = VM_PAGE_TO_PHYS(m); for (i = 0; i < pages; i++, pa += PAGE_SIZE) { -#if defined(__aarch64__) || defined(__amd64__) || \ - defined(__riscv) || defined(__powerpc64__) +#if MINIDUMP_PAGE_TRACKING && MINIDUMP_STARTUP_PAGE_TRACKING if ((wait & M_NODUMP) == 0) dump_add_page(pa); #endif @@ -1918,8 +1917,7 @@ startup_free(void *mem, vm_size_t bytes) if (va >= bootstart && va + bytes <= bootmem) pmap_remove(kernel_pmap, va, va + bytes); for (; bytes != 0; bytes -= PAGE_SIZE, m++) { -#if defined(__aarch64__) || defined(__amd64__) || \ - defined(__riscv) || defined(__powerpc64__) +#if MINIDUMP_PAGE_TRACKING && MINIDUMP_STARTUP_PAGE_TRACKING dump_drop_page(VM_PAGE_TO_PHYS(m)); #endif vm_page_unwire_noq(m); diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index 4429ec067673..9ba31cb9e1b3 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -620,11 +620,7 @@ vm_page_startup(vm_offset_t vaddr) vm_page_dump = (void *)(uintptr_t)pmap_map(&vaddr, new_end, new_end + vm_page_dump_size, VM_PROT_READ | VM_PROT_WRITE); bzero((void *)vm_page_dump, vm_page_dump_size); -#else - (void)last_pa; -#endif -#if defined(__aarch64__) || defined(__amd64__) || \ - defined(__riscv) || defined(__powerpc64__) +#if MINIDUMP_STARTUP_PAGE_TRACKING /* * Include the UMA bootstrap pages, witness pages and vm_page_dump * in a crash dump. When pmap_map() uses the direct map, they are @@ -632,6 +628,9 @@ vm_page_startup(vm_offset_t vaddr) */ for (pa = new_end; pa < end; pa += PAGE_SIZE) dump_add_page(pa); +#endif +#else + (void)last_pa; #endif phys_avail[biggestone + 1] = new_end; #ifdef __amd64__ @@ -728,8 +727,7 @@ vm_page_startup(vm_offset_t vaddr) */ new_end = vm_reserv_startup(&vaddr, new_end); #endif -#if defined(__aarch64__) || defined(__amd64__) || \ - defined(__riscv) || defined(__powerpc64__) +#if MINIDUMP_PAGE_TRACKING && MINIDUMP_STARTUP_PAGE_TRACKING /* * Include vm_page_array and vm_reserv_array in a crash dump. */