git: 6ec4ff70885d - main - amd64: switch pmap_map_io_transient() to use pmap_kenter_attr()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 25 Nov 2024 12:20:10 UTC
The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=6ec4ff70885d8048be8de9b9d690dd371e3d4a3e commit 6ec4ff70885d8048be8de9b9d690dd371e3d4a3e Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2024-11-23 21:03:40 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2024-11-25 12:16:50 +0000 amd64: switch pmap_map_io_transient() to use pmap_kenter_attr() instead of constructing transient pte itself. This pre-set PG_A and PG_M bits, avoiding atomic pte update on access and modification. Also it set the nx bit, the mapping is not supposed to be used for executing. Reviewed by: alc Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D47717 --- sys/amd64/amd64/pmap.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index 21b8555b5380..82110e61d54a 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -10518,8 +10518,7 @@ pmap_map_io_transient(vm_page_t page[], vm_offset_t vaddr[], int count, { vm_paddr_t paddr; bool needs_mapping; - pt_entry_t *pte; - int cache_bits, error __unused, i; + int error __unused, i; /* * Allocate any KVA space that we need, this is done in a separate @@ -10564,11 +10563,8 @@ pmap_map_io_transient(vm_page_t page[], vm_offset_t vaddr[], int count, */ pmap_qenter(vaddr[i], &page[i], 1); } else { - pte = vtopte(vaddr[i]); - cache_bits = pmap_cache_bits(kernel_pmap, - page[i]->md.pat_mode, false); - pte_store(pte, paddr | X86_PG_RW | X86_PG_V | - cache_bits); + pmap_kenter_attr(vaddr[i], paddr, + page[i]->md.pat_mode); pmap_invlpg(kernel_pmap, vaddr[i]); } }