Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3314039ybt; Mon, 29 Jun 2020 22:45:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy09UM/rgF3+4teYBrz2OhF4U/7NgjMhcUThDArRQs7mrtr50091MsR2poiDSM+LYKMJqPa X-Received: by 2002:a17:907:724d:: with SMTP id ds13mr16581416ejc.73.1593495955106; Mon, 29 Jun 2020 22:45:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593495955; cv=none; d=google.com; s=arc-20160816; b=bxRIOTpASK9PIcxW5d3cwIFh+JHEVZ8tFQjhH67AAGe7imGvO00+8W+Dk8LCx4gME6 TtsO6WPyOyV3zm6Uh7j47J/nWAnEPfZuyJW/ueEQFw71g6Aply+YmHF3NDRLBcFHS2hq mt0Rl2EoJuucRW72zOKBThqi9jvysbqyYHNt2ImBaqNPKloBxArfwJelAspWu+AWYevg Doi8mAisioKPceVZE6Nr6T90V6yMXBSk3c68iEoH/EgkBONxYCSXm4l+hBWjhVSUKTBj 2u34q902M3+rI4WXEO1fteY3vXhVPnAtuNH4kH5pi0UbQG3i9dMrSAWR9dwWZ12I2lwE GHiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :dkim-signature:from; bh=7E4j18x46zQTsfHze4W8jizD6J0WqMpKwXs6KhlFqs4=; b=lLDqsnTaRPd+gGLQrmSK4io4pesx3SO2iEP7VmErQeYdpwRE+zb+WEGbHNUKngLaPf nWLrsS2qdRuwwg8srj+/eApnExyxiQc4y2IevArJQohGXgTLtjVgkl0o9hUmbAftV1zn 2Tb1MQrFB56fN/wiL20o2HPgSyxQnrIAPleRDKfg7FkIfiHAm0oIKM3F3RIzSb/QjIol bAErN4GjOdTZGXHP5YPjwLzMY5uycfN2Nd2RWTBh1+IwAQm+SHYjH9GDOW6LeWtlL/+D JmdKiD4CDz7ARCt9zc+zW1z3M7Ucx4U7HQ/fNjl8zuniqC5urPsp4xi0p/4xntFXG4No oytQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=USV+kt8F; dkim=neutral (no key) header.i=@vger.kernel.org; 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 dn28si1134146edb.195.2020.06.29.22.45.32; Mon, 29 Jun 2020 22:45:55 -0700 (PDT) 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=USV+kt8F; dkim=neutral (no key) header.i=@vger.kernel.org; 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 S1728260AbgF3FpI (ORCPT + 99 others); Tue, 30 Jun 2020 01:45:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725994AbgF3FpG (ORCPT ); Tue, 30 Jun 2020 01:45:06 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7F80C061755; Mon, 29 Jun 2020 22:45:05 -0700 (PDT) From: "Ahmed S. Darwish" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1593495902; 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=7E4j18x46zQTsfHze4W8jizD6J0WqMpKwXs6KhlFqs4=; b=USV+kt8Ftucg+tg76yTLkDX4rrxGyHj7pXcbxZH/MRkqmtg/Kpsm7r4xQ78CTZsJzc9p/f wf+D6RCzSKZ/mIv7Fczep/ISIzdwARJu1+pyfK1uJn8CEmixfOv+oicru9ddyQbKd/HLWi scTzN6uJlNwd5oMlaBlgGimOZ+0h66ioBIWDiQxZLy4yCZXGdfx5jJmP+OxR5T06a25zYa wDCHWY0mjUTCa48KkdsH85BZCRy6dYGzayxoCmTc4iOAbQk0juWO0IQ4gtHR+zEWGgf71t 54wWis8UTd9nPCnv1vPxUUUdCUMZGFrm8UWgsC/HAI6lm3yKM67iaGbj3yBPJg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1593495902; 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=7E4j18x46zQTsfHze4W8jizD6J0WqMpKwXs6KhlFqs4=; b=Cn+fhZYJT7uxo0Lbd8GLUr9tb17T+QIL4agkwV4s0Edo1VQktNNy4c6KeM6J7T7ApxFPlE mKc2ufuAfxD8eHDw== To: Peter Zijlstra , Ingo Molnar , Will Deacon Cc: Thomas Gleixner , "Paul E. McKenney" , "Sebastian A. Siewior" , Steven Rostedt , LKML , "Ahmed S. Darwish" , Jonathan Corbet , linux-doc@vger.kernel.org Subject: [PATCH v3 02/20] seqlock: Properly format kernel-doc code samples Date: Tue, 30 Jun 2020 07:44:34 +0200 Message-Id: <20200630054452.3675847-3-a.darwish@linutronix.de> In-Reply-To: <20200630054452.3675847-1-a.darwish@linutronix.de> References: <20200519214547.352050-1-a.darwish@linutronix.de> <20200630054452.3675847-1-a.darwish@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Align the code samples and note sections inside kernel-doc comments with tabs. This way they can be properly parsed and rendered by Sphinx. It also makes the code samples easier to read from text editors. Signed-off-by: Ahmed S. Darwish --- include/linux/seqlock.h | 82 +++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 39 deletions(-) diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h index e54ff48e87f8..d3bba59eb4df 100644 --- a/include/linux/seqlock.h +++ b/include/linux/seqlock.h @@ -256,7 +256,7 @@ static inline void raw_write_seqcount_end(seqcount_t *s) * * This can be used to provide an ordering guarantee instead of the * usual consistency guarantee. It is one wmb cheaper, because we can - * collapse the two back-to-back wmb()s. + * collapse the two back-to-back wmb()s:: * * Note that writes surrounding the barrier should be declared atomic (e.g. * via WRITE_ONCE): a) to ensure the writes become visible to other threads @@ -325,64 +325,68 @@ static inline int raw_read_seqcount_latch(seqcount_t *s) * Very simply put: we first modify one copy and then the other. This ensures * there is always one copy in a stable state, ready to give us an answer. * - * The basic form is a data structure like: + * The basic form is a data structure like:: * - * struct latch_struct { - * seqcount_t seq; - * struct data_struct data[2]; - * }; + * struct latch_struct { + * seqcount_t seq; + * struct data_struct data[2]; + * }; * * Where a modification, which is assumed to be externally serialized, does the - * following: + * following:: * - * void latch_modify(struct latch_struct *latch, ...) - * { - * smp_wmb(); <- Ensure that the last data[1] update is visible - * latch->seq++; - * smp_wmb(); <- Ensure that the seqcount update is visible + * void latch_modify(struct latch_struct *latch, ...) + * { + * smp_wmb(); // Ensure that the last data[1] update is visible + * latch->seq++; + * smp_wmb(); // Ensure that the seqcount update is visible * - * modify(latch->data[0], ...); + * modify(latch->data[0], ...); * - * smp_wmb(); <- Ensure that the data[0] update is visible - * latch->seq++; - * smp_wmb(); <- Ensure that the seqcount update is visible + * smp_wmb(); // Ensure that the data[0] update is visible + * latch->seq++; + * smp_wmb(); // Ensure that the seqcount update is visible * - * modify(latch->data[1], ...); - * } + * modify(latch->data[1], ...); + * } * - * The query will have a form like: + * The query will have a form like:: * - * struct entry *latch_query(struct latch_struct *latch, ...) - * { - * struct entry *entry; - * unsigned seq, idx; + * struct entry *latch_query(struct latch_struct *latch, ...) + * { + * struct entry *entry; + * unsigned seq, idx; * - * do { - * seq = raw_read_seqcount_latch(&latch->seq); + * do { + * seq = raw_read_seqcount_latch(&latch->seq); * - * idx = seq & 0x01; - * entry = data_query(latch->data[idx], ...); + * idx = seq & 0x01; + * entry = data_query(latch->data[idx], ...); * - * smp_rmb(); - * } while (seq != latch->seq); + * smp_rmb(); + * } while (seq != latch->seq); * - * return entry; - * } + * return entry; + * } * * So during the modification, queries are first redirected to data[1]. Then we * modify data[0]. When that is complete, we redirect queries back to data[0] * and we can modify data[1]. * - * NOTE: The non-requirement for atomic modifications does _NOT_ include - * the publishing of new entries in the case where data is a dynamic - * data structure. + * NOTE: * - * An iteration might start in data[0] and get suspended long enough - * to miss an entire modification sequence, once it resumes it might - * observe the new entry. + * The non-requirement for atomic modifications does _NOT_ include + * the publishing of new entries in the case where data is a dynamic + * data structure. * - * NOTE: When data is a dynamic data structure; one should use regular RCU - * patterns to manage the lifetimes of the objects within. + * An iteration might start in data[0] and get suspended long enough + * to miss an entire modification sequence, once it resumes it might + * observe the new entry. + * + * NOTE: + * + * When data is a dynamic data structure; one should use regular RCU + * patterns to manage the lifetimes of the objects within. */ static inline void raw_write_seqcount_latch(seqcount_t *s) { -- 2.20.1