Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/wscons Add appropriate memory barriers around sc_bus...



details:   https://anonhg.NetBSD.org/src/rev/316c69becfd0
branches:  trunk
changeset: 979936:316c69becfd0
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Jan 17 15:13:15 2021 +0000

description:
Add appropriate memory barriers around sc_busy accesses. Fixes an issue
where character cells are sometimes not erased properly on aarch64 at
boot.

diffstat:

 sys/dev/wscons/wsdisplay_vconsvar.h |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (32 lines):

diff -r 3f6c62b3c38a -r 316c69becfd0 sys/dev/wscons/wsdisplay_vconsvar.h
--- a/sys/dev/wscons/wsdisplay_vconsvar.h       Sun Jan 17 15:09:56 2021 +0000
+++ b/sys/dev/wscons/wsdisplay_vconsvar.h       Sun Jan 17 15:13:15 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wsdisplay_vconsvar.h,v 1.28 2021/01/16 23:19:50 jmcneill Exp $ */
+/*     $NetBSD: wsdisplay_vconsvar.h,v 1.29 2021/01/17 15:13:15 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -34,6 +34,8 @@
 #include "opt_vcons.h"
 #endif
 
+#include <sys/atomic.h>
+
 struct vcons_data;
 
 struct vcons_screen {
@@ -84,10 +86,10 @@
 };
 
 #define SCREEN_IS_VISIBLE(scr) (((scr)->scr_status & VCONS_IS_VISIBLE) != 0)
-#define SCREEN_IS_BUSY(scr) ((scr)->scr_busy != 0)
+#define SCREEN_IS_BUSY(scr) (membar_consumer(), (scr)->scr_busy != 0)
 #define SCREEN_CAN_DRAW(scr) (((scr)->scr_flags & VCONS_DONT_DRAW) == 0)
-#define SCREEN_BUSY(scr) ((scr)->scr_busy = 1)
-#define SCREEN_IDLE(scr) ((scr)->scr_busy = 0)
+#define SCREEN_BUSY(scr) ((scr)->scr_busy = 1, membar_producer())
+#define SCREEN_IDLE(scr) ((scr)->scr_busy = 0, membar_producer())
 #define SCREEN_VISIBLE(scr) ((scr)->scr_status |= VCONS_IS_VISIBLE)
 #define SCREEN_INVISIBLE(scr) ((scr)->scr_status &= ~VCONS_IS_VISIBLE)
 #define SCREEN_DISABLE_DRAWING(scr) ((scr)->scr_flags |= VCONS_DONT_DRAW)



Home | Main Index | Thread Index | Old Index