Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4292707ybi; Tue, 18 Jun 2019 15:31:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqxg/2+jp9vpE91dBpGekpO0GqT9PiXp/pB85qus679zW9pMLTelPkg+zACXlJ+ejv3GLypQ X-Received: by 2002:a17:902:2b8a:: with SMTP id l10mr77374344plb.283.1560897090621; Tue, 18 Jun 2019 15:31:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560897090; cv=none; d=google.com; s=arc-20160816; b=nm8LDb4eJ/NGrHNNmm4IbNHhixmS1/xBWL5tRBA0kSlEDMz5bCeavVMCVupVlBtCVf edMMYrbIHiFOXZT/uSHR9Nq0jgOZyPgSsB+I9kG20YgjfsFLzgY6FL/UlGYsRx69ObbF f2gr2NXahsI0bvsQj3I9+jJp3lfArxyeJ/kfPtqXzcmr69kFlDXbw15lAoM+r/MwWQ3X gfnUTaTGDGDjL2EDDnkuTychkBclKOm/kfVRZjulfZheJvvc7nBKLYk/crOgP0fzXU33 AIWuFwRP+c5sqGJZo/9XmhzslSpNL6c86MJfPRkdUq4546isnCWbt3vBbl4THGWe+Nz/ 3CUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=wOMnvaj02eVEPAk/BVg0CNyDFlTER/dBTnHwVPcskWU=; b=hWy7vGqniU8s4coivbcQ1WVtgDfm7g/7/wvy8mCA1ubY447CmJHWCJQbCJmzC0vT/I P+70bOhXBJJ/MFIGVaipxxPJsodEHRmoJIVFRMIpr0ZBSkjpP9DTnoih/irVz30hX84N igx0Vn9cwD61J2AWyUG91bfHX/ZeUZNK0ZyLqeAu7H96zPXhvWQf5SFQLmCesg9H1feu oXspGNQq3oTbJQE6Pyk4xtV0MRrAxNf5gISxDjzd5KGJGLN5wmoSBURHINWI7ZQkGsEM I4PMTFMPqP0rVRzCigQcjEQ8ZJHwrYMNRM0PaiTC3Aq/WXVqpY+TieMrYMLhLdkcnofB Dl/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a19si1364351pgm.434.2019.06.18.15.31.13; Tue, 18 Jun 2019 15:31:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730575AbfFRWbB (ORCPT + 99 others); Tue, 18 Jun 2019 18:31:01 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:48985 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730196AbfFRWbA (ORCPT ); Tue, 18 Jun 2019 18:31:00 -0400 Received: from localhost ([127.0.0.1] helo=vostro.local) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1hdMcW-0006VX-LW; Wed, 19 Jun 2019 00:30:28 +0200 From: John Ogness To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, Petr Mladek , Sergey Senozhatsky , Steven Rostedt , Linus Torvalds , Greg Kroah-Hartman , Andrea Parri , Thomas Gleixner , Sergey Senozhatsky Subject: Re: [RFC PATCH v2 1/2] printk-rb: add a new printk ringbuffer implementation References: <20190607162349.18199-1-john.ogness@linutronix.de> <20190607162349.18199-2-john.ogness@linutronix.de> <20190618112237.GP3436@hirez.programming.kicks-ass.net> Date: Wed, 19 Jun 2019 00:30:26 +0200 In-Reply-To: <20190618112237.GP3436@hirez.programming.kicks-ass.net> (Peter Zijlstra's message of "Tue, 18 Jun 2019 13:22:37 +0200") Message-ID: <87a7eebk71.fsf@linutronix.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-06-18, Peter Zijlstra wrote: >> +/** >> + * DOC: memory barriers > > What's up with that 'DOC' crap? The separate documentation in Documentation/core-api/printk-ringbuffer.rst references this so it automatically shows up in the kernel docs. An external reference requires the DOC keyword. Maybe the memory barrier descriptions do not belong in the kernel docs? >> + * >> + * Writers >> + * ------- >> + * The main issue with writers is expiring/invalidating old data blocks in >> + * order to create new data blocks. This is performed in 6 steps that must >> + * be observed in order by all writers to allow cooperation. Here is a list >> + * of the 6 steps and the named acquire/release memory barrier pairs that >> + * are used to synchronized them: >> + * >> + * * old data invalidation (MB1): Pushing rb.data_list.oldest forward. >> + * Necessary for identifying if data has been expired. >> + * >> + * * new data reservation (MB2): Pushing rb.data_list.newest forward. >> + * Necessary for validating data. >> + * >> + * * assign the data block to a descriptor (MB3): Setting data block id to >> + * descriptor id. Necessary for finding the descriptor associated with th >> + * data block. >> + * >> + * * commit data (MB4): Setting data block data_next. (Now data block is >> + * valid). Necessary for validating data. >> + * >> + * * make descriptor newest (MB5): Setting rb.descr_list.newest to descriptor. >> + * (Now following new descriptors will be linked to this one.) Necessary for >> + * ensuring the descriptor's next is set to EOL before adding to the list. >> + * >> + * * link descriprtor to previous newest (MB6): Setting the next of the >> + * previous descriptor to this one. Necessary for correctly identifying if >> + * a descriptor is the only descriptor on the list. >> + * >> + * Readers >> + * ------- >> + * Readers only make of smb_rmb() to ensure that certain critical load >> + * operations are performed in an order that allows readers to evaluate if >> + * the data they read is really valid. >> + */ > > This isn't really helping much I feel. It doesn't begin to describe the > ordering. But maybe the code makes more sense. Sorry. I really have no feel about what (or how) exactly I should document the memory barriers. I think the above comments make sense when someone understands the details of the implementation. But perhaps it should describe things such that someone without knowledge of the implementation would understand what the memory barriers are for? That would significantly increase the amount of text as I would have to basically explain the implementation. I would appreciate it if you could point out a source file that documents its memory barriers the way you would like to see these memory barriers documented. John Ogness