Author: royger
Date: Tue Mar 21 09:27:24 2017
New Revision: 315675
URL: https://svnweb.freebsd.org/changeset/base/315675

Log:
  MFC r314841:
  
  xenstore: fix suspension when using the xenstore device
  
  Submitted by: Liuyingdong <liuyingd...@huawei.com>
  Reviewed by:  royger

Modified:
  stable/10/sys/dev/xen/control/control.c
  stable/10/sys/xen/xenstore/xenstore.c
  stable/10/sys/xen/xenstore/xenstorevar.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/xen/control/control.c
==============================================================================
--- stable/10/sys/dev/xen/control/control.c     Tue Mar 21 09:24:07 2017        
(r315674)
+++ stable/10/sys/dev/xen/control/control.c     Tue Mar 21 09:27:24 2017        
(r315675)
@@ -343,6 +343,10 @@ xctrl_suspend()
 #endif
        int suspend_cancelled;
 
+       EVENTHANDLER_INVOKE(power_suspend_early);
+       xs_lock();
+       stop_all_proc();
+       xs_unlock();
        EVENTHANDLER_INVOKE(power_suspend);
 
        if (smp_started) {
@@ -429,6 +433,8 @@ xctrl_suspend()
                thread_unlock(curthread);
        }
 
+       resume_all_proc();
+
        EVENTHANDLER_INVOKE(power_resume);
 
        if (bootverbose)

Modified: stable/10/sys/xen/xenstore/xenstore.c
==============================================================================
--- stable/10/sys/xen/xenstore/xenstore.c       Tue Mar 21 09:24:07 2017        
(r315674)
+++ stable/10/sys/xen/xenstore/xenstore.c       Tue Mar 21 09:27:24 2017        
(r315675)
@@ -1657,3 +1657,20 @@ xs_unregister_watch(struct xs_watch *wat
                sx_xunlock(&xs.xenwatch_mutex);
        }
 }
+
+void
+xs_lock(void)
+{
+
+       sx_xlock(&xs.request_mutex);
+       return;
+}
+
+void
+xs_unlock(void)
+{
+
+       sx_xunlock(&xs.request_mutex);
+       return;
+}
+

Modified: stable/10/sys/xen/xenstore/xenstorevar.h
==============================================================================
--- stable/10/sys/xen/xenstore/xenstorevar.h    Tue Mar 21 09:24:07 2017        
(r315674)
+++ stable/10/sys/xen/xenstore/xenstorevar.h    Tue Mar 21 09:27:24 2017        
(r315675)
@@ -338,4 +338,15 @@ void xs_unregister_watch(struct xs_watch
  */
 struct sbuf *xs_join(const char *, const char *);
 
+/**
+ * Lock the xenstore request mutex.
+ */
+void xs_lock(void);
+
+/**
+ * Unlock the xenstore request mutex.
+ */
+void xs_unlock(void);
+
 #endif /* _XEN_XENSTORE_XENSTOREVAR_H */
+
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to