svn commit: r362331 - in stable/11/sys: dev/xen/console dev/xen/control dev/xen/evtchn x86/xen

Roger Pau Monné royger at FreeBSD.org
Thu Jun 18 15:44:41 UTC 2020


Author: royger
Date: Thu Jun 18 15:44:40 2020
New Revision: 362331
URL: https://svnweb.freebsd.org/changeset/base/362331

Log:
  MFC r352925: xen/ctrl: acknowledge all control requests
  MFC r357616: xen/console: fix priority of Xen console
  MFC r361274: dev/xenstore: fix return with locks held
  Note this should be dev/evtchn not dev/xenstore.
  MFC r361578: xenpv: do not use low 1MB for Xen mappings on i386
  MFC r361580: xen/control: short circuit xctrl_on_watch_event on spurious event
  
  Those are all Xen related fixes or minor improvements that have been sitting on
  current for a reasonable time without complaints.
  
  Sponsored by: Citrix Systems R&D

Modified:
  stable/11/sys/dev/xen/console/xen_console.c
  stable/11/sys/dev/xen/control/control.c
  stable/11/sys/dev/xen/evtchn/evtchn_dev.c
  stable/11/sys/x86/xen/xenpv.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/xen/console/xen_console.c
==============================================================================
--- stable/11/sys/dev/xen/console/xen_console.c	Thu Jun 18 15:41:16 2020	(r362330)
+++ stable/11/sys/dev/xen/console/xen_console.c	Thu Jun 18 15:44:40 2020	(r362331)
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/cons.h>
 #include <sys/kdb.h>
 #include <sys/proc.h>
+#include <sys/reboot.h>
 
 #include <machine/stdarg.h>
 
@@ -592,7 +593,7 @@ xencons_cnprobe(struct consdev *cp)
 	if (!xen_pv_domain())
 		return;
 
-	cp->cn_pri = CN_REMOTE;
+	cp->cn_pri = (boothowto & RB_SERIAL) ? CN_REMOTE : CN_NORMAL;
 	sprintf(cp->cn_name, "%s0", driver_name);
 }
 

Modified: stable/11/sys/dev/xen/control/control.c
==============================================================================
--- stable/11/sys/dev/xen/control/control.c	Thu Jun 18 15:41:16 2020	(r362330)
+++ stable/11/sys/dev/xen/control/control.c	Thu Jun 18 15:44:40 2020	(r362331)
@@ -219,12 +219,6 @@ xctrl_suspend()
 	KASSERT((PCPU_GET(cpuid) == 0), ("Not running on CPU#0"));
 
 	/*
-	 * Clear our XenStore node so the toolstack knows we are
-	 * responding to the suspend request.
-	 */
-	xs_write(XST_NIL, "control", "shutdown", "");
-
-	/*
 	 * Be sure to hold Giant across DEVICE_SUSPEND/RESUME since non-MPSAFE
 	 * drivers need this.
 	 */
@@ -364,8 +358,13 @@ xctrl_on_watch_event(struct xs_watch *watch, const cha
 	
 	error = xs_read(XST_NIL, "control", "shutdown",
 			&result_len, (void **)&result);
-	if (error != 0)
+	if (error != 0 || result_len == 0)
 		return;
+
+	/* Acknowledge the request by writing back an empty string. */
+	error = xs_write(XST_NIL, "control", "shutdown", "");
+	if (error != 0)
+		printf("unable to ack shutdown request, proceeding anyway\n");
 
 	reason = xctrl_shutdown_reasons;
 	last_reason = reason + nitems(xctrl_shutdown_reasons);

Modified: stable/11/sys/dev/xen/evtchn/evtchn_dev.c
==============================================================================
--- stable/11/sys/dev/xen/evtchn/evtchn_dev.c	Thu Jun 18 15:41:16 2020	(r362330)
+++ stable/11/sys/dev/xen/evtchn/evtchn_dev.c	Thu Jun 18 15:44:40 2020	(r362331)
@@ -261,9 +261,10 @@ evtchn_read(struct cdev *dev, struct uio *uio, int iof
 
 	sx_xlock(&u->ring_cons_mutex);
 	for (;;) {
-		error = EFBIG;
-		if (u->ring_overflow)
+		if (u->ring_overflow) {
+			error = EFBIG;
 			goto unlock_out;
+		}
 
 		c = u->ring_cons;
 		p = u->ring_prod;
@@ -271,13 +272,13 @@ evtchn_read(struct cdev *dev, struct uio *uio, int iof
 			break;
 
 		if (ioflag & IO_NDELAY) {
-			sx_xunlock(&u->ring_cons_mutex);
-			return (EWOULDBLOCK);
+			error = EWOULDBLOCK;
+			goto unlock_out;
 		}
 
 		error = sx_sleep(u, &u->ring_cons_mutex, PCATCH, "evtchw", 0);
 		if ((error != 0) && (error != EWOULDBLOCK))
-			return (error);
+			goto unlock_out;
 	}
 
 	/* Byte lengths of two chunks. Chunk split (if any) is at ring wrap. */

Modified: stable/11/sys/x86/xen/xenpv.c
==============================================================================
--- stable/11/sys/x86/xen/xenpv.c	Thu Jun 18 15:41:16 2020	(r362330)
+++ stable/11/sys/x86/xen/xenpv.c	Thu Jun 18 15:44:40 2020	(r362331)
@@ -54,12 +54,14 @@ __FBSDID("$FreeBSD$");
  * prevent clashes with MMIO/ACPI regions.
  *
  * Since this is not possible on i386 just use any available memory
- * chunk and hope we don't clash with anything else.
+ * chunk above 1MB and hope we don't clash with anything else.
  */
 #ifdef __amd64__
 #define LOW_MEM_LIMIT	0x100000000ul
+#elif defined(__i386__)
+#define LOW_MEM_LIMIT	0x100000ul
 #else
-#define LOW_MEM_LIMIT	0
+#error "Unsupported architecture"
 #endif
 
 static devclass_t xenpv_devclass;


More information about the svn-src-all mailing list