43
43
44
44
static DEFINE_RAW_SPINLOCK (native_tlbie_lock );
45
45
46
+ #ifdef CONFIG_LOCKDEP
47
+ static struct lockdep_map hpte_lock_map =
48
+ STATIC_LOCKDEP_MAP_INIT ("hpte_lock" , & hpte_lock_map );
49
+
50
+ static void acquire_hpte_lock (void )
51
+ {
52
+ lock_map_acquire (& hpte_lock_map );
53
+ }
54
+
55
+ static void release_hpte_lock (void )
56
+ {
57
+ lock_map_release (& hpte_lock_map );
58
+ }
59
+ #else
60
+ static void acquire_hpte_lock (void )
61
+ {
62
+ }
63
+
64
+ static void release_hpte_lock (void )
65
+ {
66
+ }
67
+ #endif
68
+
46
69
static inline unsigned long ___tlbie (unsigned long vpn , int psize ,
47
70
int apsize , int ssize )
48
71
{
@@ -220,6 +243,7 @@ static inline void native_lock_hpte(struct hash_pte *hptep)
220
243
{
221
244
unsigned long * word = (unsigned long * )& hptep -> v ;
222
245
246
+ acquire_hpte_lock ();
223
247
while (1 ) {
224
248
if (!test_and_set_bit_lock (HPTE_LOCK_BIT , word ))
225
249
break ;
@@ -234,6 +258,7 @@ static inline void native_unlock_hpte(struct hash_pte *hptep)
234
258
{
235
259
unsigned long * word = (unsigned long * )& hptep -> v ;
236
260
261
+ release_hpte_lock ();
237
262
clear_bit_unlock (HPTE_LOCK_BIT , word );
238
263
}
239
264
@@ -279,6 +304,7 @@ static long native_hpte_insert(unsigned long hpte_group, unsigned long vpn,
279
304
hpte_v = hpte_old_to_new_v (hpte_v );
280
305
}
281
306
307
+ release_hpte_lock ();
282
308
hptep -> r = cpu_to_be64 (hpte_r );
283
309
/* Guarantee the second dword is visible before the valid bit */
284
310
eieio ();
@@ -327,6 +353,7 @@ static long native_hpte_remove(unsigned long hpte_group)
327
353
return -1 ;
328
354
329
355
/* Invalidate the hpte. NOTE: this also unlocks it */
356
+ release_hpte_lock ();
330
357
hptep -> v = 0 ;
331
358
332
359
return i ;
@@ -517,10 +544,11 @@ static void native_hpte_invalidate(unsigned long slot, unsigned long vpn,
517
544
/* recheck with locks held */
518
545
hpte_v = hpte_get_old_v (hptep );
519
546
520
- if (HPTE_V_COMPARE (hpte_v , want_v ) && (hpte_v & HPTE_V_VALID ))
547
+ if (HPTE_V_COMPARE (hpte_v , want_v ) && (hpte_v & HPTE_V_VALID )) {
521
548
/* Invalidate the hpte. NOTE: this also unlocks it */
549
+ release_hpte_lock ();
522
550
hptep -> v = 0 ;
523
- else
551
+ } else
524
552
native_unlock_hpte (hptep );
525
553
}
526
554
/*
@@ -580,10 +608,8 @@ static void native_hugepage_invalidate(unsigned long vsid,
580
608
hpte_v = hpte_get_old_v (hptep );
581
609
582
610
if (HPTE_V_COMPARE (hpte_v , want_v ) && (hpte_v & HPTE_V_VALID )) {
583
- /*
584
- * Invalidate the hpte. NOTE: this also unlocks it
585
- */
586
-
611
+ /* Invalidate the hpte. NOTE: this also unlocks it */
612
+ release_hpte_lock ();
587
613
hptep -> v = 0 ;
588
614
} else
589
615
native_unlock_hpte (hptep );
@@ -765,8 +791,10 @@ static void native_flush_hash_range(unsigned long number, int local)
765
791
766
792
if (!HPTE_V_COMPARE (hpte_v , want_v ) || !(hpte_v & HPTE_V_VALID ))
767
793
native_unlock_hpte (hptep );
768
- else
794
+ else {
795
+ release_hpte_lock ();
769
796
hptep -> v = 0 ;
797
+ }
770
798
771
799
} pte_iterate_hashed_end ();
772
800
}
0 commit comments