| .. | .. |
|---|
| 109 | 109 | |
|---|
| 110 | 110 | dma_fence_get(fence); |
|---|
| 111 | 111 | |
|---|
| 112 | | - preempt_disable(); |
|---|
| 113 | | - write_seqcount_begin(&obj->seq); |
|---|
| 112 | + write_seqlock(&obj->seq); |
|---|
| 114 | 113 | |
|---|
| 115 | 114 | for (i = 0; i < fobj->shared_count; ++i) { |
|---|
| 116 | 115 | struct dma_fence *old_fence; |
|---|
| .. | .. |
|---|
| 121 | 120 | if (old_fence->context == fence->context) { |
|---|
| 122 | 121 | /* memory barrier is added by write_seqcount_begin */ |
|---|
| 123 | 122 | RCU_INIT_POINTER(fobj->shared[i], fence); |
|---|
| 124 | | - write_seqcount_end(&obj->seq); |
|---|
| 125 | | - preempt_enable(); |
|---|
| 123 | + write_sequnlock(&obj->seq); |
|---|
| 126 | 124 | |
|---|
| 127 | 125 | dma_fence_put(old_fence); |
|---|
| 128 | 126 | return; |
|---|
| .. | .. |
|---|
| 146 | 144 | fobj->shared_count++; |
|---|
| 147 | 145 | } |
|---|
| 148 | 146 | |
|---|
| 149 | | - write_seqcount_end(&obj->seq); |
|---|
| 150 | | - preempt_enable(); |
|---|
| 147 | + write_sequnlock(&obj->seq); |
|---|
| 151 | 148 | |
|---|
| 152 | 149 | dma_fence_put(signaled); |
|---|
| 153 | 150 | } |
|---|
| .. | .. |
|---|
| 191 | 188 | fobj->shared_count++; |
|---|
| 192 | 189 | |
|---|
| 193 | 190 | done: |
|---|
| 194 | | - preempt_disable(); |
|---|
| 195 | | - write_seqcount_begin(&obj->seq); |
|---|
| 191 | + write_seqlock(&obj->seq); |
|---|
| 196 | 192 | /* |
|---|
| 197 | 193 | * RCU_INIT_POINTER can be used here, |
|---|
| 198 | 194 | * seqcount provides the necessary barriers |
|---|
| 199 | 195 | */ |
|---|
| 200 | 196 | RCU_INIT_POINTER(obj->fence, fobj); |
|---|
| 201 | | - write_seqcount_end(&obj->seq); |
|---|
| 202 | | - preempt_enable(); |
|---|
| 197 | + write_sequnlock(&obj->seq); |
|---|
| 203 | 198 | |
|---|
| 204 | 199 | if (!old) |
|---|
| 205 | 200 | return; |
|---|
| .. | .. |
|---|
| 259 | 254 | if (fence) |
|---|
| 260 | 255 | dma_fence_get(fence); |
|---|
| 261 | 256 | |
|---|
| 262 | | - preempt_disable(); |
|---|
| 263 | | - write_seqcount_begin(&obj->seq); |
|---|
| 264 | | - /* write_seqcount_begin provides the necessary memory barrier */ |
|---|
| 257 | + write_seqlock(&obj->seq); |
|---|
| 265 | 258 | RCU_INIT_POINTER(obj->fence_excl, fence); |
|---|
| 266 | 259 | if (old) |
|---|
| 267 | 260 | old->shared_count = 0; |
|---|
| 268 | | - write_seqcount_end(&obj->seq); |
|---|
| 269 | | - preempt_enable(); |
|---|
| 261 | + write_sequnlock(&obj->seq); |
|---|
| 270 | 262 | |
|---|
| 271 | 263 | /* inplace update, no shared fences */ |
|---|
| 272 | 264 | while (i--) |
|---|
| .. | .. |
|---|
| 349 | 341 | src_list = reservation_object_get_list(dst); |
|---|
| 350 | 342 | old = reservation_object_get_excl(dst); |
|---|
| 351 | 343 | |
|---|
| 352 | | - preempt_disable(); |
|---|
| 353 | | - write_seqcount_begin(&dst->seq); |
|---|
| 354 | | - /* write_seqcount_begin provides the necessary memory barrier */ |
|---|
| 344 | + write_seqlock(&dst->seq); |
|---|
| 355 | 345 | RCU_INIT_POINTER(dst->fence_excl, new); |
|---|
| 356 | 346 | RCU_INIT_POINTER(dst->fence, dst_list); |
|---|
| 357 | | - write_seqcount_end(&dst->seq); |
|---|
| 358 | | - preempt_enable(); |
|---|
| 347 | + write_sequnlock(&dst->seq); |
|---|
| 359 | 348 | |
|---|
| 360 | 349 | if (src_list) |
|---|
| 361 | 350 | kfree_rcu(src_list, rcu); |
|---|
| .. | .. |
|---|
| 396 | 385 | shared_count = i = 0; |
|---|
| 397 | 386 | |
|---|
| 398 | 387 | rcu_read_lock(); |
|---|
| 399 | | - seq = read_seqcount_begin(&obj->seq); |
|---|
| 388 | + seq = read_seqbegin(&obj->seq); |
|---|
| 400 | 389 | |
|---|
| 401 | 390 | fence_excl = rcu_dereference(obj->fence_excl); |
|---|
| 402 | 391 | if (fence_excl && !dma_fence_get_rcu(fence_excl)) |
|---|
| .. | .. |
|---|
| 445 | 434 | } |
|---|
| 446 | 435 | } |
|---|
| 447 | 436 | |
|---|
| 448 | | - if (i != shared_count || read_seqcount_retry(&obj->seq, seq)) { |
|---|
| 437 | + if (i != shared_count || read_seqretry(&obj->seq, seq)) { |
|---|
| 449 | 438 | while (i--) |
|---|
| 450 | 439 | dma_fence_put(shared[i]); |
|---|
| 451 | 440 | dma_fence_put(fence_excl); |
|---|
| .. | .. |
|---|
| 494 | 483 | |
|---|
| 495 | 484 | retry: |
|---|
| 496 | 485 | shared_count = 0; |
|---|
| 497 | | - seq = read_seqcount_begin(&obj->seq); |
|---|
| 486 | + seq = read_seqbegin(&obj->seq); |
|---|
| 498 | 487 | rcu_read_lock(); |
|---|
| 499 | 488 | i = -1; |
|---|
| 500 | 489 | |
|---|
| .. | .. |
|---|
| 541 | 530 | |
|---|
| 542 | 531 | rcu_read_unlock(); |
|---|
| 543 | 532 | if (fence) { |
|---|
| 544 | | - if (read_seqcount_retry(&obj->seq, seq)) { |
|---|
| 533 | + if (read_seqretry(&obj->seq, seq)) { |
|---|
| 545 | 534 | dma_fence_put(fence); |
|---|
| 546 | 535 | goto retry; |
|---|
| 547 | 536 | } |
|---|
| .. | .. |
|---|
| 597 | 586 | retry: |
|---|
| 598 | 587 | ret = true; |
|---|
| 599 | 588 | shared_count = 0; |
|---|
| 600 | | - seq = read_seqcount_begin(&obj->seq); |
|---|
| 589 | + seq = read_seqbegin(&obj->seq); |
|---|
| 601 | 590 | |
|---|
| 602 | 591 | if (test_all) { |
|---|
| 603 | 592 | unsigned i; |
|---|
| .. | .. |
|---|
| 618 | 607 | break; |
|---|
| 619 | 608 | } |
|---|
| 620 | 609 | |
|---|
| 621 | | - if (read_seqcount_retry(&obj->seq, seq)) |
|---|
| 610 | + if (read_seqretry(&obj->seq, seq)) |
|---|
| 622 | 611 | goto retry; |
|---|
| 623 | 612 | } |
|---|
| 624 | 613 | |
|---|
| .. | .. |
|---|
| 631 | 620 | if (ret < 0) |
|---|
| 632 | 621 | goto retry; |
|---|
| 633 | 622 | |
|---|
| 634 | | - if (read_seqcount_retry(&obj->seq, seq)) |
|---|
| 623 | + if (read_seqretry(&obj->seq, seq)) |
|---|
| 635 | 624 | goto retry; |
|---|
| 636 | 625 | } |
|---|
| 637 | 626 | } |
|---|