@@ -307,7 +307,8 @@ static void mn_hlist_release(struct mmu_notifier_subscriptions *subscriptions,
307
307
* ->release returns.
308
308
*/
309
309
id = srcu_read_lock (& srcu );
310
- hlist_for_each_entry_rcu (subscription , & subscriptions -> list , hlist )
310
+ hlist_for_each_entry_rcu (subscription , & subscriptions -> list , hlist ,
311
+ srcu_read_lock_held (& srcu ))
311
312
/*
312
313
* If ->release runs before mmu_notifier_unregister it must be
313
314
* handled, as it's the only way for the driver to flush all
@@ -370,7 +371,8 @@ int __mmu_notifier_clear_flush_young(struct mm_struct *mm,
370
371
371
372
id = srcu_read_lock (& srcu );
372
373
hlist_for_each_entry_rcu (subscription ,
373
- & mm -> notifier_subscriptions -> list , hlist ) {
374
+ & mm -> notifier_subscriptions -> list , hlist ,
375
+ srcu_read_lock_held (& srcu )) {
374
376
if (subscription -> ops -> clear_flush_young )
375
377
young |= subscription -> ops -> clear_flush_young (
376
378
subscription , mm , start , end );
@@ -389,7 +391,8 @@ int __mmu_notifier_clear_young(struct mm_struct *mm,
389
391
390
392
id = srcu_read_lock (& srcu );
391
393
hlist_for_each_entry_rcu (subscription ,
392
- & mm -> notifier_subscriptions -> list , hlist ) {
394
+ & mm -> notifier_subscriptions -> list , hlist ,
395
+ srcu_read_lock_held (& srcu )) {
393
396
if (subscription -> ops -> clear_young )
394
397
young |= subscription -> ops -> clear_young (subscription ,
395
398
mm , start , end );
@@ -407,7 +410,8 @@ int __mmu_notifier_test_young(struct mm_struct *mm,
407
410
408
411
id = srcu_read_lock (& srcu );
409
412
hlist_for_each_entry_rcu (subscription ,
410
- & mm -> notifier_subscriptions -> list , hlist ) {
413
+ & mm -> notifier_subscriptions -> list , hlist ,
414
+ srcu_read_lock_held (& srcu )) {
411
415
if (subscription -> ops -> test_young ) {
412
416
young = subscription -> ops -> test_young (subscription , mm ,
413
417
address );
@@ -428,7 +432,8 @@ void __mmu_notifier_change_pte(struct mm_struct *mm, unsigned long address,
428
432
429
433
id = srcu_read_lock (& srcu );
430
434
hlist_for_each_entry_rcu (subscription ,
431
- & mm -> notifier_subscriptions -> list , hlist ) {
435
+ & mm -> notifier_subscriptions -> list , hlist ,
436
+ srcu_read_lock_held (& srcu )) {
432
437
if (subscription -> ops -> change_pte )
433
438
subscription -> ops -> change_pte (subscription , mm , address ,
434
439
pte );
@@ -476,7 +481,8 @@ static int mn_hlist_invalidate_range_start(
476
481
int id ;
477
482
478
483
id = srcu_read_lock (& srcu );
479
- hlist_for_each_entry_rcu (subscription , & subscriptions -> list , hlist ) {
484
+ hlist_for_each_entry_rcu (subscription , & subscriptions -> list , hlist ,
485
+ srcu_read_lock_held (& srcu )) {
480
486
const struct mmu_notifier_ops * ops = subscription -> ops ;
481
487
482
488
if (ops -> invalidate_range_start ) {
@@ -528,7 +534,8 @@ mn_hlist_invalidate_end(struct mmu_notifier_subscriptions *subscriptions,
528
534
int id ;
529
535
530
536
id = srcu_read_lock (& srcu );
531
- hlist_for_each_entry_rcu (subscription , & subscriptions -> list , hlist ) {
537
+ hlist_for_each_entry_rcu (subscription , & subscriptions -> list , hlist ,
538
+ srcu_read_lock_held (& srcu )) {
532
539
/*
533
540
* Call invalidate_range here too to avoid the need for the
534
541
* subsystem of having to register an invalidate_range_end
@@ -582,7 +589,8 @@ void __mmu_notifier_invalidate_range(struct mm_struct *mm,
582
589
583
590
id = srcu_read_lock (& srcu );
584
591
hlist_for_each_entry_rcu (subscription ,
585
- & mm -> notifier_subscriptions -> list , hlist ) {
592
+ & mm -> notifier_subscriptions -> list , hlist ,
593
+ srcu_read_lock_held (& srcu )) {
586
594
if (subscription -> ops -> invalidate_range )
587
595
subscription -> ops -> invalidate_range (subscription , mm ,
588
596
start , end );
@@ -714,7 +722,8 @@ find_get_mmu_notifier(struct mm_struct *mm, const struct mmu_notifier_ops *ops)
714
722
715
723
spin_lock (& mm -> notifier_subscriptions -> lock );
716
724
hlist_for_each_entry_rcu (subscription ,
717
- & mm -> notifier_subscriptions -> list , hlist ) {
725
+ & mm -> notifier_subscriptions -> list , hlist ,
726
+ lockdep_is_held (& mm -> notifier_subscriptions -> lock )) {
718
727
if (subscription -> ops != ops )
719
728
continue ;
720
729
0 commit comments