Page MenuHomeFreeBSD

Clean up ARM per-cpu qmap fields
ClosedPublic

Authored by jah on Jan 24 2017, 5:23 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 11, 8:21 AM
Unknown Object (File)
Tue, Apr 2, 3:58 AM
Unknown Object (File)
Tue, Apr 2, 2:05 AM
Unknown Object (File)
Sun, Mar 24, 8:33 PM
Unknown Object (File)
Jan 31 2024, 2:36 PM
Unknown Object (File)
Jan 27 2024, 5:11 PM
Unknown Object (File)
Jan 15 2024, 5:44 PM
Unknown Object (File)
Dec 31 2023, 8:53 PM
Subscribers

Details

Summary

Remove qmap PTE and address fields for armv4, which I left unused
after r286296.

pc_qmap_addr for armv6 is a leftover from the old armv6 pmap, so might
as well rename it and put it to use in the new one.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 6979
Build 7164: arc lint + arc unit

Event Timeline

jah retitled this revision from to Clean up ARM per-cpu qmap fields.
jah updated this object.
jah edited the test plan for this revision. (Show Details)
sys/arm/arm/pmap-v6.c
5894

Hmm. PCPU_GET() calls get_pcpu() internally, which is implemented as cp15 operation in SMP case. And cp15 operations may be slow. As an optimalization, I suggest to use get_pcpu() here and use obtained pointer.

Further, I checked other related functions. They use pcpu_find() when current struct pcpu* is wanted. While pcpu_find() is a function which needs to get current CPU id (one cp15 operation) to get struct pcpu*, get_pcpu() is a macro which gets struct pcpu* (one cp15 operation) directly. So, I suggest to replace pcpu_find() by get_pcpu() in these functions in a different commit.

sys/arm/arm/pmap-v6.c
5894

Thank you for reminding me that we have get_pcpu() on arm. That was what I really wanted to use on i386, but unfortunately we only have the thread pointer in %gs there. BTW, concern over relative slowness of %gs and cp15 access was exactly the reason I chose to use pcpu_find() in the other functions: https://reviews.freebsd.org/D8833?id=23041#inline-52317

sys/arm/arm/pmap-v6.c
5894

%gs->%fs

sys/arm/arm/pmap-v6.c
5894

To clarify my note. The following line is used to get current pcpu in the other functions:
pc = pcpu_find(curcpu);
where curcpu is defined as
#define curcpu PCPU_GET(cpuid)

Thus, pcpu_find(curcpu) can be broken down as:
(1) get current pcpu
(2) get current cpu id from current pcpu
(3) call pcpu_find()
(4) get current pcpu according to current cpu id.

So, steps (2),(3), and (4) are pointless.

sys/arm/arm/pmap-v6.c
5894

I understood your original note, I noted the same thing while working on the i386 pmap.
Looking at the code for each architecture, I don't see why we can't add get_pcpu() for the other architectures besides arm/arm64/riscv where it currently exists. That might be of some benefit since there are quite a few places in MI code where we use the pcpu_find(curcpu) trick.

BTW, I decided to include the switch to get_pcpu() with this commit since the changes are few and $(WORK) is leaving me with little time to do more freebsd work this week.

Replace pcpu_find with get_pcpu()

skra edited edge metadata.

I suggest that the main reason for this change should be the replacement of pcpu_find() by get_pcpu() now. I mean the text in commit message. The cleanup should be stated as secondary.

It was my reason for separate commit. To clearly describe what was wrong with pcpu_find() .

sys/arm/arm/pmap-v6.c
5894

I just wanted to be correct. The first note about pcpu_find() was not accurate.

5895

Type of pc_qmap_addr is vm_offset_t, and qmap_addr is used only once in this function. What about to not use qmap_addr variable here?

This revision is now accepted and ready to land.Jan 25 2017, 9:25 PM
This revision was automatically updated to reflect the committed changes.