Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp523714ybd; Wed, 26 Jun 2019 02:11:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqz3eBuMtjsNeCEIP2Uuezt8iDrR/ernYzolRDoNVXqIub0l6IqcdV0INAt9MjJJJVYmuZyx X-Received: by 2002:a65:510c:: with SMTP id f12mr1877418pgq.92.1561540278420; Wed, 26 Jun 2019 02:11:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561540278; cv=none; d=google.com; s=arc-20160816; b=dfTqn4CZCDIwRbbYDHOQ++OtPLzyF9h7lLKeV1uhQSHhB+CNdP/IYly32uK8UEsh9C wgNAFq64ijnqogDrII4MLFl/zRlEx3EDlM5AJnNoQUwhhflLFXLPvhXpn15kcyT9549I gsdT1EcJJn3y4SCfAnbDxQh2NNWhgJETkCAcUgrXWSqu8nqpNYiU2FbGcPrtb1AZ8nFw of2/HdwiLTCJkA4b5mr1IAzNK1ytm4nt/K0uGoenFBtOBzsuhHmJ9an5d+pZBvaQUXGh sq/WgzuLHvmcBqDLeRGKzZSNdpsB1fj5Xy394Yae21IsS6uTLa5RYlgqdMU3UDJfHTrv jrmA== 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=dQPesy9M8NY2X7zUH1ZZz+WUip9ZGdia15cue+h6uDk=; b=v9svwaJOG8Ol2F23sSvtoqNNIkRjHdmUuhQMUzg4trQUkPeVwPumwIkKXah3jlTBzN tAWGqdOqvbPrkplES4TzZ9AEgSGbVc4paLpJ51XwxO1bOPCcfgmrBSlWrGrYv+HcHAdT fl51fzwI8UNrNuLnP1KxhFBDVUunQhf6WSw/BUh4MOJJAcASNF5CMtDju7uJK0hBaPam 5bA501xUl40C8otkPQutq7OI0Nddc5/iLdoybsHueFuu4U1cVfo24F4Wz5eELgJzNlnr nQx4U8eVA/b1ZW8JRPwhcE39OxtWpT8AKydSikxs+e7xi7gx9FB+1OY1tJGcuhZraesf h2WQ== 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 j25si16691541pfr.11.2019.06.26.02.11.02; Wed, 26 Jun 2019 02:11:18 -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 S1727050AbfFZJJl (ORCPT + 99 others); Wed, 26 Jun 2019 05:09:41 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:46108 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725379AbfFZJJl (ORCPT ); Wed, 26 Jun 2019 05:09:41 -0400 Received: from localhost ([127.0.0.1] helo=vostro.local) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1hg3vk-0001T2-29; Wed, 26 Jun 2019 11:09:28 +0200 From: John Ogness To: Petr Mladek 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 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> <20190626082935.ocbqqaol5jzcuxwl@pathway.suse.cz> Date: Wed, 26 Jun 2019 11:09:26 +0200 In-Reply-To: <20190626082935.ocbqqaol5jzcuxwl@pathway.suse.cz> (Petr Mladek's message of "Wed, 26 Jun 2019 10:29:35 +0200") Message-ID: <87pnn0yapl.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-26, Petr Mladek 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 will add a documentation section about why a linked list was used. >>>>> 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. The cmpxchg() issue you mention is why I needed descriptors. But even if I were to implement a fixed-record-size ringbuffer where the cmpxchg() issue does not exist, I _still_ would have used a linked list to connect the records. It is misleading to think the linked list is because of variable size records. John Ogness