Module Name: src
Committed By: jmcneill
Date: Sun Jan 17 15:13:15 UTC 2021
Modified Files:
src/sys/dev/wscons: wsdisplay_vconsvar.h
Log Message:
Add appropriate memory barriers around sc_busy accesses. Fixes an issue
where character cells are sometimes not erased properly on aarch64 at
boot.
To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/wscons/wsdisplay_vconsvar.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/wscons/wsdisplay_vconsvar.h
diff -u src/sys/dev/wscons/wsdisplay_vconsvar.h:1.28 src/sys/dev/wscons/wsdisplay_vconsvar.h:1.29
--- src/sys/dev/wscons/wsdisplay_vconsvar.h:1.28 Sat Jan 16 23:19:50 2021
+++ src/sys/dev/wscons/wsdisplay_vconsvar.h Sun Jan 17 15:13:15 2021
@@ -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 @@ struct vcons_screen {
};
#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)