xenstore: fix suspension when using the xenstore device
Lock the xenstore request mutex when suspending user-space processes, in order to prevent any process from holding this lock when going into suspension, or else the xenstore suspend process is going to deadlock. Submitted by: Liuyingdong <liuyingdong@huawei.com> Reviewed by: royger MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D9638
This commit is contained in:
parent
8dee0e9bd6
commit
41716b8d51
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=314841
@ -199,7 +199,9 @@ xctrl_suspend()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
EVENTHANDLER_INVOKE(power_suspend_early);
|
EVENTHANDLER_INVOKE(power_suspend_early);
|
||||||
|
xs_lock();
|
||||||
stop_all_proc();
|
stop_all_proc();
|
||||||
|
xs_unlock();
|
||||||
EVENTHANDLER_INVOKE(power_suspend);
|
EVENTHANDLER_INVOKE(power_suspend);
|
||||||
|
|
||||||
#ifdef EARLY_AP_STARTUP
|
#ifdef EARLY_AP_STARTUP
|
||||||
|
@ -1699,3 +1699,20 @@ xs_unregister_watch(struct xs_watch *watch)
|
|||||||
sx_xunlock(&xs.xenwatch_mutex);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -338,4 +338,15 @@ void xs_unregister_watch(struct xs_watch *watch);
|
|||||||
*/
|
*/
|
||||||
struct sbuf *xs_join(const char *, const char *);
|
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 */
|
#endif /* _XEN_XENSTORE_XENSTOREVAR_H */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user