kexec: don't disable interrupts when acquiring load/unload lock
PATCH 1/1 kexec: don't disable interrupts when acquiring load/unload lock
This doesn't appear to have served any purpose other than causing map_pages_to_xen() to be (incorrectly) invoked with interrupts disabled. In particular, serialization against actual kexec-ing is done without this lock being involved. Clarify the scope of the lock at once by making it local to do_kexec_op_internal().
Once at it, also drop a pointless initializer.
xen/common/kexec.c +4 -7
@@ -55,8 +55,6 @@ static xen_kexec_image_t kexec_image[KEXstatic unsigned long kexec_flags =0 ;/* the lowest bits are for KEXEC_IMAGE... */ -static spinlock_t kexec_lock =SPIN_LOCK_UNLOCKED ; -static unsigned char vmcoreinfo_data[VMCOREINFO_BYTES ];static size_t vmcoreinfo_size =0 ;
@@ -851,10 +849,9 @@ static int do_kexec_op_internal(unsignedXEN_GUEST_HANDLE_PARAM (void ) uarg, bool_t compat) { -unsigned long flags; -int ret = -EINVAL ; + static DEFINE_SPINLOCK(kexec_lock); +int ret =xsm_kexec (XSM_PRIV ); - ret =xsm_kexec (XSM_PRIV );if ( ret )return ret;
@@ -868,7 +865,7 @@ static int do_kexec_op_internal(unsignedbreak ;case KEXEC_CMD_kexec_load:case KEXEC_CMD_kexec_unload: -spin_lock_irqsave (&kexec_lock, flags); +spin_lock (&kexec_lock);if (!test_bit (KEXEC_FLAG_IN_PROGRESS , &kexec_flags)) {if (compat)
@@ -876,7 +873,7 @@ static int do_kexec_op_internal(unsignedelse ret =kexec_load_unload (op, uarg); } -spin_unlock_irqrestore (&kexec_lock, flags); +spin_unlock (&kexec_lock);break ;case KEXEC_CMD_kexec: ret =kexec_exec (uarg);
kexec: don't disable interrupts when acquiring load/unload lock
This doesn't appear to have served any purpose other than causing map_pages_to_xen() to be (incorrectly) invoked with interrupts disabled. In particular, serialization against actual kexec-ing is done without this lock being involved. Clarify the scope of the lock at once by making it local to do_kexec_op_internal().
Once at it, also drop a pointless initializer.
xen/common/kexec.c +4 -7
@@ -55,8 +55,6 @@ static xen_kexec_image_t kexec_image[KEXstatic unsigned long kexec_flags =0 ;/* the lowest bits are for KEXEC_IMAGE... */ -static spinlock_t kexec_lock =SPIN_LOCK_UNLOCKED ; -static unsigned char vmcoreinfo_data[VMCOREINFO_BYTES ];static size_t vmcoreinfo_size =0 ;
@@ -851,10 +849,9 @@ static int do_kexec_op_internal(unsignedXEN_GUEST_HANDLE_PARAM (void ) uarg, bool_t compat) { -unsigned long flags; -int ret = -EINVAL ; + static DEFINE_SPINLOCK(kexec_lock); +int ret =xsm_kexec (XSM_PRIV ); - ret =xsm_kexec (XSM_PRIV );if ( ret )return ret;
@@ -868,7 +865,7 @@ static int do_kexec_op_internal(unsignedbreak ;case KEXEC_CMD_kexec_load:case KEXEC_CMD_kexec_unload: -spin_lock_irqsave (&kexec_lock, flags); +spin_lock (&kexec_lock);if (!test_bit (KEXEC_FLAG_IN_PROGRESS , &kexec_flags)) {if (compat)
@@ -876,7 +873,7 @@ static int do_kexec_op_internal(unsignedelse ret =kexec_load_unload (op, uarg); } -spin_unlock_irqrestore (&kexec_lock, flags); +spin_unlock (&kexec_lock);break ;case KEXEC_CMD_kexec: ret =kexec_exec (uarg);
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 9 lines · Jan Beulich
This doesn't appear to have served any purpose other than causing
map_pages_to_xen()to be (incorrectly) invoked with interrupts disabled. In particular, serialization against actual kexec-ing is done without this lock being involved. Clarify the scope of the lock at once by making it local todo_kexec_op_internal().Once at it, also drop a pointless initializer.
Signed-off-by Jan Beulich <[email protected]>
Quoted 48 lines
xen/common/kexec.c +4
-7@@ -55,8 +55,6 @@ static xen_kexec_image_t kexec_image[KEXstatic unsigned long kexec_flags =0 ;/* the lowest bits are for KEXEC_IMAGE... */ -static spinlock_t kexec_lock =SPIN_LOCK_UNLOCKED ; -static unsigned char vmcoreinfo_data[VMCOREINFO_BYTES ];static size_t vmcoreinfo_size =0 ;@@ -851,10 +849,9 @@ static int do_kexec_op_internal(unsignedXEN_GUEST_HANDLE_PARAM (void ) uarg, bool_t compat) { -unsigned long flags; -int ret = -EINVAL ; + static DEFINE_SPINLOCK(kexec_lock); +int ret =xsm_kexec (XSM_PRIV ); - ret =xsm_kexec (XSM_PRIV );if ( ret )return ret;@@ -868,7 +865,7 @@ static int do_kexec_op_internal(unsignedbreak ;case KEXEC_CMD_kexec_load:case KEXEC_CMD_kexec_unload: -spin_lock_irqsave (&kexec_lock, flags); +spin_lock (&kexec_lock);if (!test_bit (KEXEC_FLAG_IN_PROGRESS , &kexec_flags)) {if (compat)@@ -876,7 +873,7 @@ static int do_kexec_op_internal(unsignedelse ret =kexec_load_unload (op, uarg); } -spin_unlock_irqrestore (&kexec_lock, flags); +spin_unlock (&kexec_lock);break ;case KEXEC_CMD_kexec: ret =kexec_exec (uarg);
Quoted 4 lines
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 7 lines · Jan Beulich
This doesn't appear to have served any purpose other than causing
map_pages_to_xen()to be (incorrectly) invoked with interrupts disabled. In particular, serialization against actual kexec-ing is done without this lock being involved. Clarify the scope of the lock at once by making it local todo_kexec_op_internal().Once at it, also drop a pointless initializer.
I've already dropped the irqsave from this lock in my kexec series and can fold the other part in as well (which would now be in kexec_swap_images()).
Quoted 15 lines
Signed-off-by Jan Beulich <[email protected]>xen/common/kexec.c +0
-2@@ -55,8 +55,6 @@ static xen_kexec_image_t kexec_image[KEXstatic unsigned long kexec_flags =0 ;/* the lowest bits are for KEXEC_IMAGE... */ -static spinlock_t kexec_lock =SPIN_LOCK_UNLOCKED ; -static unsigned char vmcoreinfo_data[VMCOREINFO_BYTES ];static size_t vmcoreinfo_size =0 ;@@ -851,10 +849,9 @@ static int do_kexec_op_internal(unsigned XEN_GUEST_HANDLE_PARAM(void) uarg,
xen/common/kexec.c static int do_kexec_op_internal(unsigned · line 856
Quoted 10 lines
xen/common/kexec.c +2
-3bool_t compat) { -unsigned long flags; -int ret = -EINVAL ; +static DEFINE_SPINLOCK (kexec_lock); +int ret =xsm_kexec (XSM_PRIV ); - ret =xsm_kexec (XSM_PRIV );if ( ret )return ret;
I find the resulting spacing of this a bit unconventional.
int ret;
ret = xsm_kexec(XSM_PRIV)
if ( ret )
return ret;
is more standard I think. Not too bothered though.
I'm about to post v10 of the kexec series and it would be less hassle for me if you took the fix via that series instead since this area undergoes significant refactoring. But if you prefer to commit this fix now:
David
Quoted 8 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 6 lines · Jan Beulich
This doesn't appear to have served any purpose other than causing
map_pages_to_xen()to be (incorrectly) invoked with interrupts disabled. In particular, serialization against actual kexec-ing is done without this lock being involved. Clarify the scope of the lock at once by making it local todo_kexec_op_internal().
Quoted 5 lines
Quoted 1 line
Once at it, also drop a pointless initializer.
I've already dropped the irqsave from this lock in my kexec series and can fold the other part in as well (which would now be in
kexec_swap_images()).
That would generally be fine, but I'd like to get this fixed no matter whether your patches make 4.4.
Jan
Quoted 8 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 6 lines · Jan Beulich
This doesn't appear to have served any purpose other than causing
map_pages_to_xen()to be (incorrectly) invoked with interrupts disabled. In particular, serialization against actual kexec-ing is done without this lock being involved. Clarify the scope of the lock at once by making it local todo_kexec_op_internal().
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Once at it, also drop a pointless initializer.
I've already dropped the irqsave from this lock in my kexec series and can fold the other part in as well (which would now be in
kexec_swap_images()).That would generally be fine, but I'd like to get this fixed no matter whether your patches make 4.4.
Sure. I was only asking if you could wait a few days.
David
Quoted 12 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 10 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · David Vrabel
Quoted 7 lines · Jan Beulich
This doesn't appear to have served any purpose other than causing
map_pages_to_xen()to be (incorrectly) invoked with interrupts disabled. In particular, serialization against actual kexec-ing is done without this lock being involved. Clarify the scope of the lock at once by making it local todo_kexec_op_internal().Once at it, also drop a pointless initializer.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
I've already dropped the irqsave from this lock in my kexec series and can fold the other part in as well (which would now be in
kexec_swap_images()).That would generally be fine, but I'd like to get this fixed no matter whether your patches make 4.4.
Sure. I was only asking if you could wait a few days.
I could, but I'm in no way convinced that a few days would help.
Jan
Quoted 9 lines · Jan Beulich
This doesn't appear to have served any purpose other than causing
map_pages_to_xen()to be (incorrectly) invoked with interrupts disabled. In particular, serialization against actual kexec-ing is done without this lock being involved. Clarify the scope of the lock at once by making it local todo_kexec_op_internal().Once at it, also drop a pointless initializer.
Signed-off-by Jan Beulich <[email protected]>
Daniel