.. | .. |
---|
648 | 648 | if ((cb & (GRU_HANDLE_STRIDE - 1)) || ucbnum >= GRU_NUM_CB) |
---|
649 | 649 | return -EINVAL; |
---|
650 | 650 | |
---|
| 651 | +again: |
---|
651 | 652 | gts = gru_find_lock_gts(cb); |
---|
652 | 653 | if (!gts) |
---|
653 | 654 | return -EINVAL; |
---|
.. | .. |
---|
656 | 657 | if (ucbnum >= gts->ts_cbr_au_count * GRU_CBR_AU_SIZE) |
---|
657 | 658 | goto exit; |
---|
658 | 659 | |
---|
659 | | - gru_check_context_placement(gts); |
---|
| 660 | + if (gru_check_context_placement(gts)) { |
---|
| 661 | + gru_unlock_gts(gts); |
---|
| 662 | + gru_unload_context(gts, 1); |
---|
| 663 | + goto again; |
---|
| 664 | + } |
---|
660 | 665 | |
---|
661 | 666 | /* |
---|
662 | 667 | * CCH may contain stale data if ts_force_cch_reload is set. |
---|
.. | .. |
---|
874 | 879 | } else { |
---|
875 | 880 | gts->ts_user_blade_id = req.val1; |
---|
876 | 881 | gts->ts_user_chiplet_id = req.val0; |
---|
877 | | - gru_check_context_placement(gts); |
---|
| 882 | + if (gru_check_context_placement(gts)) { |
---|
| 883 | + gru_unlock_gts(gts); |
---|
| 884 | + gru_unload_context(gts, 1); |
---|
| 885 | + return ret; |
---|
| 886 | + } |
---|
878 | 887 | } |
---|
879 | 888 | break; |
---|
880 | 889 | case sco_gseg_owner: |
---|