Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3895157ybl; Mon, 9 Dec 2019 01:50:23 -0800 (PST) X-Google-Smtp-Source: APXvYqwNHVLXEPqUtdOCAAoWQtORF0VP1KqfkGdxJaMjFVRiKx62w4+04ZdupLDK2/7DJ1FUFepY X-Received: by 2002:a05:6830:2116:: with SMTP id i22mr21953390otc.0.1575885023549; Mon, 09 Dec 2019 01:50:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575885023; cv=none; d=google.com; s=arc-20160816; b=PBIWe8NsN3GD+8biOz9NG2SNQ8L3M4OSAz8Rr0AzDQ9PScDhvaPoiL1OSBn/ic8nKm fbk96tQEdlnfjYaojmaXpBqAOAheakfp3NJZe6YcQYLrziLS+nY+NkYQXmlsz7QJ/AJU /nORkjuJMY2bm0+gY2BK8uYHNNjxmaa/0rr08Z9xXTat6mU8eGtuUdUC0zsnUL1C1T2v ydin2Grdf71Dmqfyvro8QZdkDvQSBfGoyhk6C91t3+sKFYn3rnQC/MxD5cIsTfR5id2R WGN7o5NEMfPOGiQgchNhsxUrsjM+bedhpY/iIFvC2VCdl4FpLCymv+suzZfnd4v4v8D/ bSxQ== 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:dkim-signature; bh=rHHQKr0i75mqHj3OhmeZ0+BGxc8hlLVrwIhDe+URYcg=; b=WUKDWYnmaiF3J05ep44PXcpGeKK5esF6dfKoFlnMUo7tHNvaVxW6efiObEZJ7PDrRw PMLHt4/0SAHruOc1az1bHsMmx3Kg18/GCjdQBu/iRKH/qU8apQ5R+8+VAUwjJTq3k/u5 pe3VrwnL3/2QmAzfGMVUZGQR0JakOFn8EdpWuUKR5OYvJCajZswv+Mzyr8Ouw69vThkD JakFR1gUaSFsWelLhzs9yzGu/trv7eRS9ee0GuW8MUz8yOK0SwJ0tC+k/zwsxKFutPbu XHY5nYQGIYEIxO/sRbXhw8hCbKhaVy+Q6X3l/ReDp/c8NaMiUOmbv4HpLfYbHB+DLu8i tR6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ly7daxZy; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o67si11479302oig.49.2019.12.09.01.50.11; Mon, 09 Dec 2019 01:50:23 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ly7daxZy; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727286AbfLIJ2A (ORCPT + 99 others); Mon, 9 Dec 2019 04:28:00 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:37101 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727180AbfLIJ17 (ORCPT ); Mon, 9 Dec 2019 04:27:59 -0500 Received: by mail-pl1-f194.google.com with SMTP id c23so266635plz.4 for ; Mon, 09 Dec 2019 01:27:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=rHHQKr0i75mqHj3OhmeZ0+BGxc8hlLVrwIhDe+URYcg=; b=ly7daxZy/UDhQUWwKvd7jhbdYl8PZTrdBXVYPA/LGkBGar/kbEow0qUzkwwPARo4Gp Pvi91wjoK/CMmeOmdX/bE3oY+FfjVhO9mIHP9k0jd2rXStODOBA3mq+t9xUl+YYlPx+v amDe9j28QSKXWUnuP6wZscHm8qwLTAAt3NOSaCzEXgQJP1JTZpKMbFl7/ucc4Vlh+8tT N9WIta0wOyWg42uMfurq7gTFg4JTqv5vaIZPlmWCLDK5lGtiYf7VxhCpg4Sebwu8VB/1 G3qasHMBSSDgwu0KiimykAl6YPD2OfOiyqzH3TT26Ji/wNnzGYPmDxZkIF77oo3N7xRG sExQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=rHHQKr0i75mqHj3OhmeZ0+BGxc8hlLVrwIhDe+URYcg=; b=PKzoHafCxrkM3UUy1pyp2avJtdZ/9eBCqdiuE6NN/W0bbHqfgZhRNvpacbK32cwuo2 BEgrxU+dnS7jacJR3eWie0goHf1bBAEC/P4p8W60q0GJ63zGZO+klNyfKDrcdtGrqyel T7DOsvZkqzHYeKO7Tek9tyJWt2eMjwEfpM0AkkmMieIqFWQUaECSoAkECPzMo0Toaloe vUJHDnbu70Xhkd0LHNWI2Rx+G/yDfZi3P+FDkwBjck5j7D5qycaxwju7iL2B373DCyyl 0Za1GT8w45k+sTsbZSOa2MhuQzaSulukftjdkJ/OMY7yMKe7+Tb6VeJwcQsC9e+rVRwI qZZQ== X-Gm-Message-State: APjAAAVQrzGGUGXe+XQlpqNIV9keygPCUcVNszvuheCslranoAcEH77G v3Mbqfyt9lwkQxDj4WO3BZc= X-Received: by 2002:a17:90a:9f04:: with SMTP id n4mr31320455pjp.76.1575883679106; Mon, 09 Dec 2019 01:27:59 -0800 (PST) Received: from localhost ([2401:fa00:8f:203:250d:e71d:5a0a:9afe]) by smtp.gmail.com with ESMTPSA id k13sm16545287pfp.48.2019.12.09.01.27.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2019 01:27:58 -0800 (PST) Date: Mon, 9 Dec 2019 18:27:56 +0900 From: Sergey Senozhatsky To: John Ogness Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Petr Mladek , Sergey Senozhatsky , Steven Rostedt , Linus Torvalds , Greg Kroah-Hartman , Andrea Parri , Thomas Gleixner , Sergey Senozhatsky , Brendan Higgins , kexec@lists.infradead.org Subject: Re: [RFC PATCH v5 1/3] printk-rb: new printk ringbuffer implementation (writer) Message-ID: <20191209092756.GH88619@google.com> References: <20191128015235.12940-1-john.ogness@linutronix.de> <20191128015235.12940-2-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191128015235.12940-2-john.ogness@linutronix.de> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (19/11/28 02:58), John Ogness wrote: > + * Sample reader code:: > + * > + * struct printk_info info; > + * char text_buf[32]; > + * char dict_buf[32]; > + * u64 next_seq = 0; > + * struct printk_record r = { > + * .info = &info, > + * .text_buf = &text_buf[0], > + * .dict_buf = &dict_buf[0], > + * .text_buf_size = sizeof(text_buf), > + * .dict_buf_size = sizeof(dict_buf), > + * }; > + * > + * while (prb_read_valid(&rb, next_seq, &r)) { > + * if (info.seq != next_seq) > + * pr_warn("lost %llu records\n", info.seq - next_seq); > + * > + * if (info.text_len > r.text_buf_size) { > + * pr_warn("record %llu text truncated\n", info.seq); > + * text_buf[sizeof(text_buf) - 1] = 0; > + * } > + * > + * if (info.dict_len > r.dict_buf_size) { > + * pr_warn("record %llu dict truncated\n", info.seq); > + * dict_buf[sizeof(dict_buf) - 1] = 0; > + * } > + * > + * pr_info("%llu: %llu: %s;%s\n", info.seq, info.ts_nsec, > + * &text_buf[0], info.dict_len ? &dict_buf[0] : ""); > + * > + * next_seq = info.seq + 1; > + * } > + */ Will this loop ever end? :) pr_info() adds data to ringbuffer, which prb_read_valid() reads, so pr_info() can add more data, which prb_read_valid() will read, so pr_info()... -ss