Commit 70eae03
committed
KVM: x86/xen: Fix SRCU/RCU usage in readers of evtchn_ports
The evtchnfd structure itself must be protected by either kvm->lock or
SRCU. Use the former in kvm_xen_eventfd_update(), since the lock is
being taken anyway; kvm_xen_hcall_evtchn_send() instead is a reader and
does not need kvm->lock, and is called in SRCU critical section from the
kvm_x86_handle_exit function.
It is also important to use rcu_read_{lock,unlock}() in
kvm_xen_hcall_evtchn_send(), because idr_remove() will *not*
use synchronize_srcu() to wait for readers to complete.
Remove a superfluous if (kvm) check before calling synchronize_srcu()
in kvm_xen_eventfd_deassign() where kvm has been dereferenced already.
Co-developed-by: Michal Luczaj <[email protected]>
Signed-off-by: Michal Luczaj <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: David Woodhouse <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>1 parent 92c5896 commit 70eae03
1 file changed
+18
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1808 | 1808 | | |
1809 | 1809 | | |
1810 | 1810 | | |
| 1811 | + | |
1811 | 1812 | | |
1812 | 1813 | | |
1813 | 1814 | | |
1814 | 1815 | | |
| 1816 | + | |
1815 | 1817 | | |
1816 | 1818 | | |
1817 | | - | |
1818 | 1819 | | |
| 1820 | + | |
1819 | 1821 | | |
1820 | | - | |
| 1822 | + | |
1821 | 1823 | | |
1822 | 1824 | | |
| 1825 | + | |
1823 | 1826 | | |
1824 | | - | |
| 1827 | + | |
1825 | 1828 | | |
1826 | 1829 | | |
1827 | 1830 | | |
1828 | 1831 | | |
1829 | 1832 | | |
1830 | 1833 | | |
1831 | 1834 | | |
1832 | | - | |
| 1835 | + | |
1833 | 1836 | | |
1834 | 1837 | | |
1835 | 1838 | | |
1836 | | - | |
| 1839 | + | |
1837 | 1840 | | |
1838 | | - | |
1839 | 1841 | | |
1840 | 1842 | | |
1841 | 1843 | | |
1842 | 1844 | | |
1843 | 1845 | | |
| 1846 | + | |
| 1847 | + | |
1844 | 1848 | | |
1845 | | - | |
| 1849 | + | |
1846 | 1850 | | |
1847 | 1851 | | |
1848 | 1852 | | |
| |||
1935 | 1939 | | |
1936 | 1940 | | |
1937 | 1941 | | |
1938 | | - | |
1939 | | - | |
| 1942 | + | |
1940 | 1943 | | |
1941 | 1944 | | |
1942 | 1945 | | |
| |||
1989 | 1992 | | |
1990 | 1993 | | |
1991 | 1994 | | |
1992 | | - | |
1993 | 1995 | | |
1994 | 1996 | | |
1995 | 1997 | | |
1996 | 1998 | | |
1997 | 1999 | | |
1998 | | - | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
| 2004 | + | |
1999 | 2005 | | |
| 2006 | + | |
2000 | 2007 | | |
2001 | 2008 | | |
2002 | 2009 | | |
| |||
0 commit comments