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

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/12/sys/dev/xen/console/xen_console.c
  stable/12/sys/dev/xen/control/control.c
  stable/12/sys/dev/xen/evtchn/evtchn_dev.c
  stable/12/sys/x86/xen/xenpv.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/xen/console/xen_console.c
==============================================================================
--- stable/12/sys/dev/xen/console/xen_console.c Thu Jun 18 15:14:10 2020        
(r362328)
+++ stable/12/sys/dev/xen/console/xen_console.c Thu Jun 18 15:15:04 2020        
(r362329)
@@ -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>
 
@@ -589,7 +590,7 @@ xencons_cnprobe(struct consdev *cp)
        if (!xen_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/12/sys/dev/xen/control/control.c
==============================================================================
--- stable/12/sys/dev/xen/control/control.c     Thu Jun 18 15:14:10 2020        
(r362328)
+++ stable/12/sys/dev/xen/control/control.c     Thu Jun 18 15:15:04 2020        
(r362329)
@@ -221,12 +221,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.
         */
@@ -366,8 +360,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/12/sys/dev/xen/evtchn/evtchn_dev.c
==============================================================================
--- stable/12/sys/dev/xen/evtchn/evtchn_dev.c   Thu Jun 18 15:14:10 2020        
(r362328)
+++ stable/12/sys/dev/xen/evtchn/evtchn_dev.c   Thu Jun 18 15:15:04 2020        
(r362329)
@@ -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/12/sys/x86/xen/xenpv.c
==============================================================================
--- stable/12/sys/x86/xen/xenpv.c       Thu Jun 18 15:14:10 2020        
(r362328)
+++ stable/12/sys/x86/xen/xenpv.c       Thu Jun 18 15:15:04 2020        
(r362329)
@@ -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;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to