1 // SPDX-License-Identifier: GPL-2.0
3 // Generated by scripts/atomic/gen-atomic-instrumented.sh
4 // DO NOT MODIFY THIS FILE DIRECTLY
7 * This file provides wrappers with KASAN instrumentation for atomic operations.
8 * To use this functionality an arch's atomic.h file needs to define all
9 * atomic operations with arch_ prefix (e.g. arch_atomic_read()) and include
10 * this file at the end. This file provides atomic_read() that forwards to
11 * arch_atomic_read() for actual atomic operation.
12 * Note: if an arch atomic operation is implemented by means of other atomic
13 * operations (e.g. atomic_read()/atomic_cmpxchg() loop), then it needs to use
14 * arch_ variants (i.e. arch_atomic_read()/arch_atomic_cmpxchg()) to avoid
15 * double instrumentation.
17 #ifndef _LINUX_ATOMIC_INSTRUMENTED_H
18 #define _LINUX_ATOMIC_INSTRUMENTED_H
20 #include <linux/build_bug.h>
21 #include <linux/compiler.h>
22 #include <linux/instrumented.h>
24 static __always_inline int
25 atomic_read(const atomic_t *v)
27 instrument_atomic_read(v, sizeof(*v));
28 return arch_atomic_read(v);
31 static __always_inline int
32 atomic_read_acquire(const atomic_t *v)
34 instrument_atomic_read(v, sizeof(*v));
35 return arch_atomic_read_acquire(v);
38 static __always_inline void
39 atomic_set(atomic_t *v, int i)
41 instrument_atomic_write(v, sizeof(*v));
42 arch_atomic_set(v, i);
45 static __always_inline void
46 atomic_set_release(atomic_t *v, int i)
49 instrument_atomic_write(v, sizeof(*v));
50 arch_atomic_set_release(v, i);
53 static __always_inline void
54 atomic_add(int i, atomic_t *v)
56 instrument_atomic_read_write(v, sizeof(*v));
57 arch_atomic_add(i, v);
60 static __always_inline int
61 atomic_add_return(int i, atomic_t *v)
64 instrument_atomic_read_write(v, sizeof(*v));
65 return arch_atomic_add_return(i, v);
68 static __always_inline int
69 atomic_add_return_acquire(int i, atomic_t *v)
71 instrument_atomic_read_write(v, sizeof(*v));
72 return arch_atomic_add_return_acquire(i, v);
75 static __always_inline int
76 atomic_add_return_release(int i, atomic_t *v)
79 instrument_atomic_read_write(v, sizeof(*v));
80 return arch_atomic_add_return_release(i, v);
83 static __always_inline int
84 atomic_add_return_relaxed(int i, atomic_t *v)
86 instrument_atomic_read_write(v, sizeof(*v));
87 return arch_atomic_add_return_relaxed(i, v);
90 static __always_inline int
91 atomic_fetch_add(int i, atomic_t *v)
94 instrument_atomic_read_write(v, sizeof(*v));
95 return arch_atomic_fetch_add(i, v);
98 static __always_inline int
99 atomic_fetch_add_acquire(int i, atomic_t *v)
101 instrument_atomic_read_write(v, sizeof(*v));
102 return arch_atomic_fetch_add_acquire(i, v);
105 static __always_inline int
106 atomic_fetch_add_release(int i, atomic_t *v)
109 instrument_atomic_read_write(v, sizeof(*v));
110 return arch_atomic_fetch_add_release(i, v);
113 static __always_inline int
114 atomic_fetch_add_relaxed(int i, atomic_t *v)
116 instrument_atomic_read_write(v, sizeof(*v));
117 return arch_atomic_fetch_add_relaxed(i, v);
120 static __always_inline void
121 atomic_sub(int i, atomic_t *v)
123 instrument_atomic_read_write(v, sizeof(*v));
124 arch_atomic_sub(i, v);
127 static __always_inline int
128 atomic_sub_return(int i, atomic_t *v)
131 instrument_atomic_read_write(v, sizeof(*v));
132 return arch_atomic_sub_return(i, v);
135 static __always_inline int
136 atomic_sub_return_acquire(int i, atomic_t *v)
138 instrument_atomic_read_write(v, sizeof(*v));
139 return arch_atomic_sub_return_acquire(i, v);
142 static __always_inline int
143 atomic_sub_return_release(int i, atomic_t *v)
146 instrument_atomic_read_write(v, sizeof(*v));
147 return arch_atomic_sub_return_release(i, v);
150 static __always_inline int
151 atomic_sub_return_relaxed(int i, atomic_t *v)
153 instrument_atomic_read_write(v, sizeof(*v));
154 return arch_atomic_sub_return_relaxed(i, v);
157 static __always_inline int
158 atomic_fetch_sub(int i, atomic_t *v)
161 instrument_atomic_read_write(v, sizeof(*v));
162 return arch_atomic_fetch_sub(i, v);
165 static __always_inline int
166 atomic_fetch_sub_acquire(int i, atomic_t *v)
168 instrument_atomic_read_write(v, sizeof(*v));
169 return arch_atomic_fetch_sub_acquire(i, v);
172 static __always_inline int
173 atomic_fetch_sub_release(int i, atomic_t *v)
176 instrument_atomic_read_write(v, sizeof(*v));
177 return arch_atomic_fetch_sub_release(i, v);
180 static __always_inline int
181 atomic_fetch_sub_relaxed(int i, atomic_t *v)
183 instrument_atomic_read_write(v, sizeof(*v));
184 return arch_atomic_fetch_sub_relaxed(i, v);
187 static __always_inline void
188 atomic_inc(atomic_t *v)
190 instrument_atomic_read_write(v, sizeof(*v));
194 static __always_inline int
195 atomic_inc_return(atomic_t *v)
198 instrument_atomic_read_write(v, sizeof(*v));
199 return arch_atomic_inc_return(v);
202 static __always_inline int
203 atomic_inc_return_acquire(atomic_t *v)
205 instrument_atomic_read_write(v, sizeof(*v));
206 return arch_atomic_inc_return_acquire(v);
209 static __always_inline int
210 atomic_inc_return_release(atomic_t *v)
213 instrument_atomic_read_write(v, sizeof(*v));
214 return arch_atomic_inc_return_release(v);
217 static __always_inline int
218 atomic_inc_return_relaxed(atomic_t *v)
220 instrument_atomic_read_write(v, sizeof(*v));
221 return arch_atomic_inc_return_relaxed(v);
224 static __always_inline int
225 atomic_fetch_inc(atomic_t *v)
228 instrument_atomic_read_write(v, sizeof(*v));
229 return arch_atomic_fetch_inc(v);
232 static __always_inline int
233 atomic_fetch_inc_acquire(atomic_t *v)
235 instrument_atomic_read_write(v, sizeof(*v));
236 return arch_atomic_fetch_inc_acquire(v);
239 static __always_inline int
240 atomic_fetch_inc_release(atomic_t *v)
243 instrument_atomic_read_write(v, sizeof(*v));
244 return arch_atomic_fetch_inc_release(v);
247 static __always_inline int
248 atomic_fetch_inc_relaxed(atomic_t *v)
250 instrument_atomic_read_write(v, sizeof(*v));
251 return arch_atomic_fetch_inc_relaxed(v);
254 static __always_inline void
255 atomic_dec(atomic_t *v)
257 instrument_atomic_read_write(v, sizeof(*v));
261 static __always_inline int
262 atomic_dec_return(atomic_t *v)
265 instrument_atomic_read_write(v, sizeof(*v));
266 return arch_atomic_dec_return(v);
269 static __always_inline int
270 atomic_dec_return_acquire(atomic_t *v)
272 instrument_atomic_read_write(v, sizeof(*v));
273 return arch_atomic_dec_return_acquire(v);
276 static __always_inline int
277 atomic_dec_return_release(atomic_t *v)
280 instrument_atomic_read_write(v, sizeof(*v));
281 return arch_atomic_dec_return_release(v);
284 static __always_inline int
285 atomic_dec_return_relaxed(atomic_t *v)
287 instrument_atomic_read_write(v, sizeof(*v));
288 return arch_atomic_dec_return_relaxed(v);
291 static __always_inline int
292 atomic_fetch_dec(atomic_t *v)
295 instrument_atomic_read_write(v, sizeof(*v));
296 return arch_atomic_fetch_dec(v);
299 static __always_inline int
300 atomic_fetch_dec_acquire(atomic_t *v)
302 instrument_atomic_read_write(v, sizeof(*v));
303 return arch_atomic_fetch_dec_acquire(v);
306 static __always_inline int
307 atomic_fetch_dec_release(atomic_t *v)
310 instrument_atomic_read_write(v, sizeof(*v));
311 return arch_atomic_fetch_dec_release(v);
314 static __always_inline int
315 atomic_fetch_dec_relaxed(atomic_t *v)
317 instrument_atomic_read_write(v, sizeof(*v));
318 return arch_atomic_fetch_dec_relaxed(v);
321 static __always_inline void
322 atomic_and(int i, atomic_t *v)
324 instrument_atomic_read_write(v, sizeof(*v));
325 arch_atomic_and(i, v);
328 static __always_inline int
329 atomic_fetch_and(int i, atomic_t *v)
332 instrument_atomic_read_write(v, sizeof(*v));
333 return arch_atomic_fetch_and(i, v);
336 static __always_inline int
337 atomic_fetch_and_acquire(int i, atomic_t *v)
339 instrument_atomic_read_write(v, sizeof(*v));
340 return arch_atomic_fetch_and_acquire(i, v);
343 static __always_inline int
344 atomic_fetch_and_release(int i, atomic_t *v)
347 instrument_atomic_read_write(v, sizeof(*v));
348 return arch_atomic_fetch_and_release(i, v);
351 static __always_inline int
352 atomic_fetch_and_relaxed(int i, atomic_t *v)
354 instrument_atomic_read_write(v, sizeof(*v));
355 return arch_atomic_fetch_and_relaxed(i, v);
358 static __always_inline void
359 atomic_andnot(int i, atomic_t *v)
361 instrument_atomic_read_write(v, sizeof(*v));
362 arch_atomic_andnot(i, v);
365 static __always_inline int
366 atomic_fetch_andnot(int i, atomic_t *v)
369 instrument_atomic_read_write(v, sizeof(*v));
370 return arch_atomic_fetch_andnot(i, v);
373 static __always_inline int
374 atomic_fetch_andnot_acquire(int i, atomic_t *v)
376 instrument_atomic_read_write(v, sizeof(*v));
377 return arch_atomic_fetch_andnot_acquire(i, v);
380 static __always_inline int
381 atomic_fetch_andnot_release(int i, atomic_t *v)
384 instrument_atomic_read_write(v, sizeof(*v));
385 return arch_atomic_fetch_andnot_release(i, v);
388 static __always_inline int
389 atomic_fetch_andnot_relaxed(int i, atomic_t *v)
391 instrument_atomic_read_write(v, sizeof(*v));
392 return arch_atomic_fetch_andnot_relaxed(i, v);
395 static __always_inline void
396 atomic_or(int i, atomic_t *v)
398 instrument_atomic_read_write(v, sizeof(*v));
399 arch_atomic_or(i, v);
402 static __always_inline int
403 atomic_fetch_or(int i, atomic_t *v)
406 instrument_atomic_read_write(v, sizeof(*v));
407 return arch_atomic_fetch_or(i, v);
410 static __always_inline int
411 atomic_fetch_or_acquire(int i, atomic_t *v)
413 instrument_atomic_read_write(v, sizeof(*v));
414 return arch_atomic_fetch_or_acquire(i, v);
417 static __always_inline int
418 atomic_fetch_or_release(int i, atomic_t *v)
421 instrument_atomic_read_write(v, sizeof(*v));
422 return arch_atomic_fetch_or_release(i, v);
425 static __always_inline int
426 atomic_fetch_or_relaxed(int i, atomic_t *v)
428 instrument_atomic_read_write(v, sizeof(*v));
429 return arch_atomic_fetch_or_relaxed(i, v);
432 static __always_inline void
433 atomic_xor(int i, atomic_t *v)
435 instrument_atomic_read_write(v, sizeof(*v));
436 arch_atomic_xor(i, v);
439 static __always_inline int
440 atomic_fetch_xor(int i, atomic_t *v)
443 instrument_atomic_read_write(v, sizeof(*v));
444 return arch_atomic_fetch_xor(i, v);
447 static __always_inline int
448 atomic_fetch_xor_acquire(int i, atomic_t *v)
450 instrument_atomic_read_write(v, sizeof(*v));
451 return arch_atomic_fetch_xor_acquire(i, v);
454 static __always_inline int
455 atomic_fetch_xor_release(int i, atomic_t *v)
458 instrument_atomic_read_write(v, sizeof(*v));
459 return arch_atomic_fetch_xor_release(i, v);
462 static __always_inline int
463 atomic_fetch_xor_relaxed(int i, atomic_t *v)
465 instrument_atomic_read_write(v, sizeof(*v));
466 return arch_atomic_fetch_xor_relaxed(i, v);
469 static __always_inline int
470 atomic_xchg(atomic_t *v, int i)
473 instrument_atomic_read_write(v, sizeof(*v));
474 return arch_atomic_xchg(v, i);
477 static __always_inline int
478 atomic_xchg_acquire(atomic_t *v, int i)
480 instrument_atomic_read_write(v, sizeof(*v));
481 return arch_atomic_xchg_acquire(v, i);
484 static __always_inline int
485 atomic_xchg_release(atomic_t *v, int i)
488 instrument_atomic_read_write(v, sizeof(*v));
489 return arch_atomic_xchg_release(v, i);
492 static __always_inline int
493 atomic_xchg_relaxed(atomic_t *v, int i)
495 instrument_atomic_read_write(v, sizeof(*v));
496 return arch_atomic_xchg_relaxed(v, i);
499 static __always_inline int
500 atomic_cmpxchg(atomic_t *v, int old, int new)
503 instrument_atomic_read_write(v, sizeof(*v));
504 return arch_atomic_cmpxchg(v, old, new);
507 static __always_inline int
508 atomic_cmpxchg_acquire(atomic_t *v, int old, int new)
510 instrument_atomic_read_write(v, sizeof(*v));
511 return arch_atomic_cmpxchg_acquire(v, old, new);
514 static __always_inline int
515 atomic_cmpxchg_release(atomic_t *v, int old, int new)
518 instrument_atomic_read_write(v, sizeof(*v));
519 return arch_atomic_cmpxchg_release(v, old, new);
522 static __always_inline int
523 atomic_cmpxchg_relaxed(atomic_t *v, int old, int new)
525 instrument_atomic_read_write(v, sizeof(*v));
526 return arch_atomic_cmpxchg_relaxed(v, old, new);
529 static __always_inline bool
530 atomic_try_cmpxchg(atomic_t *v, int *old, int new)
533 instrument_atomic_read_write(v, sizeof(*v));
534 instrument_atomic_read_write(old, sizeof(*old));
535 return arch_atomic_try_cmpxchg(v, old, new);
538 static __always_inline bool
539 atomic_try_cmpxchg_acquire(atomic_t *v, int *old, int new)
541 instrument_atomic_read_write(v, sizeof(*v));
542 instrument_atomic_read_write(old, sizeof(*old));
543 return arch_atomic_try_cmpxchg_acquire(v, old, new);
546 static __always_inline bool
547 atomic_try_cmpxchg_release(atomic_t *v, int *old, int new)
550 instrument_atomic_read_write(v, sizeof(*v));
551 instrument_atomic_read_write(old, sizeof(*old));
552 return arch_atomic_try_cmpxchg_release(v, old, new);
555 static __always_inline bool
556 atomic_try_cmpxchg_relaxed(atomic_t *v, int *old, int new)
558 instrument_atomic_read_write(v, sizeof(*v));
559 instrument_atomic_read_write(old, sizeof(*old));
560 return arch_atomic_try_cmpxchg_relaxed(v, old, new);
563 static __always_inline bool
564 atomic_sub_and_test(int i, atomic_t *v)
567 instrument_atomic_read_write(v, sizeof(*v));
568 return arch_atomic_sub_and_test(i, v);
571 static __always_inline bool
572 atomic_dec_and_test(atomic_t *v)
575 instrument_atomic_read_write(v, sizeof(*v));
576 return arch_atomic_dec_and_test(v);
579 static __always_inline bool
580 atomic_inc_and_test(atomic_t *v)
583 instrument_atomic_read_write(v, sizeof(*v));
584 return arch_atomic_inc_and_test(v);
587 static __always_inline bool
588 atomic_add_negative(int i, atomic_t *v)
591 instrument_atomic_read_write(v, sizeof(*v));
592 return arch_atomic_add_negative(i, v);
595 static __always_inline bool
596 atomic_add_negative_acquire(int i, atomic_t *v)
598 instrument_atomic_read_write(v, sizeof(*v));
599 return arch_atomic_add_negative_acquire(i, v);
602 static __always_inline bool
603 atomic_add_negative_release(int i, atomic_t *v)
606 instrument_atomic_read_write(v, sizeof(*v));
607 return arch_atomic_add_negative_release(i, v);
610 static __always_inline bool
611 atomic_add_negative_relaxed(int i, atomic_t *v)
613 instrument_atomic_read_write(v, sizeof(*v));
614 return arch_atomic_add_negative_relaxed(i, v);
617 static __always_inline int
618 atomic_fetch_add_unless(atomic_t *v, int a, int u)
621 instrument_atomic_read_write(v, sizeof(*v));
622 return arch_atomic_fetch_add_unless(v, a, u);
625 static __always_inline bool
626 atomic_add_unless(atomic_t *v, int a, int u)
629 instrument_atomic_read_write(v, sizeof(*v));
630 return arch_atomic_add_unless(v, a, u);
633 static __always_inline bool
634 atomic_inc_not_zero(atomic_t *v)
637 instrument_atomic_read_write(v, sizeof(*v));
638 return arch_atomic_inc_not_zero(v);
641 static __always_inline bool
642 atomic_inc_unless_negative(atomic_t *v)
645 instrument_atomic_read_write(v, sizeof(*v));
646 return arch_atomic_inc_unless_negative(v);
649 static __always_inline bool
650 atomic_dec_unless_positive(atomic_t *v)
653 instrument_atomic_read_write(v, sizeof(*v));
654 return arch_atomic_dec_unless_positive(v);
657 static __always_inline int
658 atomic_dec_if_positive(atomic_t *v)
661 instrument_atomic_read_write(v, sizeof(*v));
662 return arch_atomic_dec_if_positive(v);
665 static __always_inline s64
666 atomic64_read(const atomic64_t *v)
668 instrument_atomic_read(v, sizeof(*v));
669 return arch_atomic64_read(v);
672 static __always_inline s64
673 atomic64_read_acquire(const atomic64_t *v)
675 instrument_atomic_read(v, sizeof(*v));
676 return arch_atomic64_read_acquire(v);
679 static __always_inline void
680 atomic64_set(atomic64_t *v, s64 i)
682 instrument_atomic_write(v, sizeof(*v));
683 arch_atomic64_set(v, i);
686 static __always_inline void
687 atomic64_set_release(atomic64_t *v, s64 i)
690 instrument_atomic_write(v, sizeof(*v));
691 arch_atomic64_set_release(v, i);
694 static __always_inline void
695 atomic64_add(s64 i, atomic64_t *v)
697 instrument_atomic_read_write(v, sizeof(*v));
698 arch_atomic64_add(i, v);
701 static __always_inline s64
702 atomic64_add_return(s64 i, atomic64_t *v)
705 instrument_atomic_read_write(v, sizeof(*v));
706 return arch_atomic64_add_return(i, v);
709 static __always_inline s64
710 atomic64_add_return_acquire(s64 i, atomic64_t *v)
712 instrument_atomic_read_write(v, sizeof(*v));
713 return arch_atomic64_add_return_acquire(i, v);
716 static __always_inline s64
717 atomic64_add_return_release(s64 i, atomic64_t *v)
720 instrument_atomic_read_write(v, sizeof(*v));
721 return arch_atomic64_add_return_release(i, v);
724 static __always_inline s64
725 atomic64_add_return_relaxed(s64 i, atomic64_t *v)
727 instrument_atomic_read_write(v, sizeof(*v));
728 return arch_atomic64_add_return_relaxed(i, v);
731 static __always_inline s64
732 atomic64_fetch_add(s64 i, atomic64_t *v)
735 instrument_atomic_read_write(v, sizeof(*v));
736 return arch_atomic64_fetch_add(i, v);
739 static __always_inline s64
740 atomic64_fetch_add_acquire(s64 i, atomic64_t *v)
742 instrument_atomic_read_write(v, sizeof(*v));
743 return arch_atomic64_fetch_add_acquire(i, v);
746 static __always_inline s64
747 atomic64_fetch_add_release(s64 i, atomic64_t *v)
750 instrument_atomic_read_write(v, sizeof(*v));
751 return arch_atomic64_fetch_add_release(i, v);
754 static __always_inline s64
755 atomic64_fetch_add_relaxed(s64 i, atomic64_t *v)
757 instrument_atomic_read_write(v, sizeof(*v));
758 return arch_atomic64_fetch_add_relaxed(i, v);
761 static __always_inline void
762 atomic64_sub(s64 i, atomic64_t *v)
764 instrument_atomic_read_write(v, sizeof(*v));
765 arch_atomic64_sub(i, v);
768 static __always_inline s64
769 atomic64_sub_return(s64 i, atomic64_t *v)
772 instrument_atomic_read_write(v, sizeof(*v));
773 return arch_atomic64_sub_return(i, v);
776 static __always_inline s64
777 atomic64_sub_return_acquire(s64 i, atomic64_t *v)
779 instrument_atomic_read_write(v, sizeof(*v));
780 return arch_atomic64_sub_return_acquire(i, v);
783 static __always_inline s64
784 atomic64_sub_return_release(s64 i, atomic64_t *v)
787 instrument_atomic_read_write(v, sizeof(*v));
788 return arch_atomic64_sub_return_release(i, v);
791 static __always_inline s64
792 atomic64_sub_return_relaxed(s64 i, atomic64_t *v)
794 instrument_atomic_read_write(v, sizeof(*v));
795 return arch_atomic64_sub_return_relaxed(i, v);
798 static __always_inline s64
799 atomic64_fetch_sub(s64 i, atomic64_t *v)
802 instrument_atomic_read_write(v, sizeof(*v));
803 return arch_atomic64_fetch_sub(i, v);
806 static __always_inline s64
807 atomic64_fetch_sub_acquire(s64 i, atomic64_t *v)
809 instrument_atomic_read_write(v, sizeof(*v));
810 return arch_atomic64_fetch_sub_acquire(i, v);
813 static __always_inline s64
814 atomic64_fetch_sub_release(s64 i, atomic64_t *v)
817 instrument_atomic_read_write(v, sizeof(*v));
818 return arch_atomic64_fetch_sub_release(i, v);
821 static __always_inline s64
822 atomic64_fetch_sub_relaxed(s64 i, atomic64_t *v)
824 instrument_atomic_read_write(v, sizeof(*v));
825 return arch_atomic64_fetch_sub_relaxed(i, v);
828 static __always_inline void
829 atomic64_inc(atomic64_t *v)
831 instrument_atomic_read_write(v, sizeof(*v));
832 arch_atomic64_inc(v);
835 static __always_inline s64
836 atomic64_inc_return(atomic64_t *v)
839 instrument_atomic_read_write(v, sizeof(*v));
840 return arch_atomic64_inc_return(v);
843 static __always_inline s64
844 atomic64_inc_return_acquire(atomic64_t *v)
846 instrument_atomic_read_write(v, sizeof(*v));
847 return arch_atomic64_inc_return_acquire(v);
850 static __always_inline s64
851 atomic64_inc_return_release(atomic64_t *v)
854 instrument_atomic_read_write(v, sizeof(*v));
855 return arch_atomic64_inc_return_release(v);
858 static __always_inline s64
859 atomic64_inc_return_relaxed(atomic64_t *v)
861 instrument_atomic_read_write(v, sizeof(*v));
862 return arch_atomic64_inc_return_relaxed(v);
865 static __always_inline s64
866 atomic64_fetch_inc(atomic64_t *v)
869 instrument_atomic_read_write(v, sizeof(*v));
870 return arch_atomic64_fetch_inc(v);
873 static __always_inline s64
874 atomic64_fetch_inc_acquire(atomic64_t *v)
876 instrument_atomic_read_write(v, sizeof(*v));
877 return arch_atomic64_fetch_inc_acquire(v);
880 static __always_inline s64
881 atomic64_fetch_inc_release(atomic64_t *v)
884 instrument_atomic_read_write(v, sizeof(*v));
885 return arch_atomic64_fetch_inc_release(v);
888 static __always_inline s64
889 atomic64_fetch_inc_relaxed(atomic64_t *v)
891 instrument_atomic_read_write(v, sizeof(*v));
892 return arch_atomic64_fetch_inc_relaxed(v);
895 static __always_inline void
896 atomic64_dec(atomic64_t *v)
898 instrument_atomic_read_write(v, sizeof(*v));
899 arch_atomic64_dec(v);
902 static __always_inline s64
903 atomic64_dec_return(atomic64_t *v)
906 instrument_atomic_read_write(v, sizeof(*v));
907 return arch_atomic64_dec_return(v);
910 static __always_inline s64
911 atomic64_dec_return_acquire(atomic64_t *v)
913 instrument_atomic_read_write(v, sizeof(*v));
914 return arch_atomic64_dec_return_acquire(v);
917 static __always_inline s64
918 atomic64_dec_return_release(atomic64_t *v)
921 instrument_atomic_read_write(v, sizeof(*v));
922 return arch_atomic64_dec_return_release(v);
925 static __always_inline s64
926 atomic64_dec_return_relaxed(atomic64_t *v)
928 instrument_atomic_read_write(v, sizeof(*v));
929 return arch_atomic64_dec_return_relaxed(v);
932 static __always_inline s64
933 atomic64_fetch_dec(atomic64_t *v)
936 instrument_atomic_read_write(v, sizeof(*v));
937 return arch_atomic64_fetch_dec(v);
940 static __always_inline s64
941 atomic64_fetch_dec_acquire(atomic64_t *v)
943 instrument_atomic_read_write(v, sizeof(*v));
944 return arch_atomic64_fetch_dec_acquire(v);
947 static __always_inline s64
948 atomic64_fetch_dec_release(atomic64_t *v)
951 instrument_atomic_read_write(v, sizeof(*v));
952 return arch_atomic64_fetch_dec_release(v);
955 static __always_inline s64
956 atomic64_fetch_dec_relaxed(atomic64_t *v)
958 instrument_atomic_read_write(v, sizeof(*v));
959 return arch_atomic64_fetch_dec_relaxed(v);
962 static __always_inline void
963 atomic64_and(s64 i, atomic64_t *v)
965 instrument_atomic_read_write(v, sizeof(*v));
966 arch_atomic64_and(i, v);
969 static __always_inline s64
970 atomic64_fetch_and(s64 i, atomic64_t *v)
973 instrument_atomic_read_write(v, sizeof(*v));
974 return arch_atomic64_fetch_and(i, v);
977 static __always_inline s64
978 atomic64_fetch_and_acquire(s64 i, atomic64_t *v)
980 instrument_atomic_read_write(v, sizeof(*v));
981 return arch_atomic64_fetch_and_acquire(i, v);
984 static __always_inline s64
985 atomic64_fetch_and_release(s64 i, atomic64_t *v)
988 instrument_atomic_read_write(v, sizeof(*v));
989 return arch_atomic64_fetch_and_release(i, v);
992 static __always_inline s64
993 atomic64_fetch_and_relaxed(s64 i, atomic64_t *v)
995 instrument_atomic_read_write(v, sizeof(*v));
996 return arch_atomic64_fetch_and_relaxed(i, v);
999 static __always_inline void
1000 atomic64_andnot(s64 i, atomic64_t *v)
1002 instrument_atomic_read_write(v, sizeof(*v));
1003 arch_atomic64_andnot(i, v);
1006 static __always_inline s64
1007 atomic64_fetch_andnot(s64 i, atomic64_t *v)
1010 instrument_atomic_read_write(v, sizeof(*v));
1011 return arch_atomic64_fetch_andnot(i, v);
1014 static __always_inline s64
1015 atomic64_fetch_andnot_acquire(s64 i, atomic64_t *v)
1017 instrument_atomic_read_write(v, sizeof(*v));
1018 return arch_atomic64_fetch_andnot_acquire(i, v);
1021 static __always_inline s64
1022 atomic64_fetch_andnot_release(s64 i, atomic64_t *v)
1025 instrument_atomic_read_write(v, sizeof(*v));
1026 return arch_atomic64_fetch_andnot_release(i, v);
1029 static __always_inline s64
1030 atomic64_fetch_andnot_relaxed(s64 i, atomic64_t *v)
1032 instrument_atomic_read_write(v, sizeof(*v));
1033 return arch_atomic64_fetch_andnot_relaxed(i, v);
1036 static __always_inline void
1037 atomic64_or(s64 i, atomic64_t *v)
1039 instrument_atomic_read_write(v, sizeof(*v));
1040 arch_atomic64_or(i, v);
1043 static __always_inline s64
1044 atomic64_fetch_or(s64 i, atomic64_t *v)
1047 instrument_atomic_read_write(v, sizeof(*v));
1048 return arch_atomic64_fetch_or(i, v);
1051 static __always_inline s64
1052 atomic64_fetch_or_acquire(s64 i, atomic64_t *v)
1054 instrument_atomic_read_write(v, sizeof(*v));
1055 return arch_atomic64_fetch_or_acquire(i, v);
1058 static __always_inline s64
1059 atomic64_fetch_or_release(s64 i, atomic64_t *v)
1062 instrument_atomic_read_write(v, sizeof(*v));
1063 return arch_atomic64_fetch_or_release(i, v);
1066 static __always_inline s64
1067 atomic64_fetch_or_relaxed(s64 i, atomic64_t *v)
1069 instrument_atomic_read_write(v, sizeof(*v));
1070 return arch_atomic64_fetch_or_relaxed(i, v);
1073 static __always_inline void
1074 atomic64_xor(s64 i, atomic64_t *v)
1076 instrument_atomic_read_write(v, sizeof(*v));
1077 arch_atomic64_xor(i, v);
1080 static __always_inline s64
1081 atomic64_fetch_xor(s64 i, atomic64_t *v)
1084 instrument_atomic_read_write(v, sizeof(*v));
1085 return arch_atomic64_fetch_xor(i, v);
1088 static __always_inline s64
1089 atomic64_fetch_xor_acquire(s64 i, atomic64_t *v)
1091 instrument_atomic_read_write(v, sizeof(*v));
1092 return arch_atomic64_fetch_xor_acquire(i, v);
1095 static __always_inline s64
1096 atomic64_fetch_xor_release(s64 i, atomic64_t *v)
1099 instrument_atomic_read_write(v, sizeof(*v));
1100 return arch_atomic64_fetch_xor_release(i, v);
1103 static __always_inline s64
1104 atomic64_fetch_xor_relaxed(s64 i, atomic64_t *v)
1106 instrument_atomic_read_write(v, sizeof(*v));
1107 return arch_atomic64_fetch_xor_relaxed(i, v);
1110 static __always_inline s64
1111 atomic64_xchg(atomic64_t *v, s64 i)
1114 instrument_atomic_read_write(v, sizeof(*v));
1115 return arch_atomic64_xchg(v, i);
1118 static __always_inline s64
1119 atomic64_xchg_acquire(atomic64_t *v, s64 i)
1121 instrument_atomic_read_write(v, sizeof(*v));
1122 return arch_atomic64_xchg_acquire(v, i);
1125 static __always_inline s64
1126 atomic64_xchg_release(atomic64_t *v, s64 i)
1129 instrument_atomic_read_write(v, sizeof(*v));
1130 return arch_atomic64_xchg_release(v, i);
1133 static __always_inline s64
1134 atomic64_xchg_relaxed(atomic64_t *v, s64 i)
1136 instrument_atomic_read_write(v, sizeof(*v));
1137 return arch_atomic64_xchg_relaxed(v, i);
1140 static __always_inline s64
1141 atomic64_cmpxchg(atomic64_t *v, s64 old, s64 new)
1144 instrument_atomic_read_write(v, sizeof(*v));
1145 return arch_atomic64_cmpxchg(v, old, new);
1148 static __always_inline s64
1149 atomic64_cmpxchg_acquire(atomic64_t *v, s64 old, s64 new)
1151 instrument_atomic_read_write(v, sizeof(*v));
1152 return arch_atomic64_cmpxchg_acquire(v, old, new);
1155 static __always_inline s64
1156 atomic64_cmpxchg_release(atomic64_t *v, s64 old, s64 new)
1159 instrument_atomic_read_write(v, sizeof(*v));
1160 return arch_atomic64_cmpxchg_release(v, old, new);
1163 static __always_inline s64
1164 atomic64_cmpxchg_relaxed(atomic64_t *v, s64 old, s64 new)
1166 instrument_atomic_read_write(v, sizeof(*v));
1167 return arch_atomic64_cmpxchg_relaxed(v, old, new);
1170 static __always_inline bool
1171 atomic64_try_cmpxchg(atomic64_t *v, s64 *old, s64 new)
1174 instrument_atomic_read_write(v, sizeof(*v));
1175 instrument_atomic_read_write(old, sizeof(*old));
1176 return arch_atomic64_try_cmpxchg(v, old, new);
1179 static __always_inline bool
1180 atomic64_try_cmpxchg_acquire(atomic64_t *v, s64 *old, s64 new)
1182 instrument_atomic_read_write(v, sizeof(*v));
1183 instrument_atomic_read_write(old, sizeof(*old));
1184 return arch_atomic64_try_cmpxchg_acquire(v, old, new);
1187 static __always_inline bool
1188 atomic64_try_cmpxchg_release(atomic64_t *v, s64 *old, s64 new)
1191 instrument_atomic_read_write(v, sizeof(*v));
1192 instrument_atomic_read_write(old, sizeof(*old));
1193 return arch_atomic64_try_cmpxchg_release(v, old, new);
1196 static __always_inline bool
1197 atomic64_try_cmpxchg_relaxed(atomic64_t *v, s64 *old, s64 new)
1199 instrument_atomic_read_write(v, sizeof(*v));
1200 instrument_atomic_read_write(old, sizeof(*old));
1201 return arch_atomic64_try_cmpxchg_relaxed(v, old, new);
1204 static __always_inline bool
1205 atomic64_sub_and_test(s64 i, atomic64_t *v)
1208 instrument_atomic_read_write(v, sizeof(*v));
1209 return arch_atomic64_sub_and_test(i, v);
1212 static __always_inline bool
1213 atomic64_dec_and_test(atomic64_t *v)
1216 instrument_atomic_read_write(v, sizeof(*v));
1217 return arch_atomic64_dec_and_test(v);
1220 static __always_inline bool
1221 atomic64_inc_and_test(atomic64_t *v)
1224 instrument_atomic_read_write(v, sizeof(*v));
1225 return arch_atomic64_inc_and_test(v);
1228 static __always_inline bool
1229 atomic64_add_negative(s64 i, atomic64_t *v)
1232 instrument_atomic_read_write(v, sizeof(*v));
1233 return arch_atomic64_add_negative(i, v);
1236 static __always_inline bool
1237 atomic64_add_negative_acquire(s64 i, atomic64_t *v)
1239 instrument_atomic_read_write(v, sizeof(*v));
1240 return arch_atomic64_add_negative_acquire(i, v);
1243 static __always_inline bool
1244 atomic64_add_negative_release(s64 i, atomic64_t *v)
1247 instrument_atomic_read_write(v, sizeof(*v));
1248 return arch_atomic64_add_negative_release(i, v);
1251 static __always_inline bool
1252 atomic64_add_negative_relaxed(s64 i, atomic64_t *v)
1254 instrument_atomic_read_write(v, sizeof(*v));
1255 return arch_atomic64_add_negative_relaxed(i, v);
1258 static __always_inline s64
1259 atomic64_fetch_add_unless(atomic64_t *v, s64 a, s64 u)
1262 instrument_atomic_read_write(v, sizeof(*v));
1263 return arch_atomic64_fetch_add_unless(v, a, u);
1266 static __always_inline bool
1267 atomic64_add_unless(atomic64_t *v, s64 a, s64 u)
1270 instrument_atomic_read_write(v, sizeof(*v));
1271 return arch_atomic64_add_unless(v, a, u);
1274 static __always_inline bool
1275 atomic64_inc_not_zero(atomic64_t *v)
1278 instrument_atomic_read_write(v, sizeof(*v));
1279 return arch_atomic64_inc_not_zero(v);
1282 static __always_inline bool
1283 atomic64_inc_unless_negative(atomic64_t *v)
1286 instrument_atomic_read_write(v, sizeof(*v));
1287 return arch_atomic64_inc_unless_negative(v);
1290 static __always_inline bool
1291 atomic64_dec_unless_positive(atomic64_t *v)
1294 instrument_atomic_read_write(v, sizeof(*v));
1295 return arch_atomic64_dec_unless_positive(v);
1298 static __always_inline s64
1299 atomic64_dec_if_positive(atomic64_t *v)
1302 instrument_atomic_read_write(v, sizeof(*v));
1303 return arch_atomic64_dec_if_positive(v);
1306 static __always_inline long
1307 atomic_long_read(const atomic_long_t *v)
1309 instrument_atomic_read(v, sizeof(*v));
1310 return arch_atomic_long_read(v);
1313 static __always_inline long
1314 atomic_long_read_acquire(const atomic_long_t *v)
1316 instrument_atomic_read(v, sizeof(*v));
1317 return arch_atomic_long_read_acquire(v);
1320 static __always_inline void
1321 atomic_long_set(atomic_long_t *v, long i)
1323 instrument_atomic_write(v, sizeof(*v));
1324 arch_atomic_long_set(v, i);
1327 static __always_inline void
1328 atomic_long_set_release(atomic_long_t *v, long i)
1331 instrument_atomic_write(v, sizeof(*v));
1332 arch_atomic_long_set_release(v, i);
1335 static __always_inline void
1336 atomic_long_add(long i, atomic_long_t *v)
1338 instrument_atomic_read_write(v, sizeof(*v));
1339 arch_atomic_long_add(i, v);
1342 static __always_inline long
1343 atomic_long_add_return(long i, atomic_long_t *v)
1346 instrument_atomic_read_write(v, sizeof(*v));
1347 return arch_atomic_long_add_return(i, v);
1350 static __always_inline long
1351 atomic_long_add_return_acquire(long i, atomic_long_t *v)
1353 instrument_atomic_read_write(v, sizeof(*v));
1354 return arch_atomic_long_add_return_acquire(i, v);
1357 static __always_inline long
1358 atomic_long_add_return_release(long i, atomic_long_t *v)
1361 instrument_atomic_read_write(v, sizeof(*v));
1362 return arch_atomic_long_add_return_release(i, v);
1365 static __always_inline long
1366 atomic_long_add_return_relaxed(long i, atomic_long_t *v)
1368 instrument_atomic_read_write(v, sizeof(*v));
1369 return arch_atomic_long_add_return_relaxed(i, v);
1372 static __always_inline long
1373 atomic_long_fetch_add(long i, atomic_long_t *v)
1376 instrument_atomic_read_write(v, sizeof(*v));
1377 return arch_atomic_long_fetch_add(i, v);
1380 static __always_inline long
1381 atomic_long_fetch_add_acquire(long i, atomic_long_t *v)
1383 instrument_atomic_read_write(v, sizeof(*v));
1384 return arch_atomic_long_fetch_add_acquire(i, v);
1387 static __always_inline long
1388 atomic_long_fetch_add_release(long i, atomic_long_t *v)
1391 instrument_atomic_read_write(v, sizeof(*v));
1392 return arch_atomic_long_fetch_add_release(i, v);
1395 static __always_inline long
1396 atomic_long_fetch_add_relaxed(long i, atomic_long_t *v)
1398 instrument_atomic_read_write(v, sizeof(*v));
1399 return arch_atomic_long_fetch_add_relaxed(i, v);
1402 static __always_inline void
1403 atomic_long_sub(long i, atomic_long_t *v)
1405 instrument_atomic_read_write(v, sizeof(*v));
1406 arch_atomic_long_sub(i, v);
1409 static __always_inline long
1410 atomic_long_sub_return(long i, atomic_long_t *v)
1413 instrument_atomic_read_write(v, sizeof(*v));
1414 return arch_atomic_long_sub_return(i, v);
1417 static __always_inline long
1418 atomic_long_sub_return_acquire(long i, atomic_long_t *v)
1420 instrument_atomic_read_write(v, sizeof(*v));
1421 return arch_atomic_long_sub_return_acquire(i, v);
1424 static __always_inline long
1425 atomic_long_sub_return_release(long i, atomic_long_t *v)
1428 instrument_atomic_read_write(v, sizeof(*v));
1429 return arch_atomic_long_sub_return_release(i, v);
1432 static __always_inline long
1433 atomic_long_sub_return_relaxed(long i, atomic_long_t *v)
1435 instrument_atomic_read_write(v, sizeof(*v));
1436 return arch_atomic_long_sub_return_relaxed(i, v);
1439 static __always_inline long
1440 atomic_long_fetch_sub(long i, atomic_long_t *v)
1443 instrument_atomic_read_write(v, sizeof(*v));
1444 return arch_atomic_long_fetch_sub(i, v);
1447 static __always_inline long
1448 atomic_long_fetch_sub_acquire(long i, atomic_long_t *v)
1450 instrument_atomic_read_write(v, sizeof(*v));
1451 return arch_atomic_long_fetch_sub_acquire(i, v);
1454 static __always_inline long
1455 atomic_long_fetch_sub_release(long i, atomic_long_t *v)
1458 instrument_atomic_read_write(v, sizeof(*v));
1459 return arch_atomic_long_fetch_sub_release(i, v);
1462 static __always_inline long
1463 atomic_long_fetch_sub_relaxed(long i, atomic_long_t *v)
1465 instrument_atomic_read_write(v, sizeof(*v));
1466 return arch_atomic_long_fetch_sub_relaxed(i, v);
1469 static __always_inline void
1470 atomic_long_inc(atomic_long_t *v)
1472 instrument_atomic_read_write(v, sizeof(*v));
1473 arch_atomic_long_inc(v);
1476 static __always_inline long
1477 atomic_long_inc_return(atomic_long_t *v)
1480 instrument_atomic_read_write(v, sizeof(*v));
1481 return arch_atomic_long_inc_return(v);
1484 static __always_inline long
1485 atomic_long_inc_return_acquire(atomic_long_t *v)
1487 instrument_atomic_read_write(v, sizeof(*v));
1488 return arch_atomic_long_inc_return_acquire(v);
1491 static __always_inline long
1492 atomic_long_inc_return_release(atomic_long_t *v)
1495 instrument_atomic_read_write(v, sizeof(*v));
1496 return arch_atomic_long_inc_return_release(v);
1499 static __always_inline long
1500 atomic_long_inc_return_relaxed(atomic_long_t *v)
1502 instrument_atomic_read_write(v, sizeof(*v));
1503 return arch_atomic_long_inc_return_relaxed(v);
1506 static __always_inline long
1507 atomic_long_fetch_inc(atomic_long_t *v)
1510 instrument_atomic_read_write(v, sizeof(*v));
1511 return arch_atomic_long_fetch_inc(v);
1514 static __always_inline long
1515 atomic_long_fetch_inc_acquire(atomic_long_t *v)
1517 instrument_atomic_read_write(v, sizeof(*v));
1518 return arch_atomic_long_fetch_inc_acquire(v);
1521 static __always_inline long
1522 atomic_long_fetch_inc_release(atomic_long_t *v)
1525 instrument_atomic_read_write(v, sizeof(*v));
1526 return arch_atomic_long_fetch_inc_release(v);
1529 static __always_inline long
1530 atomic_long_fetch_inc_relaxed(atomic_long_t *v)
1532 instrument_atomic_read_write(v, sizeof(*v));
1533 return arch_atomic_long_fetch_inc_relaxed(v);
1536 static __always_inline void
1537 atomic_long_dec(atomic_long_t *v)
1539 instrument_atomic_read_write(v, sizeof(*v));
1540 arch_atomic_long_dec(v);
1543 static __always_inline long
1544 atomic_long_dec_return(atomic_long_t *v)
1547 instrument_atomic_read_write(v, sizeof(*v));
1548 return arch_atomic_long_dec_return(v);
1551 static __always_inline long
1552 atomic_long_dec_return_acquire(atomic_long_t *v)
1554 instrument_atomic_read_write(v, sizeof(*v));
1555 return arch_atomic_long_dec_return_acquire(v);
1558 static __always_inline long
1559 atomic_long_dec_return_release(atomic_long_t *v)
1562 instrument_atomic_read_write(v, sizeof(*v));
1563 return arch_atomic_long_dec_return_release(v);
1566 static __always_inline long
1567 atomic_long_dec_return_relaxed(atomic_long_t *v)
1569 instrument_atomic_read_write(v, sizeof(*v));
1570 return arch_atomic_long_dec_return_relaxed(v);
1573 static __always_inline long
1574 atomic_long_fetch_dec(atomic_long_t *v)
1577 instrument_atomic_read_write(v, sizeof(*v));
1578 return arch_atomic_long_fetch_dec(v);
1581 static __always_inline long
1582 atomic_long_fetch_dec_acquire(atomic_long_t *v)
1584 instrument_atomic_read_write(v, sizeof(*v));
1585 return arch_atomic_long_fetch_dec_acquire(v);
1588 static __always_inline long
1589 atomic_long_fetch_dec_release(atomic_long_t *v)
1592 instrument_atomic_read_write(v, sizeof(*v));
1593 return arch_atomic_long_fetch_dec_release(v);
1596 static __always_inline long
1597 atomic_long_fetch_dec_relaxed(atomic_long_t *v)
1599 instrument_atomic_read_write(v, sizeof(*v));
1600 return arch_atomic_long_fetch_dec_relaxed(v);
1603 static __always_inline void
1604 atomic_long_and(long i, atomic_long_t *v)
1606 instrument_atomic_read_write(v, sizeof(*v));
1607 arch_atomic_long_and(i, v);
1610 static __always_inline long
1611 atomic_long_fetch_and(long i, atomic_long_t *v)
1614 instrument_atomic_read_write(v, sizeof(*v));
1615 return arch_atomic_long_fetch_and(i, v);
1618 static __always_inline long
1619 atomic_long_fetch_and_acquire(long i, atomic_long_t *v)
1621 instrument_atomic_read_write(v, sizeof(*v));
1622 return arch_atomic_long_fetch_and_acquire(i, v);
1625 static __always_inline long
1626 atomic_long_fetch_and_release(long i, atomic_long_t *v)
1629 instrument_atomic_read_write(v, sizeof(*v));
1630 return arch_atomic_long_fetch_and_release(i, v);
1633 static __always_inline long
1634 atomic_long_fetch_and_relaxed(long i, atomic_long_t *v)
1636 instrument_atomic_read_write(v, sizeof(*v));
1637 return arch_atomic_long_fetch_and_relaxed(i, v);
1640 static __always_inline void
1641 atomic_long_andnot(long i, atomic_long_t *v)
1643 instrument_atomic_read_write(v, sizeof(*v));
1644 arch_atomic_long_andnot(i, v);
1647 static __always_inline long
1648 atomic_long_fetch_andnot(long i, atomic_long_t *v)
1651 instrument_atomic_read_write(v, sizeof(*v));
1652 return arch_atomic_long_fetch_andnot(i, v);
1655 static __always_inline long
1656 atomic_long_fetch_andnot_acquire(long i, atomic_long_t *v)
1658 instrument_atomic_read_write(v, sizeof(*v));
1659 return arch_atomic_long_fetch_andnot_acquire(i, v);
1662 static __always_inline long
1663 atomic_long_fetch_andnot_release(long i, atomic_long_t *v)
1666 instrument_atomic_read_write(v, sizeof(*v));
1667 return arch_atomic_long_fetch_andnot_release(i, v);
1670 static __always_inline long
1671 atomic_long_fetch_andnot_relaxed(long i, atomic_long_t *v)
1673 instrument_atomic_read_write(v, sizeof(*v));
1674 return arch_atomic_long_fetch_andnot_relaxed(i, v);
1677 static __always_inline void
1678 atomic_long_or(long i, atomic_long_t *v)
1680 instrument_atomic_read_write(v, sizeof(*v));
1681 arch_atomic_long_or(i, v);
1684 static __always_inline long
1685 atomic_long_fetch_or(long i, atomic_long_t *v)
1688 instrument_atomic_read_write(v, sizeof(*v));
1689 return arch_atomic_long_fetch_or(i, v);
1692 static __always_inline long
1693 atomic_long_fetch_or_acquire(long i, atomic_long_t *v)
1695 instrument_atomic_read_write(v, sizeof(*v));
1696 return arch_atomic_long_fetch_or_acquire(i, v);
1699 static __always_inline long
1700 atomic_long_fetch_or_release(long i, atomic_long_t *v)
1703 instrument_atomic_read_write(v, sizeof(*v));
1704 return arch_atomic_long_fetch_or_release(i, v);
1707 static __always_inline long
1708 atomic_long_fetch_or_relaxed(long i, atomic_long_t *v)
1710 instrument_atomic_read_write(v, sizeof(*v));
1711 return arch_atomic_long_fetch_or_relaxed(i, v);
1714 static __always_inline void
1715 atomic_long_xor(long i, atomic_long_t *v)
1717 instrument_atomic_read_write(v, sizeof(*v));
1718 arch_atomic_long_xor(i, v);
1721 static __always_inline long
1722 atomic_long_fetch_xor(long i, atomic_long_t *v)
1725 instrument_atomic_read_write(v, sizeof(*v));
1726 return arch_atomic_long_fetch_xor(i, v);
1729 static __always_inline long
1730 atomic_long_fetch_xor_acquire(long i, atomic_long_t *v)
1732 instrument_atomic_read_write(v, sizeof(*v));
1733 return arch_atomic_long_fetch_xor_acquire(i, v);
1736 static __always_inline long
1737 atomic_long_fetch_xor_release(long i, atomic_long_t *v)
1740 instrument_atomic_read_write(v, sizeof(*v));
1741 return arch_atomic_long_fetch_xor_release(i, v);
1744 static __always_inline long
1745 atomic_long_fetch_xor_relaxed(long i, atomic_long_t *v)
1747 instrument_atomic_read_write(v, sizeof(*v));
1748 return arch_atomic_long_fetch_xor_relaxed(i, v);
1751 static __always_inline long
1752 atomic_long_xchg(atomic_long_t *v, long i)
1755 instrument_atomic_read_write(v, sizeof(*v));
1756 return arch_atomic_long_xchg(v, i);
1759 static __always_inline long
1760 atomic_long_xchg_acquire(atomic_long_t *v, long i)
1762 instrument_atomic_read_write(v, sizeof(*v));
1763 return arch_atomic_long_xchg_acquire(v, i);
1766 static __always_inline long
1767 atomic_long_xchg_release(atomic_long_t *v, long i)
1770 instrument_atomic_read_write(v, sizeof(*v));
1771 return arch_atomic_long_xchg_release(v, i);
1774 static __always_inline long
1775 atomic_long_xchg_relaxed(atomic_long_t *v, long i)
1777 instrument_atomic_read_write(v, sizeof(*v));
1778 return arch_atomic_long_xchg_relaxed(v, i);
1781 static __always_inline long
1782 atomic_long_cmpxchg(atomic_long_t *v, long old, long new)
1785 instrument_atomic_read_write(v, sizeof(*v));
1786 return arch_atomic_long_cmpxchg(v, old, new);
1789 static __always_inline long
1790 atomic_long_cmpxchg_acquire(atomic_long_t *v, long old, long new)
1792 instrument_atomic_read_write(v, sizeof(*v));
1793 return arch_atomic_long_cmpxchg_acquire(v, old, new);
1796 static __always_inline long
1797 atomic_long_cmpxchg_release(atomic_long_t *v, long old, long new)
1800 instrument_atomic_read_write(v, sizeof(*v));
1801 return arch_atomic_long_cmpxchg_release(v, old, new);
1804 static __always_inline long
1805 atomic_long_cmpxchg_relaxed(atomic_long_t *v, long old, long new)
1807 instrument_atomic_read_write(v, sizeof(*v));
1808 return arch_atomic_long_cmpxchg_relaxed(v, old, new);
1811 static __always_inline bool
1812 atomic_long_try_cmpxchg(atomic_long_t *v, long *old, long new)
1815 instrument_atomic_read_write(v, sizeof(*v));
1816 instrument_atomic_read_write(old, sizeof(*old));
1817 return arch_atomic_long_try_cmpxchg(v, old, new);
1820 static __always_inline bool
1821 atomic_long_try_cmpxchg_acquire(atomic_long_t *v, long *old, long new)
1823 instrument_atomic_read_write(v, sizeof(*v));
1824 instrument_atomic_read_write(old, sizeof(*old));
1825 return arch_atomic_long_try_cmpxchg_acquire(v, old, new);
1828 static __always_inline bool
1829 atomic_long_try_cmpxchg_release(atomic_long_t *v, long *old, long new)
1832 instrument_atomic_read_write(v, sizeof(*v));
1833 instrument_atomic_read_write(old, sizeof(*old));
1834 return arch_atomic_long_try_cmpxchg_release(v, old, new);
1837 static __always_inline bool
1838 atomic_long_try_cmpxchg_relaxed(atomic_long_t *v, long *old, long new)
1840 instrument_atomic_read_write(v, sizeof(*v));
1841 instrument_atomic_read_write(old, sizeof(*old));
1842 return arch_atomic_long_try_cmpxchg_relaxed(v, old, new);
1845 static __always_inline bool
1846 atomic_long_sub_and_test(long i, atomic_long_t *v)
1849 instrument_atomic_read_write(v, sizeof(*v));
1850 return arch_atomic_long_sub_and_test(i, v);
1853 static __always_inline bool
1854 atomic_long_dec_and_test(atomic_long_t *v)
1857 instrument_atomic_read_write(v, sizeof(*v));
1858 return arch_atomic_long_dec_and_test(v);
1861 static __always_inline bool
1862 atomic_long_inc_and_test(atomic_long_t *v)
1865 instrument_atomic_read_write(v, sizeof(*v));
1866 return arch_atomic_long_inc_and_test(v);
1869 static __always_inline bool
1870 atomic_long_add_negative(long i, atomic_long_t *v)
1873 instrument_atomic_read_write(v, sizeof(*v));
1874 return arch_atomic_long_add_negative(i, v);
1877 static __always_inline bool
1878 atomic_long_add_negative_acquire(long i, atomic_long_t *v)
1880 instrument_atomic_read_write(v, sizeof(*v));
1881 return arch_atomic_long_add_negative_acquire(i, v);
1884 static __always_inline bool
1885 atomic_long_add_negative_release(long i, atomic_long_t *v)
1888 instrument_atomic_read_write(v, sizeof(*v));
1889 return arch_atomic_long_add_negative_release(i, v);
1892 static __always_inline bool
1893 atomic_long_add_negative_relaxed(long i, atomic_long_t *v)
1895 instrument_atomic_read_write(v, sizeof(*v));
1896 return arch_atomic_long_add_negative_relaxed(i, v);
1899 static __always_inline long
1900 atomic_long_fetch_add_unless(atomic_long_t *v, long a, long u)
1903 instrument_atomic_read_write(v, sizeof(*v));
1904 return arch_atomic_long_fetch_add_unless(v, a, u);
1907 static __always_inline bool
1908 atomic_long_add_unless(atomic_long_t *v, long a, long u)
1911 instrument_atomic_read_write(v, sizeof(*v));
1912 return arch_atomic_long_add_unless(v, a, u);
1915 static __always_inline bool
1916 atomic_long_inc_not_zero(atomic_long_t *v)
1919 instrument_atomic_read_write(v, sizeof(*v));
1920 return arch_atomic_long_inc_not_zero(v);
1923 static __always_inline bool
1924 atomic_long_inc_unless_negative(atomic_long_t *v)
1927 instrument_atomic_read_write(v, sizeof(*v));
1928 return arch_atomic_long_inc_unless_negative(v);
1931 static __always_inline bool
1932 atomic_long_dec_unless_positive(atomic_long_t *v)
1935 instrument_atomic_read_write(v, sizeof(*v));
1936 return arch_atomic_long_dec_unless_positive(v);
1939 static __always_inline long
1940 atomic_long_dec_if_positive(atomic_long_t *v)
1943 instrument_atomic_read_write(v, sizeof(*v));
1944 return arch_atomic_long_dec_if_positive(v);
1947 #define xchg(ptr, ...) \
1949 typeof(ptr) __ai_ptr = (ptr); \
1951 instrument_atomic_write(__ai_ptr, sizeof(*__ai_ptr)); \
1952 arch_xchg(__ai_ptr, __VA_ARGS__); \
1955 #define xchg_acquire(ptr, ...) \
1957 typeof(ptr) __ai_ptr = (ptr); \
1958 instrument_atomic_write(__ai_ptr, sizeof(*__ai_ptr)); \
1959 arch_xchg_acquire(__ai_ptr, __VA_ARGS__); \
1962 #define xchg_release(ptr, ...) \
1964 typeof(ptr) __ai_ptr = (ptr); \
1966 instrument_atomic_write(__ai_ptr, sizeof(*__ai_ptr)); \
1967 arch_xchg_release(__ai_ptr, __VA_ARGS__); \
1970 #define xchg_relaxed(ptr, ...) \
1972 typeof(ptr) __ai_ptr = (ptr); \
1973 instrument_atomic_write(__ai_ptr, sizeof(*__ai_ptr)); \
1974 arch_xchg_relaxed(__ai_ptr, __VA_ARGS__); \
1977 #define cmpxchg(ptr, ...) \
1979 typeof(ptr) __ai_ptr = (ptr); \
1981 instrument_atomic_write(__ai_ptr, sizeof(*__ai_ptr)); \
1982 arch_cmpxchg(__ai_ptr, __VA_ARGS__); \
1985 #define cmpxchg_acquire(ptr, ...) \
1987 typeof(ptr) __ai_ptr = (ptr); \
1988 instrument_atomic_write(__ai_ptr, sizeof(*__ai_ptr)); \
1989 arch_cmpxchg_acquire(__ai_ptr, __VA_ARGS__); \
1992 #define cmpxchg_release(ptr, ...) \
1994 typeof(ptr) __ai_ptr = (ptr); \
1996 instrument_atomic_write(__ai_ptr, sizeof(*__ai_ptr)); \
1997 arch_cmpxchg_release(__ai_ptr, __VA_ARGS__); \
2000 #define cmpxchg_relaxed(ptr, ...) \
2002 typeof(ptr) __ai_ptr = (ptr); \
2003 instrument_atomic_write(__ai_ptr, sizeof(*__ai_ptr)); \
2004 arch_cmpxchg_relaxed(__ai_ptr, __VA_ARGS__); \
2007 #define cmpxchg64(ptr, ...) \
2009 typeof(ptr) __ai_ptr = (ptr); \
2011 instrument_atomic_write(__ai_ptr, sizeof(*__ai_ptr)); \
2012 arch_cmpxchg64(__ai_ptr, __VA_ARGS__); \
2015 #define cmpxchg64_acquire(ptr, ...) \
2017 typeof(ptr) __ai_ptr = (ptr); \
2018 instrument_atomic_write(__ai_ptr, sizeof(*__ai_ptr)); \
2019 arch_cmpxchg64_acquire(__ai_ptr, __VA_ARGS__); \
2022 #define cmpxchg64_release(ptr, ...) \
2024 typeof(ptr) __ai_ptr = (ptr); \
2026 instrument_atomic_write(__ai_ptr, sizeof(*__ai_ptr)); \
2027 arch_cmpxchg64_release(__ai_ptr, __VA_ARGS__); \
2030 #define cmpxchg64_relaxed(ptr, ...) \
2032 typeof(ptr) __ai_ptr = (ptr); \
2033 instrument_atomic_write(__ai_ptr, sizeof(*__ai_ptr)); \
2034 arch_cmpxchg64_relaxed(__ai_ptr, __VA_ARGS__); \
2037 #define try_cmpxchg(ptr, oldp, ...) \
2039 typeof(ptr) __ai_ptr = (ptr); \
2040 typeof(oldp) __ai_oldp = (oldp); \
2042 instrument_atomic_write(__ai_ptr, sizeof(*__ai_ptr)); \
2043 instrument_atomic_write(__ai_oldp, sizeof(*__ai_oldp)); \
2044 arch_try_cmpxchg(__ai_ptr, __ai_oldp, __VA_ARGS__); \
2047 #define try_cmpxchg_acquire(ptr, oldp, ...) \
2049 typeof(ptr) __ai_ptr = (ptr); \
2050 typeof(oldp) __ai_oldp = (oldp); \
2051 instrument_atomic_write(__ai_ptr, sizeof(*__ai_ptr)); \
2052 instrument_atomic_write(__ai_oldp, sizeof(*__ai_oldp)); \
2053 arch_try_cmpxchg_acquire(__ai_ptr, __ai_oldp, __VA_ARGS__); \
2056 #define try_cmpxchg_release(ptr, oldp, ...) \
2058 typeof(ptr) __ai_ptr = (ptr); \
2059 typeof(oldp) __ai_oldp = (oldp); \
2061 instrument_atomic_write(__ai_ptr, sizeof(*__ai_ptr)); \
2062 instrument_atomic_write(__ai_oldp, sizeof(*__ai_oldp)); \
2063 arch_try_cmpxchg_release(__ai_ptr, __ai_oldp, __VA_ARGS__); \
2066 #define try_cmpxchg_relaxed(ptr, oldp, ...) \
2068 typeof(ptr) __ai_ptr = (ptr); \
2069 typeof(oldp) __ai_oldp = (oldp); \
2070 instrument_atomic_write(__ai_ptr, sizeof(*__ai_ptr)); \
2071 instrument_atomic_write(__ai_oldp, sizeof(*__ai_oldp)); \
2072 arch_try_cmpxchg_relaxed(__ai_ptr, __ai_oldp, __VA_ARGS__); \
2075 #define try_cmpxchg64(ptr, oldp, ...) \
2077 typeof(ptr) __ai_ptr = (ptr); \
2078 typeof(oldp) __ai_oldp = (oldp); \
2080 instrument_atomic_write(__ai_ptr, sizeof(*__ai_ptr)); \
2081 instrument_atomic_write(__ai_oldp, sizeof(*__ai_oldp)); \
2082 arch_try_cmpxchg64(__ai_ptr, __ai_oldp, __VA_ARGS__); \
2085 #define try_cmpxchg64_acquire(ptr, oldp, ...) \
2087 typeof(ptr) __ai_ptr = (ptr); \
2088 typeof(oldp) __ai_oldp = (oldp); \
2089 instrument_atomic_write(__ai_ptr, sizeof(*__ai_ptr)); \
2090 instrument_atomic_write(__ai_oldp, sizeof(*__ai_oldp)); \
2091 arch_try_cmpxchg64_acquire(__ai_ptr, __ai_oldp, __VA_ARGS__); \
2094 #define try_cmpxchg64_release(ptr, oldp, ...) \
2096 typeof(ptr) __ai_ptr = (ptr); \
2097 typeof(oldp) __ai_oldp = (oldp); \
2099 instrument_atomic_write(__ai_ptr, sizeof(*__ai_ptr)); \
2100 instrument_atomic_write(__ai_oldp, sizeof(*__ai_oldp)); \
2101 arch_try_cmpxchg64_release(__ai_ptr, __ai_oldp, __VA_ARGS__); \
2104 #define try_cmpxchg64_relaxed(ptr, oldp, ...) \
2106 typeof(ptr) __ai_ptr = (ptr); \
2107 typeof(oldp) __ai_oldp = (oldp); \
2108 instrument_atomic_write(__ai_ptr, sizeof(*__ai_ptr)); \
2109 instrument_atomic_write(__ai_oldp, sizeof(*__ai_oldp)); \
2110 arch_try_cmpxchg64_relaxed(__ai_ptr, __ai_oldp, __VA_ARGS__); \
2113 #define cmpxchg_local(ptr, ...) \
2115 typeof(ptr) __ai_ptr = (ptr); \
2116 instrument_atomic_write(__ai_ptr, sizeof(*__ai_ptr)); \
2117 arch_cmpxchg_local(__ai_ptr, __VA_ARGS__); \
2120 #define cmpxchg64_local(ptr, ...) \
2122 typeof(ptr) __ai_ptr = (ptr); \
2123 instrument_atomic_write(__ai_ptr, sizeof(*__ai_ptr)); \
2124 arch_cmpxchg64_local(__ai_ptr, __VA_ARGS__); \
2127 #define sync_cmpxchg(ptr, ...) \
2129 typeof(ptr) __ai_ptr = (ptr); \
2131 instrument_atomic_write(__ai_ptr, sizeof(*__ai_ptr)); \
2132 arch_sync_cmpxchg(__ai_ptr, __VA_ARGS__); \
2135 #define try_cmpxchg_local(ptr, oldp, ...) \
2137 typeof(ptr) __ai_ptr = (ptr); \
2138 typeof(oldp) __ai_oldp = (oldp); \
2139 instrument_atomic_write(__ai_ptr, sizeof(*__ai_ptr)); \
2140 instrument_atomic_write(__ai_oldp, sizeof(*__ai_oldp)); \
2141 arch_try_cmpxchg_local(__ai_ptr, __ai_oldp, __VA_ARGS__); \
2144 #define try_cmpxchg64_local(ptr, oldp, ...) \
2146 typeof(ptr) __ai_ptr = (ptr); \
2147 typeof(oldp) __ai_oldp = (oldp); \
2148 instrument_atomic_write(__ai_ptr, sizeof(*__ai_ptr)); \
2149 instrument_atomic_write(__ai_oldp, sizeof(*__ai_oldp)); \
2150 arch_try_cmpxchg64_local(__ai_ptr, __ai_oldp, __VA_ARGS__); \
2153 #define cmpxchg_double(ptr, ...) \
2155 typeof(ptr) __ai_ptr = (ptr); \
2157 instrument_atomic_write(__ai_ptr, 2 * sizeof(*__ai_ptr)); \
2158 arch_cmpxchg_double(__ai_ptr, __VA_ARGS__); \
2162 #define cmpxchg_double_local(ptr, ...) \
2164 typeof(ptr) __ai_ptr = (ptr); \
2165 instrument_atomic_write(__ai_ptr, 2 * sizeof(*__ai_ptr)); \
2166 arch_cmpxchg_double_local(__ai_ptr, __VA_ARGS__); \
2169 #endif /* _LINUX_ATOMIC_INSTRUMENTED_H */
2170 // 97fe4d79aa058d2164df824632cbc4f716d2a407