Module Name:    src
Committed By:   jdolecek
Date:           Wed May 13 13:19:38 UTC 2020

Modified Files:
        src/sys/arch/xen/xen: evtchn.c
        src/sys/arch/xen/xenbus: xenbus_comms.c xenbus_comms.h xenbus_probe.c

Log Message:
don't reinitialize mutexes/cv on resume

part of PR port-xen/55207


To generate a diff of this commit:
cvs rdiff -u -r1.94 -r1.95 src/sys/arch/xen/xen/evtchn.c
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/xen/xenbus/xenbus_comms.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/xen/xenbus/xenbus_comms.h
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/xen/xenbus/xenbus_probe.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/evtchn.c
diff -u src/sys/arch/xen/xen/evtchn.c:1.94 src/sys/arch/xen/xen/evtchn.c:1.95
--- src/sys/arch/xen/xen/evtchn.c:1.94	Thu May  7 19:48:57 2020
+++ src/sys/arch/xen/xen/evtchn.c	Wed May 13 13:19:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: evtchn.c,v 1.94 2020/05/07 19:48:57 bouyer Exp $	*/
+/*	$NetBSD: evtchn.c,v 1.95 2020/05/13 13:19:38 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -54,7 +54,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.94 2020/05/07 19:48:57 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.95 2020/05/13 13:19:38 jdolecek Exp $");
 
 #include "opt_xen.h"
 #include "isa.h"
@@ -254,6 +254,13 @@ void
 events_init(void)
 {
 	mutex_init(&evtchn_lock, MUTEX_DEFAULT, IPL_NONE);
+
+	(void)events_resume();
+}
+
+bool
+events_resume(void)
+{
 #ifdef XENPV
 	debug_port = bind_virq_to_evtch(VIRQ_DEBUG);
 
@@ -271,6 +278,8 @@ events_init(void)
 	hypervisor_unmask_event(debug_port);
 #endif /* XENPV */
 	x86_enable_intr();		/* at long last... */
+
+	return true;
 }
 
 bool
@@ -294,15 +303,6 @@ events_suspend(void)
 	return true;
 }
 
-bool
-events_resume (void)
-{
-	events_init();
-
-	return true;
-}
-
-
 unsigned int
 evtchn_do_event(int evtch, struct intrframe *regs)
 {

Index: src/sys/arch/xen/xenbus/xenbus_comms.c
diff -u src/sys/arch/xen/xenbus/xenbus_comms.c:1.23 src/sys/arch/xen/xenbus/xenbus_comms.c:1.24
--- src/sys/arch/xen/xenbus/xenbus_comms.c:1.23	Wed May  6 16:50:13 2020
+++ src/sys/arch/xen/xenbus/xenbus_comms.c	Wed May 13 13:19:38 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_comms.c,v 1.23 2020/05/06 16:50:13 bouyer Exp $ */
+/* $NetBSD: xenbus_comms.c,v 1.24 2020/05/13 13:19:38 jdolecek Exp $ */
 /******************************************************************************
  * xenbus_comms.c
  *
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xenbus_comms.c,v 1.23 2020/05/06 16:50:13 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenbus_comms.c,v 1.24 2020/05/13 13:19:38 jdolecek Exp $");
 
 #include <sys/types.h>
 #include <sys/null.h> 
@@ -219,11 +219,17 @@ xb_read(void *data, unsigned len)
 int
 xb_init_comms(device_t dev)
 {
-	int evtchn;
-
 	mutex_init(&xenstore_lock, MUTEX_DEFAULT, IPL_TTY);
 	cv_init(&xenstore_cv, "xsio");
 
+	return xb_resume_comms(dev);
+}
+
+int
+xb_resume_comms(device_t dev)
+{
+	int evtchn;
+
 	evtchn = xen_start_info.store_evtchn;
 
 	ih = xen_intr_establish_xname(-1, &xen_pic, evtchn, IST_LEVEL, IPL_TTY,

Index: src/sys/arch/xen/xenbus/xenbus_comms.h
diff -u src/sys/arch/xen/xenbus/xenbus_comms.h:1.7 src/sys/arch/xen/xenbus/xenbus_comms.h:1.8
--- src/sys/arch/xen/xenbus/xenbus_comms.h:1.7	Wed May  6 16:50:13 2020
+++ src/sys/arch/xen/xenbus/xenbus_comms.h	Wed May 13 13:19:38 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_comms.h,v 1.7 2020/05/06 16:50:13 bouyer Exp $ */
+/* $NetBSD: xenbus_comms.h,v 1.8 2020/05/13 13:19:38 jdolecek Exp $ */
 /*
  * Private include for xenbus communications.
  * 
@@ -30,10 +30,10 @@
 #define _XENBUS_COMMS_H
 
 void xenbus_kernfs_init(void);
-int xs_init(device_t dev);
-int xb_init_comms(device_t dev);
-void xb_suspend_comms(device_t dev);
-void xb_resume_comms(device_t dev);
+int xs_init(device_t);
+int xb_init_comms(device_t);
+void xb_suspend_comms(device_t);
+int xb_resume_comms(device_t);
 
 void xb_xenstored_make_ready(void);
 

Index: src/sys/arch/xen/xenbus/xenbus_probe.c
diff -u src/sys/arch/xen/xenbus/xenbus_probe.c:1.52 src/sys/arch/xen/xenbus/xenbus_probe.c:1.53
--- src/sys/arch/xen/xenbus/xenbus_probe.c:1.52	Wed May  6 16:50:13 2020
+++ src/sys/arch/xen/xenbus/xenbus_probe.c	Wed May 13 13:19:38 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_probe.c,v 1.52 2020/05/06 16:50:13 bouyer Exp $ */
+/* $NetBSD: xenbus_probe.c,v 1.53 2020/05/13 13:19:38 jdolecek Exp $ */
 /******************************************************************************
  * Talks to Xen Store to figure out what devices we have.
  *
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.52 2020/05/06 16:50:13 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.53 2020/05/13 13:19:38 jdolecek Exp $");
 
 #if 0
 #define DPRINTK(fmt, args...) \
@@ -131,7 +131,7 @@ xenbus_suspend(device_t dev, const pmf_q
 static bool
 xenbus_resume(device_t dev, const pmf_qual_t *qual)
 {
-	xb_init_comms(dev);
+	xb_resume_comms(dev);
 	xs_resume();
 
 	return true;

Reply via email to