percpu.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_GENERIC_PERCPU_H_
  3. #define _ASM_GENERIC_PERCPU_H_
  4. #ifndef __ASSEMBLER__
  5. #include <linux/compiler.h>
  6. #include <linux/threads.h>
  7. #include <linux/percpu-defs.h>
  8. /*
  9. * __percpu_qual is the qualifier for the percpu named address space.
  10. *
  11. * Most arches use generic named address space for percpu variables but
  12. * some arches define percpu variables in different named address space
  13. * (on the x86 arch, percpu variable may be declared as being relative
  14. * to the %fs or %gs segments using __seg_fs or __seg_gs named address
  15. * space qualifier).
  16. */
  17. #ifndef __percpu_qual
  18. # define __percpu_qual
  19. #endif
  20. #ifdef CONFIG_SMP
  21. /*
  22. * per_cpu_offset() is the offset that has to be added to a
  23. * percpu variable to get to the instance for a certain processor.
  24. *
  25. * Most arches use the __per_cpu_offset array for those offsets but
  26. * some arches have their own ways of determining the offset (x86_64, s390).
  27. */
  28. #ifndef __per_cpu_offset
  29. extern unsigned long __per_cpu_offset[NR_CPUS];
  30. #define per_cpu_offset(x) (__per_cpu_offset[x])
  31. #endif
  32. /*
  33. * Determine the offset for the currently active processor.
  34. * An arch may define __my_cpu_offset to provide a more effective
  35. * means of obtaining the offset to the per cpu variables of the
  36. * current processor.
  37. */
  38. #ifndef __my_cpu_offset
  39. #define __my_cpu_offset per_cpu_offset(raw_smp_processor_id())
  40. #endif
  41. #ifdef CONFIG_DEBUG_PREEMPT
  42. #define my_cpu_offset per_cpu_offset(smp_processor_id())
  43. #else
  44. #define my_cpu_offset __my_cpu_offset
  45. #endif
  46. /*
  47. * Arch may define arch_raw_cpu_ptr() to provide more efficient address
  48. * translations for raw_cpu_ptr().
  49. */
  50. #ifndef arch_raw_cpu_ptr
  51. #define arch_raw_cpu_ptr(ptr) SHIFT_PERCPU_PTR(ptr, __my_cpu_offset)
  52. #endif
  53. #ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA
  54. extern void setup_per_cpu_areas(void);
  55. #endif
  56. #endif /* SMP */
  57. #ifndef PER_CPU_BASE_SECTION
  58. #ifdef CONFIG_SMP
  59. #define PER_CPU_BASE_SECTION ".data..percpu"
  60. #else
  61. #define PER_CPU_BASE_SECTION ".data"
  62. #endif
  63. #endif
  64. #ifndef PER_CPU_ATTRIBUTES
  65. #define PER_CPU_ATTRIBUTES
  66. #endif
  67. #define raw_cpu_generic_read(pcp) \
  68. ({ \
  69. *raw_cpu_ptr(&(pcp)); \
  70. })
  71. #define raw_cpu_generic_to_op(pcp, val, op) \
  72. do { \
  73. *raw_cpu_ptr(&(pcp)) op val; \
  74. } while (0)
  75. #define raw_cpu_generic_add_return(pcp, val) \
  76. ({ \
  77. TYPEOF_UNQUAL(pcp) *__p = raw_cpu_ptr(&(pcp)); \
  78. \
  79. *__p += val; \
  80. *__p; \
  81. })
  82. #define raw_cpu_generic_xchg(pcp, nval) \
  83. ({ \
  84. TYPEOF_UNQUAL(pcp) *__p = raw_cpu_ptr(&(pcp)); \
  85. TYPEOF_UNQUAL(pcp) __ret; \
  86. __ret = *__p; \
  87. *__p = nval; \
  88. __ret; \
  89. })
  90. #define __cpu_fallback_try_cmpxchg(pcp, ovalp, nval, _cmpxchg) \
  91. ({ \
  92. TYPEOF_UNQUAL(pcp) __val, __old = *(ovalp); \
  93. __val = _cmpxchg(pcp, __old, nval); \
  94. if (__val != __old) \
  95. *(ovalp) = __val; \
  96. __val == __old; \
  97. })
  98. #define raw_cpu_generic_try_cmpxchg(pcp, ovalp, nval) \
  99. ({ \
  100. TYPEOF_UNQUAL(pcp) *__p = raw_cpu_ptr(&(pcp)); \
  101. TYPEOF_UNQUAL(pcp) __val = *__p, ___old = *(ovalp); \
  102. bool __ret; \
  103. if (__val == ___old) { \
  104. *__p = nval; \
  105. __ret = true; \
  106. } else { \
  107. *(ovalp) = __val; \
  108. __ret = false; \
  109. } \
  110. __ret; \
  111. })
  112. #define raw_cpu_generic_cmpxchg(pcp, oval, nval) \
  113. ({ \
  114. TYPEOF_UNQUAL(pcp) __old = (oval); \
  115. raw_cpu_generic_try_cmpxchg(pcp, &__old, nval); \
  116. __old; \
  117. })
  118. #define __this_cpu_generic_read_nopreempt(pcp) \
  119. ({ \
  120. TYPEOF_UNQUAL(pcp) ___ret; \
  121. preempt_disable_notrace(); \
  122. ___ret = READ_ONCE(*raw_cpu_ptr(&(pcp))); \
  123. preempt_enable_notrace(); \
  124. ___ret; \
  125. })
  126. #define __this_cpu_generic_read_noirq(pcp) \
  127. ({ \
  128. TYPEOF_UNQUAL(pcp) ___ret; \
  129. unsigned long ___flags; \
  130. raw_local_irq_save(___flags); \
  131. ___ret = raw_cpu_generic_read(pcp); \
  132. raw_local_irq_restore(___flags); \
  133. ___ret; \
  134. })
  135. #define this_cpu_generic_read(pcp) \
  136. ({ \
  137. TYPEOF_UNQUAL(pcp) __ret; \
  138. if (__native_word(pcp)) \
  139. __ret = __this_cpu_generic_read_nopreempt(pcp); \
  140. else \
  141. __ret = __this_cpu_generic_read_noirq(pcp); \
  142. __ret; \
  143. })
  144. #define this_cpu_generic_to_op(pcp, val, op) \
  145. do { \
  146. unsigned long __flags; \
  147. raw_local_irq_save(__flags); \
  148. raw_cpu_generic_to_op(pcp, val, op); \
  149. raw_local_irq_restore(__flags); \
  150. } while (0)
  151. #define this_cpu_generic_add_return(pcp, val) \
  152. ({ \
  153. TYPEOF_UNQUAL(pcp) __ret; \
  154. unsigned long __flags; \
  155. raw_local_irq_save(__flags); \
  156. __ret = raw_cpu_generic_add_return(pcp, val); \
  157. raw_local_irq_restore(__flags); \
  158. __ret; \
  159. })
  160. #define this_cpu_generic_xchg(pcp, nval) \
  161. ({ \
  162. TYPEOF_UNQUAL(pcp) __ret; \
  163. unsigned long __flags; \
  164. raw_local_irq_save(__flags); \
  165. __ret = raw_cpu_generic_xchg(pcp, nval); \
  166. raw_local_irq_restore(__flags); \
  167. __ret; \
  168. })
  169. #define this_cpu_generic_try_cmpxchg(pcp, ovalp, nval) \
  170. ({ \
  171. bool __ret; \
  172. unsigned long __flags; \
  173. raw_local_irq_save(__flags); \
  174. __ret = raw_cpu_generic_try_cmpxchg(pcp, ovalp, nval); \
  175. raw_local_irq_restore(__flags); \
  176. __ret; \
  177. })
  178. #define this_cpu_generic_cmpxchg(pcp, oval, nval) \
  179. ({ \
  180. TYPEOF_UNQUAL(pcp) __ret; \
  181. unsigned long __flags; \
  182. raw_local_irq_save(__flags); \
  183. __ret = raw_cpu_generic_cmpxchg(pcp, oval, nval); \
  184. raw_local_irq_restore(__flags); \
  185. __ret; \
  186. })
  187. #ifndef raw_cpu_read_1
  188. #define raw_cpu_read_1(pcp) raw_cpu_generic_read(pcp)
  189. #endif
  190. #ifndef raw_cpu_read_2
  191. #define raw_cpu_read_2(pcp) raw_cpu_generic_read(pcp)
  192. #endif
  193. #ifndef raw_cpu_read_4
  194. #define raw_cpu_read_4(pcp) raw_cpu_generic_read(pcp)
  195. #endif
  196. #ifndef raw_cpu_read_8
  197. #define raw_cpu_read_8(pcp) raw_cpu_generic_read(pcp)
  198. #endif
  199. #ifndef raw_cpu_write_1
  200. #define raw_cpu_write_1(pcp, val) raw_cpu_generic_to_op(pcp, val, =)
  201. #endif
  202. #ifndef raw_cpu_write_2
  203. #define raw_cpu_write_2(pcp, val) raw_cpu_generic_to_op(pcp, val, =)
  204. #endif
  205. #ifndef raw_cpu_write_4
  206. #define raw_cpu_write_4(pcp, val) raw_cpu_generic_to_op(pcp, val, =)
  207. #endif
  208. #ifndef raw_cpu_write_8
  209. #define raw_cpu_write_8(pcp, val) raw_cpu_generic_to_op(pcp, val, =)
  210. #endif
  211. #ifndef raw_cpu_add_1
  212. #define raw_cpu_add_1(pcp, val) raw_cpu_generic_to_op(pcp, val, +=)
  213. #endif
  214. #ifndef raw_cpu_add_2
  215. #define raw_cpu_add_2(pcp, val) raw_cpu_generic_to_op(pcp, val, +=)
  216. #endif
  217. #ifndef raw_cpu_add_4
  218. #define raw_cpu_add_4(pcp, val) raw_cpu_generic_to_op(pcp, val, +=)
  219. #endif
  220. #ifndef raw_cpu_add_8
  221. #define raw_cpu_add_8(pcp, val) raw_cpu_generic_to_op(pcp, val, +=)
  222. #endif
  223. #ifndef raw_cpu_and_1
  224. #define raw_cpu_and_1(pcp, val) raw_cpu_generic_to_op(pcp, val, &=)
  225. #endif
  226. #ifndef raw_cpu_and_2
  227. #define raw_cpu_and_2(pcp, val) raw_cpu_generic_to_op(pcp, val, &=)
  228. #endif
  229. #ifndef raw_cpu_and_4
  230. #define raw_cpu_and_4(pcp, val) raw_cpu_generic_to_op(pcp, val, &=)
  231. #endif
  232. #ifndef raw_cpu_and_8
  233. #define raw_cpu_and_8(pcp, val) raw_cpu_generic_to_op(pcp, val, &=)
  234. #endif
  235. #ifndef raw_cpu_or_1
  236. #define raw_cpu_or_1(pcp, val) raw_cpu_generic_to_op(pcp, val, |=)
  237. #endif
  238. #ifndef raw_cpu_or_2
  239. #define raw_cpu_or_2(pcp, val) raw_cpu_generic_to_op(pcp, val, |=)
  240. #endif
  241. #ifndef raw_cpu_or_4
  242. #define raw_cpu_or_4(pcp, val) raw_cpu_generic_to_op(pcp, val, |=)
  243. #endif
  244. #ifndef raw_cpu_or_8
  245. #define raw_cpu_or_8(pcp, val) raw_cpu_generic_to_op(pcp, val, |=)
  246. #endif
  247. #ifndef raw_cpu_add_return_1
  248. #define raw_cpu_add_return_1(pcp, val) raw_cpu_generic_add_return(pcp, val)
  249. #endif
  250. #ifndef raw_cpu_add_return_2
  251. #define raw_cpu_add_return_2(pcp, val) raw_cpu_generic_add_return(pcp, val)
  252. #endif
  253. #ifndef raw_cpu_add_return_4
  254. #define raw_cpu_add_return_4(pcp, val) raw_cpu_generic_add_return(pcp, val)
  255. #endif
  256. #ifndef raw_cpu_add_return_8
  257. #define raw_cpu_add_return_8(pcp, val) raw_cpu_generic_add_return(pcp, val)
  258. #endif
  259. #ifndef raw_cpu_xchg_1
  260. #define raw_cpu_xchg_1(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
  261. #endif
  262. #ifndef raw_cpu_xchg_2
  263. #define raw_cpu_xchg_2(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
  264. #endif
  265. #ifndef raw_cpu_xchg_4
  266. #define raw_cpu_xchg_4(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
  267. #endif
  268. #ifndef raw_cpu_xchg_8
  269. #define raw_cpu_xchg_8(pcp, nval) raw_cpu_generic_xchg(pcp, nval)
  270. #endif
  271. #ifndef raw_cpu_try_cmpxchg_1
  272. #ifdef raw_cpu_cmpxchg_1
  273. #define raw_cpu_try_cmpxchg_1(pcp, ovalp, nval) \
  274. __cpu_fallback_try_cmpxchg(pcp, ovalp, nval, raw_cpu_cmpxchg_1)
  275. #else
  276. #define raw_cpu_try_cmpxchg_1(pcp, ovalp, nval) \
  277. raw_cpu_generic_try_cmpxchg(pcp, ovalp, nval)
  278. #endif
  279. #endif
  280. #ifndef raw_cpu_try_cmpxchg_2
  281. #ifdef raw_cpu_cmpxchg_2
  282. #define raw_cpu_try_cmpxchg_2(pcp, ovalp, nval) \
  283. __cpu_fallback_try_cmpxchg(pcp, ovalp, nval, raw_cpu_cmpxchg_2)
  284. #else
  285. #define raw_cpu_try_cmpxchg_2(pcp, ovalp, nval) \
  286. raw_cpu_generic_try_cmpxchg(pcp, ovalp, nval)
  287. #endif
  288. #endif
  289. #ifndef raw_cpu_try_cmpxchg_4
  290. #ifdef raw_cpu_cmpxchg_4
  291. #define raw_cpu_try_cmpxchg_4(pcp, ovalp, nval) \
  292. __cpu_fallback_try_cmpxchg(pcp, ovalp, nval, raw_cpu_cmpxchg_4)
  293. #else
  294. #define raw_cpu_try_cmpxchg_4(pcp, ovalp, nval) \
  295. raw_cpu_generic_try_cmpxchg(pcp, ovalp, nval)
  296. #endif
  297. #endif
  298. #ifndef raw_cpu_try_cmpxchg_8
  299. #ifdef raw_cpu_cmpxchg_8
  300. #define raw_cpu_try_cmpxchg_8(pcp, ovalp, nval) \
  301. __cpu_fallback_try_cmpxchg(pcp, ovalp, nval, raw_cpu_cmpxchg_8)
  302. #else
  303. #define raw_cpu_try_cmpxchg_8(pcp, ovalp, nval) \
  304. raw_cpu_generic_try_cmpxchg(pcp, ovalp, nval)
  305. #endif
  306. #endif
  307. #ifndef raw_cpu_try_cmpxchg64
  308. #ifdef raw_cpu_cmpxchg64
  309. #define raw_cpu_try_cmpxchg64(pcp, ovalp, nval) \
  310. __cpu_fallback_try_cmpxchg(pcp, ovalp, nval, raw_cpu_cmpxchg64)
  311. #else
  312. #define raw_cpu_try_cmpxchg64(pcp, ovalp, nval) \
  313. raw_cpu_generic_try_cmpxchg(pcp, ovalp, nval)
  314. #endif
  315. #endif
  316. #ifndef raw_cpu_try_cmpxchg128
  317. #ifdef raw_cpu_cmpxchg128
  318. #define raw_cpu_try_cmpxchg128(pcp, ovalp, nval) \
  319. __cpu_fallback_try_cmpxchg(pcp, ovalp, nval, raw_cpu_cmpxchg128)
  320. #else
  321. #define raw_cpu_try_cmpxchg128(pcp, ovalp, nval) \
  322. raw_cpu_generic_try_cmpxchg(pcp, ovalp, nval)
  323. #endif
  324. #endif
  325. #ifndef raw_cpu_cmpxchg_1
  326. #define raw_cpu_cmpxchg_1(pcp, oval, nval) \
  327. raw_cpu_generic_cmpxchg(pcp, oval, nval)
  328. #endif
  329. #ifndef raw_cpu_cmpxchg_2
  330. #define raw_cpu_cmpxchg_2(pcp, oval, nval) \
  331. raw_cpu_generic_cmpxchg(pcp, oval, nval)
  332. #endif
  333. #ifndef raw_cpu_cmpxchg_4
  334. #define raw_cpu_cmpxchg_4(pcp, oval, nval) \
  335. raw_cpu_generic_cmpxchg(pcp, oval, nval)
  336. #endif
  337. #ifndef raw_cpu_cmpxchg_8
  338. #define raw_cpu_cmpxchg_8(pcp, oval, nval) \
  339. raw_cpu_generic_cmpxchg(pcp, oval, nval)
  340. #endif
  341. #ifndef raw_cpu_cmpxchg64
  342. #define raw_cpu_cmpxchg64(pcp, oval, nval) \
  343. raw_cpu_generic_cmpxchg(pcp, oval, nval)
  344. #endif
  345. #ifndef raw_cpu_cmpxchg128
  346. #define raw_cpu_cmpxchg128(pcp, oval, nval) \
  347. raw_cpu_generic_cmpxchg(pcp, oval, nval)
  348. #endif
  349. #ifndef this_cpu_read_1
  350. #define this_cpu_read_1(pcp) this_cpu_generic_read(pcp)
  351. #endif
  352. #ifndef this_cpu_read_2
  353. #define this_cpu_read_2(pcp) this_cpu_generic_read(pcp)
  354. #endif
  355. #ifndef this_cpu_read_4
  356. #define this_cpu_read_4(pcp) this_cpu_generic_read(pcp)
  357. #endif
  358. #ifndef this_cpu_read_8
  359. #define this_cpu_read_8(pcp) this_cpu_generic_read(pcp)
  360. #endif
  361. #ifndef this_cpu_write_1
  362. #define this_cpu_write_1(pcp, val) this_cpu_generic_to_op(pcp, val, =)
  363. #endif
  364. #ifndef this_cpu_write_2
  365. #define this_cpu_write_2(pcp, val) this_cpu_generic_to_op(pcp, val, =)
  366. #endif
  367. #ifndef this_cpu_write_4
  368. #define this_cpu_write_4(pcp, val) this_cpu_generic_to_op(pcp, val, =)
  369. #endif
  370. #ifndef this_cpu_write_8
  371. #define this_cpu_write_8(pcp, val) this_cpu_generic_to_op(pcp, val, =)
  372. #endif
  373. #ifndef this_cpu_add_1
  374. #define this_cpu_add_1(pcp, val) this_cpu_generic_to_op(pcp, val, +=)
  375. #endif
  376. #ifndef this_cpu_add_2
  377. #define this_cpu_add_2(pcp, val) this_cpu_generic_to_op(pcp, val, +=)
  378. #endif
  379. #ifndef this_cpu_add_4
  380. #define this_cpu_add_4(pcp, val) this_cpu_generic_to_op(pcp, val, +=)
  381. #endif
  382. #ifndef this_cpu_add_8
  383. #define this_cpu_add_8(pcp, val) this_cpu_generic_to_op(pcp, val, +=)
  384. #endif
  385. #ifndef this_cpu_and_1
  386. #define this_cpu_and_1(pcp, val) this_cpu_generic_to_op(pcp, val, &=)
  387. #endif
  388. #ifndef this_cpu_and_2
  389. #define this_cpu_and_2(pcp, val) this_cpu_generic_to_op(pcp, val, &=)
  390. #endif
  391. #ifndef this_cpu_and_4
  392. #define this_cpu_and_4(pcp, val) this_cpu_generic_to_op(pcp, val, &=)
  393. #endif
  394. #ifndef this_cpu_and_8
  395. #define this_cpu_and_8(pcp, val) this_cpu_generic_to_op(pcp, val, &=)
  396. #endif
  397. #ifndef this_cpu_or_1
  398. #define this_cpu_or_1(pcp, val) this_cpu_generic_to_op(pcp, val, |=)
  399. #endif
  400. #ifndef this_cpu_or_2
  401. #define this_cpu_or_2(pcp, val) this_cpu_generic_to_op(pcp, val, |=)
  402. #endif
  403. #ifndef this_cpu_or_4
  404. #define this_cpu_or_4(pcp, val) this_cpu_generic_to_op(pcp, val, |=)
  405. #endif
  406. #ifndef this_cpu_or_8
  407. #define this_cpu_or_8(pcp, val) this_cpu_generic_to_op(pcp, val, |=)
  408. #endif
  409. #ifndef this_cpu_add_return_1
  410. #define this_cpu_add_return_1(pcp, val) this_cpu_generic_add_return(pcp, val)
  411. #endif
  412. #ifndef this_cpu_add_return_2
  413. #define this_cpu_add_return_2(pcp, val) this_cpu_generic_add_return(pcp, val)
  414. #endif
  415. #ifndef this_cpu_add_return_4
  416. #define this_cpu_add_return_4(pcp, val) this_cpu_generic_add_return(pcp, val)
  417. #endif
  418. #ifndef this_cpu_add_return_8
  419. #define this_cpu_add_return_8(pcp, val) this_cpu_generic_add_return(pcp, val)
  420. #endif
  421. #ifndef this_cpu_xchg_1
  422. #define this_cpu_xchg_1(pcp, nval) this_cpu_generic_xchg(pcp, nval)
  423. #endif
  424. #ifndef this_cpu_xchg_2
  425. #define this_cpu_xchg_2(pcp, nval) this_cpu_generic_xchg(pcp, nval)
  426. #endif
  427. #ifndef this_cpu_xchg_4
  428. #define this_cpu_xchg_4(pcp, nval) this_cpu_generic_xchg(pcp, nval)
  429. #endif
  430. #ifndef this_cpu_xchg_8
  431. #define this_cpu_xchg_8(pcp, nval) this_cpu_generic_xchg(pcp, nval)
  432. #endif
  433. #ifndef this_cpu_try_cmpxchg_1
  434. #ifdef this_cpu_cmpxchg_1
  435. #define this_cpu_try_cmpxchg_1(pcp, ovalp, nval) \
  436. __cpu_fallback_try_cmpxchg(pcp, ovalp, nval, this_cpu_cmpxchg_1)
  437. #else
  438. #define this_cpu_try_cmpxchg_1(pcp, ovalp, nval) \
  439. this_cpu_generic_try_cmpxchg(pcp, ovalp, nval)
  440. #endif
  441. #endif
  442. #ifndef this_cpu_try_cmpxchg_2
  443. #ifdef this_cpu_cmpxchg_2
  444. #define this_cpu_try_cmpxchg_2(pcp, ovalp, nval) \
  445. __cpu_fallback_try_cmpxchg(pcp, ovalp, nval, this_cpu_cmpxchg_2)
  446. #else
  447. #define this_cpu_try_cmpxchg_2(pcp, ovalp, nval) \
  448. this_cpu_generic_try_cmpxchg(pcp, ovalp, nval)
  449. #endif
  450. #endif
  451. #ifndef this_cpu_try_cmpxchg_4
  452. #ifdef this_cpu_cmpxchg_4
  453. #define this_cpu_try_cmpxchg_4(pcp, ovalp, nval) \
  454. __cpu_fallback_try_cmpxchg(pcp, ovalp, nval, this_cpu_cmpxchg_4)
  455. #else
  456. #define this_cpu_try_cmpxchg_4(pcp, ovalp, nval) \
  457. this_cpu_generic_try_cmpxchg(pcp, ovalp, nval)
  458. #endif
  459. #endif
  460. #ifndef this_cpu_try_cmpxchg_8
  461. #ifdef this_cpu_cmpxchg_8
  462. #define this_cpu_try_cmpxchg_8(pcp, ovalp, nval) \
  463. __cpu_fallback_try_cmpxchg(pcp, ovalp, nval, this_cpu_cmpxchg_8)
  464. #else
  465. #define this_cpu_try_cmpxchg_8(pcp, ovalp, nval) \
  466. this_cpu_generic_try_cmpxchg(pcp, ovalp, nval)
  467. #endif
  468. #endif
  469. #ifndef this_cpu_try_cmpxchg64
  470. #ifdef this_cpu_cmpxchg64
  471. #define this_cpu_try_cmpxchg64(pcp, ovalp, nval) \
  472. __cpu_fallback_try_cmpxchg(pcp, ovalp, nval, this_cpu_cmpxchg64)
  473. #else
  474. #define this_cpu_try_cmpxchg64(pcp, ovalp, nval) \
  475. this_cpu_generic_try_cmpxchg(pcp, ovalp, nval)
  476. #endif
  477. #endif
  478. #ifndef this_cpu_try_cmpxchg128
  479. #ifdef this_cpu_cmpxchg128
  480. #define this_cpu_try_cmpxchg128(pcp, ovalp, nval) \
  481. __cpu_fallback_try_cmpxchg(pcp, ovalp, nval, this_cpu_cmpxchg128)
  482. #else
  483. #define this_cpu_try_cmpxchg128(pcp, ovalp, nval) \
  484. this_cpu_generic_try_cmpxchg(pcp, ovalp, nval)
  485. #endif
  486. #endif
  487. #ifndef this_cpu_cmpxchg_1
  488. #define this_cpu_cmpxchg_1(pcp, oval, nval) \
  489. this_cpu_generic_cmpxchg(pcp, oval, nval)
  490. #endif
  491. #ifndef this_cpu_cmpxchg_2
  492. #define this_cpu_cmpxchg_2(pcp, oval, nval) \
  493. this_cpu_generic_cmpxchg(pcp, oval, nval)
  494. #endif
  495. #ifndef this_cpu_cmpxchg_4
  496. #define this_cpu_cmpxchg_4(pcp, oval, nval) \
  497. this_cpu_generic_cmpxchg(pcp, oval, nval)
  498. #endif
  499. #ifndef this_cpu_cmpxchg_8
  500. #define this_cpu_cmpxchg_8(pcp, oval, nval) \
  501. this_cpu_generic_cmpxchg(pcp, oval, nval)
  502. #endif
  503. #ifndef this_cpu_cmpxchg64
  504. #define this_cpu_cmpxchg64(pcp, oval, nval) \
  505. this_cpu_generic_cmpxchg(pcp, oval, nval)
  506. #endif
  507. #ifndef this_cpu_cmpxchg128
  508. #define this_cpu_cmpxchg128(pcp, oval, nval) \
  509. this_cpu_generic_cmpxchg(pcp, oval, nval)
  510. #endif
  511. #endif /* __ASSEMBLER__ */
  512. #endif /* _ASM_GENERIC_PERCPU_H_ */