Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1821747pxu; Sun, 6 Dec 2020 08:26:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJxqQNQcHdblHTQXERpYvtEXiry8pqWXKE7C0+B8egoaRMzGdSbBohX5h/5qCn9Ycl/6hCZR X-Received: by 2002:a17:906:b793:: with SMTP id dt19mr15721670ejb.120.1607272001300; Sun, 06 Dec 2020 08:26:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607272001; cv=none; d=google.com; s=arc-20160816; b=mGWCTiquFmnzPp6B8WaYcvInNUa1FfGsmcVhgJk8nRTLutSqutb2ob7lObPR0XiXTt hNL8jYqKiMZ6dr95YCvxrddJx3UWFWHb9xHQDRvZQyEvI9P1+7qKDVCnl8zZPT/YsATf mlNJOnU8e2wbmuFf+IEfLPOVKFNO7yvtscMkJ9QKWFRHavpqWw+DEHQbp16SKRisepVL JcdRpMZqrB7bn2uKMP8WpolRx3/Ut+sL5TRnwGwd9t0Yr01Dpnp8+P67ELGmb1qEWnO3 Wo+2HKDv/Zug2i5D1oymq9rQCWD3W9llHbqqqJdvcFuXHmVDO1Qt1CrJc5F1HRQyr0FV +0Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :dkim-signature:from; bh=aU0kdttfnudUEJiKpFCgtr9uIFUJ/R19T/3hCU2kwXc=; b=k9e0/NjkUr0CF02/Fmtwv9qxZwRM7usePZfzbzLUbR28hildqf/WNDR5pDfxtiqn/W r5qwEciCl+VGo1+2zQCEA87vK/xj2Ezd9SfsjODcfj/HU4OfQLycdv+A2d6YO3ZEUSQj 9leq9yUYYUEK9OnquNNSyGuLs3e6wgeyEUxTC+uBwNLpgkMhy62HhPGEXns9FKG9jWS6 Nos6qEv+cmbcVTYZeLslI9l24fD7++67iMWR1nIjnPAeAh/5HBdqHKxBnwkkyDek8nMi v5fTq5c5Zvsh6AZ0VAITp3d9ERzUvLL98h7uPUA6KAfgRnnj/hZLOnnJmnxRK1km+dD7 T4Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=I5UtT+4O; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p21si6893328edw.573.2020.12.06.08.26.18; Sun, 06 Dec 2020 08:26:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=I5UtT+4O; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727132AbgLFQWk (ORCPT + 99 others); Sun, 6 Dec 2020 11:22:40 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:58914 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725730AbgLFQWk (ORCPT ); Sun, 6 Dec 2020 11:22:40 -0500 From: "Ahmed S. Darwish" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1607271718; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aU0kdttfnudUEJiKpFCgtr9uIFUJ/R19T/3hCU2kwXc=; b=I5UtT+4OPdtq5fyJ9N8nsHEHGzcZ/sQnwD/I8fDsVlLTjbBoARYNPJubCuFAM/o5lEN1oR vmFkegRJnhBzP16R7ix80S73Muja8EsK9xj46kgUXmbchxMqYAQcMfP9Ag9ZSZQ+cWdEUD 2mw46ynhvZX+fDC1sJfCkPbwv2lvLwlnbaRKRmwHB5SXTs/qyWWJK9m5N2H7ayn7iYmmlc q/Qc1o8wMPzQVz236ecDLit6Mqvk98NuNKB8iWKhDZNNoG6TeAdhaldlvG1Hmu+fT+l+BO NnI1rAWMv1p1G8t9oR8K+3UNoWbtGo4CMtqO/ZugPp+t2oWBAeKWg35kDM1jOQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1607271718; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aU0kdttfnudUEJiKpFCgtr9uIFUJ/R19T/3hCU2kwXc=; b=joAAR5eD6RptGGKR669ENDAGXOyCS3fm0Rz6f/V8dTVVtgWAc94rZiADRFbpdWkETlVCja S7UcOGcLlyg0NUBQ== To: Peter Zijlstra , Ingo Molnar , Will Deacon Cc: Linus Torvalds , Thomas Gleixner , "Paul E. McKenney" , Steven Rostedt , Jonathan Corbet , Jason Gunthorpe , John Hubbard , LKML , "Sebastian A. Siewior" , "Ahmed S. Darwish" Subject: [PATCH -tip v1 3/3] seqlock: kernel-doc: Specify when preemption is automatically altered Date: Sun, 6 Dec 2020 17:21:43 +0100 Message-Id: <20201206162143.14387-4-a.darwish@linutronix.de> In-Reply-To: <20201206162143.14387-1-a.darwish@linutronix.de> References: <20201206162143.14387-1-a.darwish@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Link: https://lkml.kernel.org/r/20201030235121.GQ2620339@nvidia.com Link: https://lkml.kernel.org/r/CAHk-=wikhGExmprXgaW+MVXG1zsGpztBbVwOb23vetk41EtTBQ@mail.gmail.com Signed-off-by: Ahmed S. Darwish Cc: Jonathan Corbet --- include/linux/seqlock.h | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h index 235cbc65fd71..2f7bb92b4c9e 100644 --- a/include/linux/seqlock.h +++ b/include/linux/seqlock.h @@ -456,6 +456,8 @@ static inline int do_read_seqcount_retry(const seqcount_t *s, unsigned start) /** * raw_write_seqcount_begin() - start a seqcount_t write section w/o lockdep * @s: Pointer to seqcount_t or any of the seqcount_LOCKNAME_t variants + * + * Context: check write_seqcount_begin() */ #define raw_write_seqcount_begin(s) \ do { \ @@ -475,6 +477,8 @@ static inline void do_raw_write_seqcount_begin(seqcount_t *s) /** * raw_write_seqcount_end() - end a seqcount_t write section w/o lockdep * @s: Pointer to seqcount_t or any of the seqcount_LOCKNAME_t variants + * + * Context: check write_seqcount_end() */ #define raw_write_seqcount_end(s) \ do { \ @@ -498,6 +502,7 @@ static inline void do_raw_write_seqcount_end(seqcount_t *s) * @subclass: lockdep nesting level * * See Documentation/locking/lockdep-design.rst + * Context: check write_seqcount_begin() */ #define write_seqcount_begin_nested(s, subclass) \ do { \ @@ -519,11 +524,10 @@ static inline void do_write_seqcount_begin_nested(seqcount_t *s, int subclass) * write_seqcount_begin() - start a seqcount_t write side critical section * @s: Pointer to seqcount_t or any of the seqcount_LOCKNAME_t variants * - * write_seqcount_begin opens a write side critical section of the given - * seqcount_t. - * - * Context: seqcount_t write side critical sections must be serialized and - * non-preemptible. If readers can be invoked from hardirq or softirq + * Context: sequence counter write side sections must be serialized and + * non-preemptible. Preemption will be automatically disabled if and + * only if the seqcount write serialization lock is associated, and + * preemptible. If readers can be invoked from hardirq or softirq * context, interrupts or bottom halves must be respectively disabled. */ #define write_seqcount_begin(s) \ @@ -545,7 +549,8 @@ static inline void do_write_seqcount_begin(seqcount_t *s) * write_seqcount_end() - end a seqcount_t write side critical section * @s: Pointer to seqcount_t or any of the seqcount_LOCKNAME_t variants * - * The write section must've been opened with write_seqcount_begin(). + * Context: Preemption will be automatically re-enabled if and only if + * the seqcount write serialization lock is associated, and preemptible. */ #define write_seqcount_end(s) \ do { \ -- 2.29.2