Module Name:    src
Committed By:   riastradh
Date:           Sat Feb 25 00:33:39 UTC 2023

Modified Files:
        src/sys/arch/xen/xen: xencons.c

Log Message:
xencons(4): Reduce unnecessary membars.

- xencons_handler: After advancing in_cons, only need one xen_wmb
  before notifying the hypervisor that we're ready for more.

  (XXX Should this do xen_mb and re-check in_prod at that point, or
  does hypervisor_notify_via_evtchn obviate the need for this?)

- xenvonscn_getc: After reading in_prod, only need one xen_rmb before
  using the slots it is telling us are now ready.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 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.51 src/sys/arch/xen/xen/xencons.c:1.52
--- src/sys/arch/xen/xen/xencons.c:1.51	Sat Feb 25 00:33:27 2023
+++ src/sys/arch/xen/xen/xencons.c	Sat Feb 25 00:33:38 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: xencons.c,v 1.51 2023/02/25 00:33:27 riastradh Exp $	*/
+/*	$NetBSD: xencons.c,v 1.52 2023/02/25 00:33:38 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -53,7 +53,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xencons.c,v 1.51 2023/02/25 00:33:27 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xencons.c,v 1.52 2023/02/25 00:33:38 riastradh Exp $");
 
 #include "opt_xen.h"
 
@@ -479,9 +479,9 @@ xencons_handler(void *arg)
 			cons += len;
 			xen_wmb();
 			xencons_interface->in_cons = cons;
-			xen_wmb();
 		}
 	}
+	xen_wmb();
 	hypervisor_notify_via_evtchn(xen_start_info.console.domU.evtchn);
 	splx(s);
 	return 1;
@@ -575,7 +575,6 @@ xenconscn_getc(dev_t dev)
 
 	cons = xencons_interface->in_cons;
 	prod = xencons_interface->in_prod;
-	xen_rmb();
 	while (cons == prod) {
 		HYPERVISOR_yield();
 		prod = xencons_interface->in_prod;

Reply via email to