git: 89ae8eb74e87 - main - rmlock: Add required compiler barriers to _rm_runlock()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Tue, 01 Mar 2022 14:39:53 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=89ae8eb74e87ac19aa2d7abe4ba16bcccd32bb9f

commit 89ae8eb74e87ac19aa2d7abe4ba16bcccd32bb9f
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-03-01 13:55:43 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-03-01 14:38:45 +0000

    rmlock: Add required compiler barriers to _rm_runlock()
    
    Also remove excessive whitespace in _rm_rlock().
    
    Reviewed by:    jah, mjg
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D34381
---
 sys/kern/kern_rmlock.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/kern/kern_rmlock.c b/sys/kern/kern_rmlock.c
index bbea8041360a..0cdcfb8fec62 100644
--- a/sys/kern/kern_rmlock.c
+++ b/sys/kern/kern_rmlock.c
@@ -449,17 +449,13 @@ _rm_rlock(struct rmlock *rm, struct rm_priotracker *tracker, int trylock)
 		THREAD_NO_SLEEPING();
 
 	td->td_critnest++;	/* critical_enter(); */
-
 	atomic_interrupt_fence();
 
 	pc = get_pcpu();
-
 	rm_tracker_add(pc, tracker);
-
 	sched_pin();
 
 	atomic_interrupt_fence();
-
 	td->td_critnest--;
 
 	/*
@@ -517,8 +513,12 @@ _rm_runlock(struct rmlock *rm, struct rm_priotracker *tracker)
 		return;
 
 	td->td_critnest++;	/* critical_enter(); */
+	atomic_interrupt_fence();
+
 	pc = get_pcpu();
 	rm_tracker_remove(pc, tracker);
+
+	atomic_interrupt_fence();
 	td->td_critnest--;
 	sched_unpin();