Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp420559ybl; Tue, 20 Aug 2019 23:06:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwY2STjKN3c4RrQ/p3wH3D7gS0Rke5j957givxn/JDyEWmdoRvKwS2epShoqzrfbRJ5aeLn X-Received: by 2002:a17:902:6687:: with SMTP id e7mr24594665plk.211.1566367573836; Tue, 20 Aug 2019 23:06:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566367573; cv=none; d=google.com; s=arc-20160816; b=daC3mfbJm3WqcMxK85WPMn4Ts/nvMrns1hTEX4z0daGtQ3gaNicy9Lrsbsd/TtXkT7 sMOyA+miEOQBAG0CTRctafL+P51FjMY5O+1HPIoGoraZRiCjJCix6+uJkaJjzFhifjOu p3w9eYZBzbnAEwKdHKoyY5d+gAlY0Y9KplsdKAlJ+V/CmrUNGy5aHr4TbcQ8UF3zjDmR p051SpB6JV20LI9sCQASSW4HkInQ7fvXvrhrhH+Hm9ZGxU4VbUm7J32/T59M1KQkxqh2 qbPlnV2wlzqJ+J480793mmhKHMJgDPHTlVEGzSFuF23ItJvVsS0KwtJiDXA7w8kbxONz uI9w== 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:date :references:subject:cc:to:from; bh=Sz3zuF3+bjaO0ju3dxODvsprfQ7Fy0eppBfW4iYGbDM=; b=h2aC+tfCStM6wiJNIy5KWvZHJ2NouDgIdwY6s3rUkgTTjGRV/q76o2oC6hiZjJ3qGK Z0xMyjMe2tYh6h62cZpZREajA+wWT8EQ1U4fS2rHClK2ApDG/pHYwAYHxVbiP4EAH2Sg 8OYwkGNhPnzn6WsPzEcvy4ntJCHpjivDaQzAivqsxeusUY1HCvhWSg4N3moI4O+Kpsr3 JcXxrir/Yil6i3hHUqQN383W32zBjmTER2zCyCvyQCJ7UD//2a1yiF8ay0l6Hd4aJLJD BMHKEu3HZjITbYU8eFU3dQ2QW0Q4hqN2ghd1PQJhpTeN8k25nhc213NnKWWGtKuBNx5f PIWg== 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 4si14734060pfo.266.2019.08.20.23.05.58; Tue, 20 Aug 2019 23:06:13 -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 S1727687AbfHUF46 (ORCPT + 99 others); Wed, 21 Aug 2019 01:56:58 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:53776 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725385AbfHUF46 (ORCPT ); Wed, 21 Aug 2019 01:56:58 -0400 Received: from localhost ([127.0.0.1] helo=vostro.local) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1i0Jc2-0003p4-FK; Wed, 21 Aug 2019 07:56:50 +0200 From: John Ogness To: Petr Mladek Cc: linux-kernel@vger.kernel.org, Andrea Parri , Sergey Senozhatsky , Sergey Senozhatsky , Steven Rostedt , Brendan Higgins , Peter Zijlstra , Thomas Gleixner , Linus Torvalds , Greg Kroah-Hartman Subject: Re: [RFC PATCH v4 4/9] printk-rb: initialize new descriptors as invalid References: <20190807222634.1723-1-john.ogness@linutronix.de> <20190807222634.1723-5-john.ogness@linutronix.de> <20190820092337.cudkfdfhsu44vlhh@pathway.suse.cz> Date: Wed, 21 Aug 2019 07:56:48 +0200 Message-ID: <87o90jdpsv.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-08-20, Petr Mladek wrote: >> Initialize never-used descriptors as permanently invalid so there > > The word "permanently" is confusing. It suggests that it will > never ever be valid again. I would just remove the word. Agreed. >> is no risk of the descriptor unexpectedly being determined as >> valid due to dataring head overflowing/wrapping. > > Please, provide more details about the solved race. OK. > Is it because some reader could have reference to an invalid > (reused) descriptor? Yes, but not because it is reused. If a writer succeeded in reserving a descriptor, but failed to reserve a datablock, that (invalid) descriptor is put on the committed list (see fA). By setting the lpos values to something that could _never_ be valid, there is no risk of the descriptor suddenly becoming valid due to head overflowing. My RFCv2 did not account for this and instead invalid descriptors just held on to whatever lpos values they last had. Although they are invalid at that moment, if not set to something "permanently" invalid, those values could become valid again. We talked about that here[0]. > Can be these invalid descriptors be member of the list? Yes (as Sergey shows in his followup post). Readers see them as invalid and treat them as dropped records. > Also it might be worth to mention where is the check that might > detect such invalid descriptors and what will be the consequences. > Well, this might be clear from the race description. The check itself is not special. However, readers do have to be aware of and correctly handle the case of invalid descriptors on the list. I will find an appropriate place to document this. John Ogness [0] https://lkml.kernel.org/r/20190624140948.l7ekcmz5ser3zfr2@pathway.suse.cz