Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp3349076ybd; Tue, 25 Jun 2019 00:44:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzpZgQG+6C9DYzljc2JhD/r3mticUhN84GKhlKJvWvsSaM541uWo3ERpViVj/YPFXEGC12E X-Received: by 2002:a17:902:28c9:: with SMTP id f67mr154576998plb.19.1561448683611; Tue, 25 Jun 2019 00:44:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561448683; cv=none; d=google.com; s=arc-20160816; b=DTqar85GXgtShZeXHCwifR6MRMx46otkmvkn+YF3+UrsHlHXvB/nPhj0WS8XDJVndw Y0AZ76PP0hec2eTLUUT+5Vmjsm763CKCZ47CCQbSxnVGTBJVYVs8ZMrGjnAyDcghZtlF 2m0QBN7PId6l6OfIo1AzOGIohOEzA9HxA+7WlNM7sJGxIij84Q/BRGa+bH0Fu77dZPmZ ehbKsoIVObpCXGyZ185VoIMTx2wO+KHiSnjpKNI+k8/M9mXkzLFZa/G5cWiF/GVNXefs X1TnNpxXbU2Sn8yzPCfaTQO9bsrE4ABFde8AIEwFFwtIOau02+A+5AIP399+pLm0hTgU /pmg== 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=CAifnpJEO2ZMcI2CGYepWiuJi+SsX7+yIHhOSV88sqY=; b=tsdlbt+w/qpHdFUE8s5HIkjIIhMM56Voa0PfB9E3nQNQgghuMlqD34Y3gQ4exMU6DA 8m+Dv69by0LM1Yp5Wg215jdiAMBFfDOoZIttkhZTXut6Z4k/Vw5dypX7I3swJQ9ueF3m 2fxrKqlhYki0OVvApvzMGaYed9LWXVfvMj2eLUkBRt2e/WzsQGzv5zcXeZAfbLt36osZ aHZBVyuiet54WyHh2d56A/OYfBR1ezwycKQIsSJf0BFL+gHEM7aA+thvswoqOAQx6D57 8CW5J7g4zqyG1vEVM37QF6peY2lOpA1fxp4EjMCTl84C3rNhVj3jZ/GL63VHmPGwNgob VXIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sTuszrkc; 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 n9si11816617pgp.532.2019.06.25.00.44.27; Tue, 25 Jun 2019 00:44:43 -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=sTuszrkc; 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 S1729578AbfFYGpt (ORCPT + 99 others); Tue, 25 Jun 2019 02:45:49 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:41725 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726551AbfFYGpt (ORCPT ); Tue, 25 Jun 2019 02:45:49 -0400 Received: by mail-pg1-f195.google.com with SMTP id y72so8430478pgd.8 for ; Mon, 24 Jun 2019 23:45:48 -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=CAifnpJEO2ZMcI2CGYepWiuJi+SsX7+yIHhOSV88sqY=; b=sTuszrkcp+SlrQ+SCcJ+X7Xy8O/avyX6FScMpy8MoB341G0m8jH3c4Po+dDoRo9KwT yhW2ybt9aVuJW/tJyS+wvOaIzLV6BgPisDUGF1adW9y85hL1JWleJx2OMMCjw9URNT4t /X5gIHdfIAn/9kEEUZzFKYZXcc4C0YjqgKUpg07PP6uXLXrVVyYrfIvxPZ/ZeaniUqDc 0vOKm4GqPr0sHcs2vf65dtRqtH7SvQTRTgpDqREP5YO0od01pTt/sbrL6sj4Jfcngb0a r7nkl/HiKorDjL7CIZ8Z583Lot39dplPAHoQf1ZfFitWKLVE8oj/0VrXp1OUplL16Lwv Qc7w== 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=CAifnpJEO2ZMcI2CGYepWiuJi+SsX7+yIHhOSV88sqY=; b=NONrSW92iBR4eU4dnCC0vIjqoamD6Ul/WQBgfVhqCTcMjHHpW88wzi/7gm2J4nkaVZ WumDAofe920pKjZoCnh5ew4Jg09/xZvl6w9Zj25YkdkYmxVQuJq6ay8RoQXrc6AnKRXP l/D9vXXbfTQIa9wk+VceN42KCRuEcUNPlxlP3G2QAiQ/Y7eGRVwGz5OYvUE/bzj/Eq8H qGu91b7PVWcXpNBvNe0Iwasc64RKfCIQskWofW8yF/czFWLcBusA+/17zATlrR5j0qWp 4Qc5O9OaBTw57cEOf9Eq35IQfuqomDw0BjSW0GcXDHws3LOkhKkeydmtuRtxrSs3WmV1 3gqA== X-Gm-Message-State: APjAAAWSF2yT0weu8dfSM2TXBLp1skV9Yex0VF5K/C37vLXtczIeArbh vMeiPmcp1Ln783WLVQr+NG0= X-Received: by 2002:a63:490a:: with SMTP id w10mr36637630pga.6.1561445148568; Mon, 24 Jun 2019 23:45:48 -0700 (PDT) Received: from localhost ([175.223.22.38]) by smtp.gmail.com with ESMTPSA id y12sm12446187pgi.10.2019.06.24.23.45.46 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 24 Jun 2019 23:45:47 -0700 (PDT) Date: Tue, 25 Jun 2019 15:45:43 +0900 From: Sergey Senozhatsky To: John Ogness Cc: Sergey Senozhatsky , linux-kernel@vger.kernel.org, Peter Zijlstra , Petr Mladek , 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: <20190625064543.GA19050@jagdpanzerIV> References: <20190607162349.18199-1-john.ogness@linutronix.de> <20190607162349.18199-2-john.ogness@linutronix.de> <20190618045117.GA7419@jagdpanzerIV> <87imt2bl0k.fsf@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87imt2bl0k.fsf@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 On (06/19/19 00:12), John Ogness wrote: > On 2019-06-18, Sergey Senozhatsky 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. > > Agreed. Documentation should show good examples. In vprintk_emit(), are we going to always reserve 1024-byte records, since we don't know the size in advance, e.g. printk("%pS %s\n", regs->ip, current->name) prb_reserve(&e, &rb, ????); or are we going to run vscnprintf() on a NULL buffer first, then reserve the exactly required number of bytes and afterwards vscnprintf(s) -> prb_commit(&e)? -ss