Module Name: src Committed By: riastradh Date: Sat Feb 25 00:33:27 UTC 2023
Modified Files: src/sys/arch/xen/xen: xencons.c Log Message: 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. To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/sys/arch/xen/xen/xencons.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/xen/xen/xencons.c diff -u src/sys/arch/xen/xen/xencons.c:1.50 src/sys/arch/xen/xen/xencons.c:1.51 --- src/sys/arch/xen/xen/xencons.c:1.50 Thu May 7 19:25:57 2020 +++ src/sys/arch/xen/xen/xencons.c Sat Feb 25 00:33:27 2023 @@ -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 @@ xenconscn_getc(dev_t dev) 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 @@ xenconscn_putc(dev_t dev, int c) } 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); }