Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp490983ybd; Wed, 26 Jun 2019 01:31:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqzLup7aR+0ABBVIC4/rfKP+Km0VX8YoCktZOSWmd4diWhLcSdrS710Esk9UMvs0n386oslj X-Received: by 2002:a17:902:8c83:: with SMTP id t3mr3942402plo.93.1561537865096; Wed, 26 Jun 2019 01:31:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561537865; cv=none; d=google.com; s=arc-20160816; b=NK769x67euFSGI5z5wluMKNEHLeZ1zXgrAC3DJ1AJu8ivW+JMItQKf9KWtv937kWlc YpoAW0v18ONXl/btFlqnmQZ4APCraNWRtQh+OXHl9Xu2Y3FaaYAzKAWTvyxGzgC6XVZy jnaqjh47MQC+7YQ8vEyU0yuTJF4bImhnOL6qTwK0OKlS7vlmhD7S/wAVCrFvEQ9Qi12Q mj17m/pQknZhoYzSfsTvYXPps+IcVKUB52le2Uxun9EZ8uCJsrtGUQMJ20kmoYgHYGkg 8iEBW+EIUsvdxH3T5vJ+shphD6GeIPbY8bCyO7OymExQyKEpzm/ktTg0uiwb2nPkeQNm FQkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=cYTNCdCPORkE6S6OzpnFzOPGB28xM82wOVDIqi/ctUc=; b=LI/nqwW/3S1tM1Di1rQHKB3JzqwCDpGLUXLgn6iy3WhZ56vYCzAgAl+pcV95R56n1D rC8PQ18fvhJ7a8R5pN4H4KXUCxKccBUtLpGYl2qRH7d2RtzscqGbUA1FvcnqFnygiqMv AyZOaD+FsoWoeurWCzPnIHcdDeQRiFHE/y2UAPUnxfmuaqtPY4BXLlBtSA7ncfdQNGnQ PUHvV+41/oJc5XCMvp7otyKORNKwQHyGfkTDeRuBXw+CeiSi/xuqlMcZlJdsjc1t01V0 bfQCbalOKgIkwCi89xvc7s3Vw2gG1wiY12ahM0wtjyc0IiOLKTANPBpmMpHZm45Udg71 pGfQ== 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 d135si15237154pga.557.2019.06.26.01.30.48; Wed, 26 Jun 2019 01:31:05 -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 S1726905AbfFZI3i (ORCPT + 99 others); Wed, 26 Jun 2019 04:29:38 -0400 Received: from mx2.suse.de ([195.135.220.15]:60738 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725954AbfFZI3i (ORCPT ); Wed, 26 Jun 2019 04:29:38 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 32D6CAC2D; Wed, 26 Jun 2019 08:29:36 +0000 (UTC) Date: Wed, 26 Jun 2019 10:29:35 +0200 From: Petr Mladek To: John Ogness Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , 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 Message-ID: <20190626082935.ocbqqaol5jzcuxwl@pathway.suse.cz> References: <20190607162349.18199-1-john.ogness@linutronix.de> <20190607162349.18199-2-john.ogness@linutronix.de> <20190621140516.h36g4in26pe3rmly@pathway.suse.cz> <87d0j31iyc.fsf@linutronix.de> <20190624140948.l7ekcmz5ser3zfr2@pathway.suse.cz> <87blylhjy8.fsf@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87blylhjy8.fsf@linutronix.de> User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 2019-06-25 15:29:35, John Ogness wrote: > To address your question: For the linked list implementation, if you are > looking at it from the linked list perspective, the number of > descriptors on the list is constantly fluctuating (increasing and > decreasing) and the ordering of the descriptors is constantly > changing. They are ordered according to the writer commit order (not the > writer reserve order) and the only descriptors on the list are the ones > that are not within a reserve/commit window. This and few other comments below are really valuable explanation. I misunderstood how the list worked. I have to revisit it and rethink my view on the patchset. > >>> If the above is true then we could achieve similar result > >>> when using the array as a circular buffer. It would be > >>> the same like when all members are linked from the beginning. > >> > >> So you are suggesting using a multi-reader multi-writer lockless > >> ringbuffer to implement a multi-reader multi-writer lockless > >> ringbuffer. ;-) > >> > >> The descriptor ringbuffer has fixed-size items, which simplifies the > >> task. But I expect you will run into a chicken-egg scenario. > > > > AFAIK, the main obstacle with the fully lockless solution was > > that the entries did not have a fixed size. > > No. The variable size of the records was the reason I used > descriptors. That has nothing to do with how I chose to connect those > descriptors. I think that we are talking about the same. If I remember correctly, the main problem is that cmpxchg() is not reliable when the same address might be used by the metadata and data. For example, the code never know if it compared previous seq number of it another CPU/NMI wrote there data (string) in the meantime. > I think it is not as simple as you think it is and I expect you will end > up with a solution that is more complex (although I could be > wrong). IMHO the linked list solution is quite elegant. It is quite likely. > There is an obvious push to get the kernel docs unified under RST, even > if it is not how I usually do things either. However, now that I've done > the work, looking back it seems to be a good idea in order to automate > documentation. I personally like /** */ description of public API functions. Also html/pdf version looks nice even though I do not use them. The thing is that both /** */ and .rst formats can be well readable even in the source code. I guess that most existing developers read only the source code. Well, this discussion probably belongs to another thread. My wish was just to make the commit message more verbose, please. > I explicitly wanted to get away from any preconceptions. By specifying > we have data linked from oldest to newest, I find it feels more natural, > regardless if I am a writer writing new records to the newest or a > reader reading all records from oldest to newest. As I said, I do not have strong opinion. I could live with oldest, newest. Best Regards, Petr