diff options
| author | Niklas Cassel <cassel@kernel.org> | 2026-06-01 19:07:46 +0200 |
|---|---|---|
| committer | Niklas Cassel <cassel@kernel.org> | 2026-06-01 19:07:46 +0200 |
| commit | ad66912899d511a29508f83982e8d892a461f1cb (patch) | |
| tree | a4edfcd95bd3aa70b3959c06a3bc19b784bf185c /include/linux | |
| parent | f80cea847028bb9eb1149badebf9f142d96b2e8b (diff) | |
| parent | f45c5c4adb27540d43302155e2fbaeca6c3c6d03 (diff) | |
| download | lwn-ad66912899d511a29508f83982e8d892a461f1cb.tar.gz lwn-ad66912899d511a29508f83982e8d892a461f1cb.zip | |
Merge remote-tracking branch 'tip/locking/context' into for-7.2
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/compiler-context-analysis.h | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/include/linux/compiler-context-analysis.h b/include/linux/compiler-context-analysis.h index a9317571e6af..8302ebc2ea8c 100644 --- a/include/linux/compiler-context-analysis.h +++ b/include/linux/compiler-context-analysis.h @@ -39,12 +39,14 @@ # define __assumes_shared_ctx_lock(...) __attribute__((assert_shared_capability(__VA_ARGS__))) /** - * __guarded_by - struct member and globals attribute, declares variable - * only accessible within active context + * __guarded_by() - struct member and globals attribute, declares variable + * only accessible within active context + * @...: context lock instance pointer(s) * * Declares that the struct member or global variable is only accessible within - * the context entered by the given context lock. Read operations on the data - * require shared access, while write operations require exclusive access. + * the context entered by the given context lock(s). Read operations on the data + * require shared access to at least one of the context locks, while write + * operations require exclusive access to all listed context locks. * * .. code-block:: c * @@ -52,17 +54,24 @@ * spinlock_t lock; * long counter __guarded_by(&lock); * }; + * + * struct some_state { + * spinlock_t lock1, lock2; + * long counter __guarded_by(&lock1, &lock2); + * }; */ # define __guarded_by(...) __attribute__((guarded_by(__VA_ARGS__))) /** - * __pt_guarded_by - struct member and globals attribute, declares pointed-to - * data only accessible within active context + * __pt_guarded_by() - struct member and globals attribute, declares pointed-to + * data only accessible within active context + * @...: context lock instance pointer(s) * * Declares that the data pointed to by the struct member pointer or global * pointer is only accessible within the context entered by the given context - * lock. Read operations on the data require shared access, while write - * operations require exclusive access. + * lock(s). Read operations on the data require shared access to at least one + * of the context locks, while write operations require exclusive access to all + * listed context locks. * * .. code-block:: c * @@ -70,6 +79,11 @@ * spinlock_t lock; * long *counter __pt_guarded_by(&lock); * }; + * + * struct some_state { + * spinlock_t lock1, lock2; + * long *counter __pt_guarded_by(&lock1, &lock2); + * }; */ # define __pt_guarded_by(...) __attribute__((pt_guarded_by(__VA_ARGS__))) |
