From owner-svn-src-all@freebsd.org Thu May 14 16:07:28 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C12762F5C70; Thu, 14 May 2020 16:07:28 +0000 (UTC) (envelope-from markj@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49NGdr4jMCz4VpK; Thu, 14 May 2020 16:07:28 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9C57CD9DA; Thu, 14 May 2020 16:07:28 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 04EG7Sme017312; Thu, 14 May 2020 16:07:28 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 04EG7RnJ017305; Thu, 14 May 2020 16:07:27 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202005141607.04EG7RnJ017305@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 14 May 2020 16:07:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r361033 - in head/sys: amd64/amd64 arm64/arm64 dev/acpica i386/i386 x86/acpica X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: amd64/amd64 arm64/arm64 dev/acpica i386/i386 x86/acpica X-SVN-Commit-Revision: 361033 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2020 16:07:28 -0000 Author: markj Date: Thu May 14 16:07:27 2020 New Revision: 361033 URL: https://svnweb.freebsd.org/changeset/base/361033 Log: Call acpi_pxm_set_proximity_info() slightly earlier on x86. This function is responsible for setting pc_domain in each pcpu structure. Call it from the main function that starts APs, rather than a separate SYSINIT. This makes it easier to close the window where UMA's per-CPU slab allocator may be called while pc_domain is uninitialized. In particular, the allocator uses pc_domain to allocate domain-local pages, so allocations before this point end up using domain 0 for everything. Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D24757 Modified: head/sys/amd64/amd64/mp_machdep.c head/sys/arm64/arm64/mp_machdep.c head/sys/dev/acpica/acpi_pxm.c head/sys/dev/acpica/acpivar.h head/sys/i386/i386/mp_machdep.c head/sys/x86/acpica/srat.c Modified: head/sys/amd64/amd64/mp_machdep.c ============================================================================== --- head/sys/amd64/amd64/mp_machdep.c Thu May 14 16:06:54 2020 (r361032) +++ head/sys/amd64/amd64/mp_machdep.c Thu May 14 16:07:27 2020 (r361033) @@ -264,8 +264,9 @@ cpu_mp_start(void) init_ops.start_all_aps(); set_interrupt_apic_ids(); -} + acpi_pxm_set_cpu_locality(); +} /* * AP CPU's call this to initialize themselves. Modified: head/sys/arm64/arm64/mp_machdep.c ============================================================================== --- head/sys/arm64/arm64/mp_machdep.c Thu May 14 16:06:54 2020 (r361032) +++ head/sys/arm64/arm64/mp_machdep.c Thu May 14 16:07:27 2020 (r361033) @@ -535,9 +535,7 @@ cpu_init_acpi(void) acpi_unmap_table(madt); #if MAXMEMDOM > 1 - /* set proximity info */ acpi_pxm_set_cpu_locality(); - acpi_pxm_free(); #endif } #endif Modified: head/sys/dev/acpica/acpi_pxm.c ============================================================================== --- head/sys/dev/acpica/acpi_pxm.c Thu May 14 16:06:54 2020 (r361032) +++ head/sys/dev/acpica/acpi_pxm.c Thu May 14 16:07:27 2020 (r361033) @@ -628,7 +628,8 @@ srat_walk_table(acpi_subtable_handler *handler, void * } /* - * Setup per-CPU domain IDs from information saved in 'cpus'. + * Set up per-CPU domain IDs from information saved in 'cpus' and tear down data + * structures allocated by acpi_pxm_init(). */ void acpi_pxm_set_cpu_locality(void) @@ -651,6 +652,10 @@ acpi_pxm_set_cpu_locality(void) printf("SRAT: CPU %u has memory domain %d\n", i, pc->pc_domain); } + /* XXXMJ the page is leaked. */ + pmap_unmapbios((vm_offset_t)cpus, sizeof(*cpus) * max_cpus); + srat_physaddr = 0; + cpus = NULL; } int @@ -662,20 +667,6 @@ acpi_pxm_get_cpu_locality(int apic_id) if (cpu == NULL) panic("SRAT: CPU with ID %u is not known", apic_id); return (cpu->domain); -} - -/* - * Free data structures allocated during acpi_pxm_init. - */ -void -acpi_pxm_free(void) -{ - - if (srat_physaddr == 0) - return; - pmap_unmapbios((vm_offset_t)cpus, sizeof(*cpus) * max_cpus); - srat_physaddr = 0; - cpus = NULL; } /* Modified: head/sys/dev/acpica/acpivar.h ============================================================================== --- head/sys/dev/acpica/acpivar.h Thu May 14 16:06:54 2020 (r361032) +++ head/sys/dev/acpica/acpivar.h Thu May 14 16:07:27 2020 (r361033) @@ -540,7 +540,6 @@ void acpi_pxm_parse_tables(void); void acpi_pxm_set_mem_locality(void); void acpi_pxm_set_cpu_locality(void); int acpi_pxm_get_cpu_locality(int apic_id); -void acpi_pxm_free(void); /* * Map a PXM to a VM domain. Modified: head/sys/i386/i386/mp_machdep.c ============================================================================== --- head/sys/i386/i386/mp_machdep.c Thu May 14 16:06:54 2020 (r361032) +++ head/sys/i386/i386/mp_machdep.c Thu May 14 16:07:27 2020 (r361033) @@ -198,6 +198,8 @@ cpu_mp_start(void) start_all_aps(); set_interrupt_apic_ids(); + + acpi_pxm_set_cpu_locality(); } /* Modified: head/sys/x86/acpica/srat.c ============================================================================== --- head/sys/x86/acpica/srat.c Thu May 14 16:06:54 2020 (r361032) +++ head/sys/x86/acpica/srat.c Thu May 14 16:07:27 2020 (r361033) @@ -56,13 +56,4 @@ parse_acpi_tables(void *dummy) SYSINIT(parse_acpi_tables, SI_SUB_VM - 1, SI_ORDER_FIRST, parse_acpi_tables, NULL); -static void -srat_set_cpus(void *dummy) -{ - - acpi_pxm_set_cpu_locality(); - acpi_pxm_free(); -} -SYSINIT(srat_set_cpus, SI_SUB_CPU, SI_ORDER_ANY, srat_set_cpus, NULL); - #endif /* MAXMEMDOM > 1 */