Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3312556ybi; Mon, 17 Jun 2019 21:53:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqzqYbstXSJrTR/+Of0hT/9pGeIRsTqy+V/83V4rJnyJn0QX5oMhzl4uOHEA2X5CC2wR5pYw X-Received: by 2002:a65:4c44:: with SMTP id l4mr848719pgr.62.1560833588156; Mon, 17 Jun 2019 21:53:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560833588; cv=none; d=google.com; s=arc-20160816; b=zWQD8AIiMPj9+WjqCNQIh0OcSiai+JeTbRSF2+Iu6z8weh1P8Syab+fpbpDgSxpATF UrcM3oU7z8Rg/1lSEYkGJCMrrXZQD5lAIrv2q4+XXz+rPKeiZGozIdWHtMwxt9wFYHPU N6G2Z7cebZwKKwfCmKilqQl6i5acQvXamKtcl47Fmu0x33I7Y0Kaz6ytFOY8WJfahl95 3m2wl9Lf3w8H2JGLT0JX41JJBJ7xMBcgvBhYXAoX1DWcPg0rIUICtRt7NQypG/uc0Rof sgA/j65TuFZiPoVNRbxm7mdQFB0nEaFmHBn+5uR3pMlbVodbWBq8u8696bAH5FCgjMFw Ogyw== 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=GcQlY8S/p+kxFAnMkubPgYwK7VdqjVATnBI9h9/SPA8=; b=VI27vjl/G4msLGL4ieUDEyYKibQ2DUvcFafFFMzdX2hNJ5rG/LNfoTDdA3Gu879KYI hTk0impx3wJOxwCr8Ux5uQ60uTQBd0vk/Y+UAD6RHZ0Ef0pYXwngd8IUYGPfjYL9aSqx 9zXb+Ee23rg19kcrTCyfSHn1vOdeOjV630W2sYpgjYpX6yssPAkN4qvh0MsJ3Ux/ozey FHpckvP+BbR0hQSDjCofv4ch53FwtNMRwwdGgBmbmzMPDitxBZMHty4LjE37+09gesjk iONsG42pDvmeFXel0Gs5hLsaFNGjyyY4FRUuG/dOeNQPALfr5hcW1eJ1IrKIBKKcWdJ4 ogKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BCgORY8f; 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 l3si12116759pgj.284.2019.06.17.21.52.52; Mon, 17 Jun 2019 21:53:08 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BCgORY8f; 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 S1727186AbfFREvW (ORCPT + 99 others); Tue, 18 Jun 2019 00:51:22 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:37002 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725870AbfFREvW (ORCPT ); Tue, 18 Jun 2019 00:51:22 -0400 Received: by mail-pf1-f196.google.com with SMTP id 19so6903962pfa.4 for ; Mon, 17 Jun 2019 21:51:22 -0700 (PDT) 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=GcQlY8S/p+kxFAnMkubPgYwK7VdqjVATnBI9h9/SPA8=; b=BCgORY8fG3p2oZw4qFVaCKNKF/8FqPeWfMM2TL82ob4r8YP15GX8hY1rRi6tjCHne0 6/p5Tp4P33PsKTtiG8glwrn63CWlEDeK7z//GlWuLn/bz9n8lpQ89oss+iskkNCc+O1A A6ZA0M+jt149ybUbHdSlhJqSk+DlwugQxYeivu7pcDMa9h/ch4aDl9TNhG8OaRpUmWQ+ h60lxa2M9X4uvJcPIBqAGFnBitHlZTwuLhOhU8wLF0vuf1/DTgjV1/moZwpu0zOw6gts YWBO7DzOOr7UnnWe6Injlrgx+BlIhdOAybooB7Y0IYCs4944Uw8OgNxX7Fl+8v6M9+WR zKxg== 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=GcQlY8S/p+kxFAnMkubPgYwK7VdqjVATnBI9h9/SPA8=; b=GAPgHwbRrl3GcghCgPtN1pjMW1dUIznto9iW/dOHVmbYdvbJ6fvGjZ14nAVuscQUI/ W3E7aGqp5jpC8UCDl70a0RTggCZPv6NcMdvh7YEOCV6hlyQqJWxBa1E7WtSfP27yLZJn Zb7cGZZMx9agX81rbQQ7MFKpuPE+BzN/gQufN+Ju81p6/+CJc2jRL6YIxFQPglAUdZpk 4FQ8s/1U5jXGDbrWUYfWy3YcGu7kMxRU1kBBTpcr7QiLIscmkzC3qZlYXtSiQwNTV/OC mOvFt64qiALic1YxSQlRqWrUA2G0+XWuOcbv8hPvRidszFjVUlmFIBb1kWgbDo/qjoBw 1Nuw== X-Gm-Message-State: APjAAAUISco5jIzPQfYOTCCXkGsEHWEVpy1JMZXqHNhF6zpcTotI5Awy jlGqcsUTiCYYXRoj6UUOpnM= X-Received: by 2002:a17:90a:db44:: with SMTP id u4mr2965916pjx.52.1560833481851; Mon, 17 Jun 2019 21:51:21 -0700 (PDT) Received: from localhost ([175.223.20.188]) by smtp.gmail.com with ESMTPSA id e184sm18115681pfa.169.2019.06.17.21.51.20 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 17 Jun 2019 21:51:20 -0700 (PDT) Date: Tue, 18 Jun 2019 13:51:17 +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 Subject: Re: [RFC PATCH v2 1/2] printk-rb: add a new printk ringbuffer implementation Message-ID: <20190618045117.GA7419@jagdpanzerIV> References: <20190607162349.18199-1-john.ogness@linutronix.de> <20190607162349.18199-2-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190607162349.18199-2-john.ogness@linutronix.de> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello John, On (06/07/19 18:29), John Ogness wrote: [..] > + struct prb_reserved_entry e; > + char *s; > + > + s = prb_reserve(&e, &rb, 32); > + if (s) { > + sprintf(s, "Hello, world!"); > + prb_commit(&e); > + } A nit: snprintf(). sprintf() is tricky, it may write "slightly more than was anticipated" bytes - all those string_nocheck(" disabled"), error_string("pK-error"), etc. [..] > +Sample reader code:: > + > + DECLARE_PRINTKRB_ENTRY(entry, 128); > + DECLARE_PRINTKRB_ITER(iter, &test_rb, &entry); > + u64 last_seq = 0; > + int len; > + char *s; > + > + prb_for_each_entry(&iter, len) { > + if (entry.seq - last_seq != 1) { > + printf("LOST %llu ENTRIES\n", > + entry.seq - (last_seq + 1)); > + } > + last_seq = entry.seq; > + > + s = (char *)&entry.buffer[0]; > + if (len >= 128) > + s[128 - 1] = 0; > + printf("data: %s\n", s); > + } How are we going to handle pr_cont() loops? print_modules() preempt_disable(); list_for_each_entry_rcu(mod, &modules, list) { pr_cont(" %s%s", mod->name, module_flags(mod, buf)); } preempt_enable(); -ss