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)
Mon, Dec 23, 6:44 AM
Unknown Object (File)
Oct 4 2024, 2:59 PM
Unknown Object (File)
Sep 24 2024, 4:58 PM
Unknown Object (File)
Sep 24 2024, 8:37 AM
Unknown Object (File)
Sep 20 2024, 12:31 AM
Unknown Object (File)
Sep 10 2024, 1:58 PM
Unknown Object (File)
Sep 8 2024, 6:17 AM
Unknown Object (File)
Sep 4 2024, 7:55 AM
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

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 25821
Build 24393: arc lint + arc unit

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

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

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

sys/amd64/amd64/mp_machdep.c
406

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

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

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

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.