Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/wscons wsdisplay(4): Insert memory barriers for scr_...



details:   https://anonhg.NetBSD.org/src/rev/80b12004934a
branches:  trunk
changeset: 368521:80b12004934a
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Jul 17 11:31:07 2022 +0000

description:
wsdisplay(4): Insert memory barriers for scr_dirty synchronization.

Otherwise vcons_update_screen in vcons_softintr might attempt to draw
stale data from the buffers on the screen.

diffstat:

 sys/dev/wscons/wsdisplay_vcons.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (34 lines):

diff -r b548ee496db8 -r 80b12004934a sys/dev/wscons/wsdisplay_vcons.c
--- a/sys/dev/wscons/wsdisplay_vcons.c  Sun Jul 17 11:30:27 2022 +0000
+++ b/sys/dev/wscons/wsdisplay_vcons.c  Sun Jul 17 11:31:07 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wsdisplay_vcons.c,v 1.58 2022/07/17 11:30:27 riastradh Exp $ */
+/*     $NetBSD: wsdisplay_vcons.c,v 1.59 2022/07/17 11:31:07 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2005, 2006 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.58 2022/07/17 11:30:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay_vcons.c,v 1.59 2022/07/17 11:31:07 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -139,6 +139,7 @@
 vcons_dirty(struct vcons_screen *scr)
 {
 #ifdef VCONS_DRAW_INTR
+       membar_release();
        atomic_inc_uint(&scr->scr_dirty);
 #endif
 }
@@ -1520,6 +1521,7 @@
        if (scr && vd->use_intr) {
                if (!SCREEN_IS_BUSY(scr)) {
                        dirty = atomic_swap_uint(&scr->scr_dirty, 0);
+                       membar_acquire();
                        if (vd->use_intr == 2) {
                                if ((scr->scr_flags & VCONS_NO_REDRAW) == 0) {
                                        vd->use_intr = 1;



Home | Main Index | Thread Index | Old Index