Page MenuHomeFreeBSD

Reallocate pcpu area on the correct domain.
ClosedPublic

Authored by jeff on Aug 13 2019, 1:49 AM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 22 2023, 9:31 PM
Unknown Object (File)
Jun 3 2023, 8:01 AM
Unknown Object (File)
May 24 2023, 3:40 AM
Unknown Object (File)
May 14 2023, 6:35 PM
Unknown Object (File)
Dec 26 2022, 11:43 PM
Subscribers

Details

Summary

This patch simply allocates various per-cpu data-structures on the correct domain. The actual pcpu area is reallocated and we waste a page. Recovering the page is likely more costly than the benefit as it will increase the size of the page array.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jeff retitled this revision from Reallocate pcpu area on the correct domain if it is not already. Parts of this diff were originally from kib. to Reallocate pcpu area on the correct domain..Aug 13 2019, 1:52 AM
jeff edited the summary of this revision. (Show Details)
jeff added reviewers: markj, kib, gallatin, jhb, glebius.
sys/amd64/amd64/mp_machdep.c
406 ↗(On Diff #60707)

You are remapping a page in the kernel .bss section, I think that pmap_enter() works there only by a chance for now. I am sure that we do not want to support such use of pmap_enter().

Ideally we would use something like pmap_qenter(), but .bss might be mapped with superpage.

sys/amd64/amd64/mp_machdep.c
406 ↗(On Diff #60707)

What might break it? Why do we not want to support this?

sys/amd64/amd64/mp_machdep.c
406 ↗(On Diff #60707)

For instance, vm_page_array elements backing pages of kernel text/data/bss were not initialized until very recently. We never faulted on kernel segments, and pmap_enter() was correspondingly never needed there.

sys/amd64/amd64/mp_machdep.c
406 ↗(On Diff #60707)

Ok but I still don't see a reason not to do this. It is simple and it works. Anything I do will just be a more long winded replacement of the same code.

sys/amd64/amd64/mp_machdep.c
406 ↗(On Diff #60707)

I do not object (strongly), just pointing out that the code introduces a new requirement.

Also, this causes demotion of the superpage mapping the data (.data + .bss), I believe.

If there is no strong objection I will commit this tomorrow.

This revision is now accepted and ready to land.Aug 18 2019, 6:25 PM
gallatin added inline comments.
sys/amd64/amd64/mp_machdep.c
470 ↗(On Diff #60707)

I'm getting a panic here on AMD rome configured in non-numa mode. I think we need to avoid acpi_pxm_get_cpu_locality() when we're not on a numa machine. The following patch seems to fix it:

        /* start each AP */
-       for (cpu = 1; cpu < mp_ncpus; cpu++) {
+       for (domain = 0, cpu = 1; cpu < mp_ncpus; cpu++) {
                apic_id = cpu_apic_ids[cpu];
-               domain = acpi_pxm_get_cpu_locality(apic_id);
+#ifdef NUMA
+               if (vm_ndomains > 1)
+                       domain = acpi_pxm_get_cpu_locality(apic_id);
+#endif
                /* allocate and set up an idle stack data page */
                bootstacks[cpu] = (void *)kmem_malloc_domainset(
This revision now requires changes to proceed.Aug 18 2019, 7:52 PM
This revision was not accepted when it landed; it landed in state Needs Revision.Aug 18 2019, 11:44 PM
This revision was automatically updated to reflect the committed changes.