Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/xen/xen xencons(4): Membar audit.



details:   https://anonhg.NetBSD.org/src/rev/7b2910c01803
branches:  trunk
changeset: 373715:7b2910c01803
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Feb 25 00:33:27 2023 +0000

description:
xencons(4): Membar audit.

- xenconscn_getc: Once we have consumed an input slot, it is clearer
  to issue xen_wmb (release, i.e., load/store-before-store) before
  advancing in_cons so that the update becomes a store-release
  freeing the input slot for the other side to reuse.

- xenconscn_putc: After filling an output slot, must issue xen_wmb
  (release, i.e., load/store-before-store) before advancing out_prod,
  and another one before notifying the other side of the advance.

diffstat:

 sys/arch/xen/xen/xencons.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (39 lines):

diff -r 6d77233b0fbb -r 7b2910c01803 sys/arch/xen/xen/xencons.c
--- a/sys/arch/xen/xen/xencons.c        Sat Feb 25 00:33:15 2023 +0000
+++ b/sys/arch/xen/xen/xencons.c        Sat Feb 25 00:33:27 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xencons.c,v 1.50 2020/05/07 19:25:57 maxv Exp $        */
+/*     $NetBSD: xencons.c,v 1.51 2023/02/25 00:33:27 riastradh Exp $   */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -53,7 +53,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xencons.c,v 1.50 2020/05/07 19:25:57 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xencons.c,v 1.51 2023/02/25 00:33:27 riastradh Exp $");
 
 #include "opt_xen.h"
 
@@ -583,7 +583,7 @@
        xen_rmb();
        c = xencons_interface->in[MASK_XENCONS_IDX(xencons_interface->in_cons,
            xencons_interface->in)];
-       xen_rmb();
+       xen_wmb();
        xencons_interface->in_cons = cons + 1;
        cn_check_magic(dev, c, xencons_cnm_state);
        splx(s);
@@ -614,9 +614,9 @@
                }
                xencons_interface->out[MASK_XENCONS_IDX(xencons_interface->out_prod,
                    xencons_interface->out)] = c;
-               xen_rmb();
+               xen_wmb();
                xencons_interface->out_prod++;
-               xen_rmb();
+               xen_wmb();
                hypervisor_notify_via_evtchn(xen_start_info.console.domU.evtchn);
                splx(s);
        }



Home | Main Index | Thread Index | Old Index