Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

seqlock: kernel-doc: Specify when preemption is automatically altered

The kernel-doc annotations for sequence counters write side functions
are incomplete: they do not specify when preemption is automatically
disabled and re-enabled.

This has confused a number of call-site developers. Fix it.

Signed-off-by: Ahmed S. Darwish <a.darwish@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/CAHk-=wikhGExmprXgaW+MVXG1zsGpztBbVwOb23vetk41EtTBQ@mail.gmail.com

authored by

Ahmed S. Darwish and committed by
Peter Zijlstra
cb262935 66bcfcdf

+11 -6
+11 -6
include/linux/seqlock.h
··· 456 456 /** 457 457 * raw_write_seqcount_begin() - start a seqcount_t write section w/o lockdep 458 458 * @s: Pointer to seqcount_t or any of the seqcount_LOCKNAME_t variants 459 + * 460 + * Context: check write_seqcount_begin() 459 461 */ 460 462 #define raw_write_seqcount_begin(s) \ 461 463 do { \ ··· 477 475 /** 478 476 * raw_write_seqcount_end() - end a seqcount_t write section w/o lockdep 479 477 * @s: Pointer to seqcount_t or any of the seqcount_LOCKNAME_t variants 478 + * 479 + * Context: check write_seqcount_end() 480 480 */ 481 481 #define raw_write_seqcount_end(s) \ 482 482 do { \ ··· 502 498 * @subclass: lockdep nesting level 503 499 * 504 500 * See Documentation/locking/lockdep-design.rst 501 + * Context: check write_seqcount_begin() 505 502 */ 506 503 #define write_seqcount_begin_nested(s, subclass) \ 507 504 do { \ ··· 524 519 * write_seqcount_begin() - start a seqcount_t write side critical section 525 520 * @s: Pointer to seqcount_t or any of the seqcount_LOCKNAME_t variants 526 521 * 527 - * write_seqcount_begin opens a write side critical section of the given 528 - * seqcount_t. 529 - * 530 - * Context: seqcount_t write side critical sections must be serialized and 531 - * non-preemptible. If readers can be invoked from hardirq or softirq 522 + * Context: sequence counter write side sections must be serialized and 523 + * non-preemptible. Preemption will be automatically disabled if and 524 + * only if the seqcount write serialization lock is associated, and 525 + * preemptible. If readers can be invoked from hardirq or softirq 532 526 * context, interrupts or bottom halves must be respectively disabled. 533 527 */ 534 528 #define write_seqcount_begin(s) \ ··· 549 545 * write_seqcount_end() - end a seqcount_t write side critical section 550 546 * @s: Pointer to seqcount_t or any of the seqcount_LOCKNAME_t variants 551 547 * 552 - * The write section must've been opened with write_seqcount_begin(). 548 + * Context: Preemption will be automatically re-enabled if and only if 549 + * the seqcount write serialization lock is associated, and preemptible. 553 550 */ 554 551 #define write_seqcount_end(s) \ 555 552 do { \