@@ -923,13 +923,14 @@ static void
923
923
wake_pending_user_interrupt_threads (struct hl_user_interrupt * interrupt )
924
924
{
925
925
struct hl_user_pending_interrupt * pend ;
926
+ unsigned long flags ;
926
927
927
- spin_lock (& interrupt -> wait_list_lock );
928
+ spin_lock_irqsave (& interrupt -> wait_list_lock , flags );
928
929
list_for_each_entry (pend , & interrupt -> wait_list_head , wait_list_node ) {
929
930
pend -> fence .error = - EIO ;
930
931
complete_all (& pend -> fence .completion );
931
932
}
932
- spin_unlock (& interrupt -> wait_list_lock );
933
+ spin_unlock_irqrestore (& interrupt -> wait_list_lock , flags );
933
934
}
934
935
935
936
void hl_release_pending_user_interrupts (struct hl_device * hdev )
@@ -2714,9 +2715,9 @@ static int _hl_interrupt_wait_ioctl(struct hl_device *hdev, struct hl_ctx *ctx,
2714
2715
{
2715
2716
struct hl_user_pending_interrupt * pend ;
2716
2717
struct hl_user_interrupt * interrupt ;
2717
- unsigned long timeout ;
2718
- long completion_rc ;
2718
+ unsigned long timeout , flags ;
2719
2719
u32 completion_value ;
2720
+ long completion_rc ;
2720
2721
int rc = 0 ;
2721
2722
2722
2723
if (timeout_us == U32_MAX )
@@ -2739,7 +2740,7 @@ static int _hl_interrupt_wait_ioctl(struct hl_device *hdev, struct hl_ctx *ctx,
2739
2740
else
2740
2741
interrupt = & hdev -> user_interrupt [interrupt_offset ];
2741
2742
2742
- spin_lock (& interrupt -> wait_list_lock );
2743
+ spin_lock_irqsave (& interrupt -> wait_list_lock , flags );
2743
2744
if (!hl_device_operational (hdev , NULL )) {
2744
2745
rc = - EPERM ;
2745
2746
goto unlock_and_free_fence ;
@@ -2765,7 +2766,7 @@ static int _hl_interrupt_wait_ioctl(struct hl_device *hdev, struct hl_ctx *ctx,
2765
2766
* handler to monitor
2766
2767
*/
2767
2768
list_add_tail (& pend -> wait_list_node , & interrupt -> wait_list_head );
2768
- spin_unlock (& interrupt -> wait_list_lock );
2769
+ spin_unlock_irqrestore (& interrupt -> wait_list_lock , flags );
2769
2770
2770
2771
wait_again :
2771
2772
/* Wait for interrupt handler to signal completion */
@@ -2777,12 +2778,12 @@ static int _hl_interrupt_wait_ioctl(struct hl_device *hdev, struct hl_ctx *ctx,
2777
2778
* If comparison fails, keep waiting until timeout expires
2778
2779
*/
2779
2780
if (completion_rc > 0 ) {
2780
- spin_lock (& interrupt -> wait_list_lock );
2781
+ spin_lock_irqsave (& interrupt -> wait_list_lock , flags );
2781
2782
2782
2783
if (copy_from_user (& completion_value ,
2783
2784
u64_to_user_ptr (user_address ), 4 )) {
2784
2785
2785
- spin_unlock (& interrupt -> wait_list_lock );
2786
+ spin_unlock_irqrestore (& interrupt -> wait_list_lock , flags );
2786
2787
2787
2788
dev_err (hdev -> dev ,
2788
2789
"Failed to copy completion value from user\n" );
@@ -2792,13 +2793,13 @@ static int _hl_interrupt_wait_ioctl(struct hl_device *hdev, struct hl_ctx *ctx,
2792
2793
}
2793
2794
2794
2795
if (completion_value >= target_value ) {
2795
- spin_unlock (& interrupt -> wait_list_lock );
2796
+ spin_unlock_irqrestore (& interrupt -> wait_list_lock , flags );
2796
2797
* status = CS_WAIT_STATUS_COMPLETED ;
2797
2798
} else {
2798
2799
reinit_completion (& pend -> fence .completion );
2799
2800
timeout = completion_rc ;
2800
2801
2801
- spin_unlock (& interrupt -> wait_list_lock );
2802
+ spin_unlock_irqrestore (& interrupt -> wait_list_lock , flags );
2802
2803
goto wait_again ;
2803
2804
}
2804
2805
} else if (completion_rc == - ERESTARTSYS ) {
@@ -2812,11 +2813,11 @@ static int _hl_interrupt_wait_ioctl(struct hl_device *hdev, struct hl_ctx *ctx,
2812
2813
}
2813
2814
2814
2815
remove_pending_user_interrupt :
2815
- spin_lock (& interrupt -> wait_list_lock );
2816
+ spin_lock_irqsave (& interrupt -> wait_list_lock , flags );
2816
2817
list_del (& pend -> wait_list_node );
2817
2818
2818
2819
unlock_and_free_fence :
2819
- spin_unlock (& interrupt -> wait_list_lock );
2820
+ spin_unlock_irqrestore (& interrupt -> wait_list_lock , flags );
2820
2821
kfree (pend );
2821
2822
hl_ctx_put (ctx );
2822
2823
0 commit comments