From owner-dev-commits-src-all@freebsd.org Thu Dec 24 11:13:14 2020 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D54444C014F; Thu, 24 Dec 2020 11:13:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D1nVy5bxkz3mft; Thu, 24 Dec 2020 11:13:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B37787891; Thu, 24 Dec 2020 11:13:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 0BOBDEnB066005; Thu, 24 Dec 2020 11:13:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 0BOBDEQn066004; Thu, 24 Dec 2020 11:13:14 GMT (envelope-from git) Date: Thu, 24 Dec 2020 11:13:14 GMT Message-Id: <202012241113.0BOBDEQn066004@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov 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 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 1b5f91f4ca689e3ea1ddbc28d7c4ad9ccc751dbc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: "Commit messages for all branches of the src repository." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Dec 2020 11:13:14 -0000 The branch stable/12 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1b5f91f4ca689e3ea1ddbc28d7c4ad9ccc751dbc commit 1b5f91f4ca689e3ea1ddbc28d7c4ad9ccc751dbc Author: Konstantin Belousov AuthorDate: 2020-12-24 10:56:16 +0000 Commit: Konstantin Belousov 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);