Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp547877rwb; Mon, 26 Sep 2022 02:38:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5DLHYYg9JhZkqXU/RjclY2l8+ZVWKVnWdkh414+xGhUmJOOZw6T+DEkDvtfmaekeVQ6IEC X-Received: by 2002:a17:90b:17c9:b0:202:640c:ec5 with SMTP id me9-20020a17090b17c900b00202640c0ec5mr24390044pjb.71.1664185133191; Mon, 26 Sep 2022 02:38:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664185133; cv=none; d=google.com; s=arc-20160816; b=xcnMGW7OqoGAEtrFt2JNeCf4q6xyJFtf7x09B5jK4d+PLOy6lKd1BtGI/r5g/SH7DV 12t12vwcYX/OnhJZcTz7aw7EDkwgkLrPMmYkRltQZQumHYLqyhgmHBm6wq2QmV0y4tzA hhOCwITS3A9g0tzE8KPyYWbFJdklnOWecXMo+DXXw5UHcPzHO6hb4wIinW3uw6Gq0Zlr k2AFM0WxTy1aFSHyFgA1z1GvprGIhkdMg93ollcID8uzQbb8U7dyh7CIaR9QXPyAwDIf hzdSPPHBlljyT7NPoAP4Yy3ECL48wyepVPHKG5ZTVUm2w0i1nQZ2p9q7nxxYa5BbUC7h EA3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=z34IoLMo4N/tZbhNNm119rJSop1B4giR+c+9BX86tb4=; b=LNiIXqLveT7SvYZWsBvIUNO7pzKmTEbSVAbuvG1moQaG/oh4GV4/e+oQow1A50wqNn 341UvyceEQ+YDZklvwXF0o2v9eQzFU7eCggAbhUv1Nn9MTvnBkEafU4eLKUUtnTV6ahV +J5JLIo5u71lN8EALXvRoJ3Jupf2t8dQ0viJFI9QmdigUSHm6UukrZdq2Ss6VVh0CXP2 si+xTyN2X+qgOsbnO+GP2t5dkes4kwNB2EgzvezNZmHzlVRaJOBNk5ckmDTbjp3sjP+y sWU8QJy3JmvxqyM9qGQ9zudO5pxjIzjqK+NyZ7B27u5292ojEmnD7iNiiDokYAip6aUr KzMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=aIsemP6P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i8-20020a639d08000000b00439246eabf1si12394685pgd.618.2022.09.26.02.38.41; Mon, 26 Sep 2022 02:38:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=aIsemP6P; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234335AbiIZJYj (ORCPT + 99 others); Mon, 26 Sep 2022 05:24:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234874AbiIZJXp (ORCPT ); Mon, 26 Sep 2022 05:23:45 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7B022AC4 for ; Mon, 26 Sep 2022 02:22:21 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id jm5so5649881plb.13 for ; Mon, 26 Sep 2022 02:22:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=z34IoLMo4N/tZbhNNm119rJSop1B4giR+c+9BX86tb4=; b=aIsemP6PNKWhMgQ0ocIwr50VrKucycnzKZTNB3PWfsZ4Dm+HzlWD8IcTQGdFCsUSeZ JC8uWl1FVSOJYhiIyPtTzXUxnKaKRLEO/FdMPFDOV/EZIQ3tQWU6mS2xDTM/y9qux2LH CcgSkyVculAp1x90CmVCwqB0CBEcYtcpHojxE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=z34IoLMo4N/tZbhNNm119rJSop1B4giR+c+9BX86tb4=; b=acrGjIQR9U53jxY5PKygfmrnx2NGMp+tw4uVUExZYzfv4KgFucepAq/ORuvetzrGdT idO0kpAxk1cTujeZOP01RA531cUV4RBDhFrKY/nL/TF21obxg7bK/TB2DriQr4qYq8SZ lcpIyh6W5+w9qcSH/RTJboJsCE/nWyBwAwDYHTUeZpJT90ToNqpjiRh90l+nfCmWQ3Qu E9O6No3mHJosufIkqe6Tok40wj+/X7b3b3g6uDfCr/+3ZkjZgb47IIfdBaIR2pVawg7+ iEWT9KikG++tIQhCht+onAmgYu5xIFLVwYZJf7IcsaSYDTxIeQ12G9CP3YcGqjEP+38g 1a3A== X-Gm-Message-State: ACrzQf3MbpbX6SRCDzYRYMMOJvDMsAfrWwm4I2Ed3mr84/zeOyO8Kg6G 6n8fna4lygJw+CDm6LBEO+AWWQ== X-Received: by 2002:a17:903:244a:b0:177:f32b:19ff with SMTP id l10-20020a170903244a00b00177f32b19ffmr21474690pls.103.1664184141443; Mon, 26 Sep 2022 02:22:21 -0700 (PDT) Received: from google.com ([240f:75:7537:3187:2a7d:69c:905d:1926]) by smtp.gmail.com with ESMTPSA id 201-20020a6215d2000000b00537daf64e8esm11742806pfv.188.2022.09.26.02.22.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 02:22:21 -0700 (PDT) Date: Mon, 26 Sep 2022 18:22:16 +0900 From: Sergey Senozhatsky To: John Ogness Cc: Petr Mladek , Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Greg Kroah-Hartman Subject: Re: [PATCH printk 18/18] printk: Handle dropped message smarter Message-ID: References: <20220924000454.3319186-1-john.ogness@linutronix.de> <20220924000454.3319186-19-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220924000454.3319186-19-john.ogness@linutronix.de> X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (22/09/24 02:10), John Ogness wrote: [..] > +/** > + * cons_print_dropped - Print 'dropped' message if required > + * @desc: Pointer to the output descriptor > + * > + * Prints the 'dropped' message info the output buffer if @desc->dropped is > + * not 0 and the regular format is requested. Extended format does not > + * need this message because it prints the sequence numbers. > + * > + * In regular format the extended message buffer is not in use. > + * So print into it at the beginning and move the resulting string > + * just in front of the regular text buffer so that the message can > + * be printed in one go. > + * > + * In case of a message this returns with @desc->outbuf and @desc->len > + * updated. If no message is required then @desc is not modified. > + */ > +static void cons_print_dropped(struct cons_outbuf_desc *desc) A silly nit: as far as I can tell printk API uses console_foo for naming, so my personal preference would be to spell console_ instead of cons_ (in this and in previous patches). > +{ > + struct cons_text_buf *txtbuf = desc->txtbuf; > + size_t len; > + > + if (!desc->dropped || desc->extmsg) > + return; > + > + if (WARN_ON_ONCE(desc->outbuf != txtbuf->text)) > + return; > + > + /* Print it into ext_text which is unused */ > + len = snprintf(txtbuf->ext_text, DROPPED_TEXT_MAX, > + "** %lu printk messages dropped **\n", desc->dropped); > + desc->dropped = 0; > + > + /* Copy it just below text so it goes out with one write */ > + memcpy(txtbuf->text - len, txtbuf->ext_text, len); > + > + /* Update the descriptor */ > + desc->len += len; > + desc->outbuf -= len; > +} > + > An even sillier nit: extra blank line /* can't help noticing it every time I read this function :) */