Date: Thu, 24 Dec 2020 11:13:14 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 1b5f91f4ca68 - MFC r357940 (by mjg), r365932 (by jrtc27): Make atomic_load_ptr type-aware atomic_common.h: Fix the volatile qualifier placement in atomic_load_ptr Message-ID: <202012241113.0BOBDEQn066004@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1b5f91f4ca689e3ea1ddbc28d7c4ad9ccc751dbc commit 1b5f91f4ca689e3ea1ddbc28d7c4ad9ccc751dbc Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2020-12-24 10:56:16 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2020-12-24 10:56:16 +0000 MFC r357940 (by mjg), r365932 (by jrtc27): Make atomic_load_ptr type-aware atomic_common.h: Fix the volatile qualifier placement in atomic_load_ptr (cherry picked from commit 082a6b2a92888cf799c7a0408a78e2d7ad9320bb) (cherry picked from commit 7d54cc9165a3990849b60835c85ddb388905e1b7) --- sys/amd64/amd64/pmap.c | 6 +++--- sys/sys/atomic_common.h | 2 +- sys/x86/x86/mp_x86.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index ed9398f4da83..4a4c50385ca2 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -746,7 +746,7 @@ again: PV_STAT(i = 0); for (p = &pmap_invl_gen_head;; p = prev.next) { PV_STAT(i++); - prevl = atomic_load_ptr(&p->next); + prevl = (uintptr_t)atomic_load_ptr(&p->next); if ((prevl & PMAP_INVL_GEN_NEXT_INVALID) != 0) { PV_STAT(atomic_add_long(&invl_start_restart, 1)); lock_delay(&lda); @@ -853,7 +853,7 @@ pmap_delayed_invl_finish_u(void) again: for (p = &pmap_invl_gen_head; p != NULL; p = (void *)prevl) { - prevl = atomic_load_ptr(&p->next); + prevl = (uintptr_t)atomic_load_ptr(&p->next); if ((prevl & PMAP_INVL_GEN_NEXT_INVALID) != 0) { PV_STAT(atomic_add_long(&invl_finish_restart, 1)); lock_delay(&lda); @@ -904,7 +904,7 @@ DB_SHOW_COMMAND(di_queue, pmap_di_queue) for (p = &pmap_invl_gen_head, first = true; p != NULL; p = pn, first = false) { - nextl = atomic_load_ptr(&p->next); + nextl = (uintptr_t)atomic_load_ptr(&p->next); pn = (void *)(nextl & ~PMAP_INVL_GEN_NEXT_INVALID); td = first ? NULL : __containerof(p, struct thread, td_md.md_invl_gen); diff --git a/sys/sys/atomic_common.h b/sys/sys/atomic_common.h index 9aa30fa24a27..16db4a81eb28 100644 --- a/sys/sys/atomic_common.h +++ b/sys/sys/atomic_common.h @@ -41,7 +41,7 @@ #define atomic_load_short(p) (*(volatile u_short *)(p)) #define atomic_load_int(p) (*(volatile u_int *)(p)) #define atomic_load_long(p) (*(volatile u_long *)(p)) -#define atomic_load_ptr(p) (*(volatile uintptr_t*)(p)) +#define atomic_load_ptr(p) (*(volatile __typeof(*p) *)(p)) #define atomic_load_8(p) (*(volatile uint8_t *)(p)) #define atomic_load_16(p) (*(volatile uint16_t *)(p)) #define atomic_load_32(p) (*(volatile uint32_t *)(p)) diff --git a/sys/x86/x86/mp_x86.c b/sys/x86/x86/mp_x86.c index f24e406a52b4..984edb43dd22 100644 --- a/sys/x86/x86/mp_x86.c +++ b/sys/x86/x86/mp_x86.c @@ -1095,7 +1095,7 @@ smp_after_idle_runnable(void *arg __unused) for (cpu = 1; cpu < mp_ncpus; cpu++) { pc = pcpu_find(cpu); - while (atomic_load_ptr(&pc->pc_curpcb) == (uintptr_t)NULL) + while (atomic_load_ptr(&pc->pc_curpcb) == NULL) cpu_spinwait(); kmem_free((vm_offset_t)bootstacks[cpu], kstack_pages * PAGE_SIZE);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202012241113.0BOBDEQn066004>