Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp587087ybt; Fri, 26 Jun 2020 06:51:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEXoO/Xwo2siSiWHP2wXNQoE5R5UCpwYX9kKJ8Wya/zGpsG+EGppeWKkB685XG0hX79txf X-Received: by 2002:aa7:c655:: with SMTP id z21mr3476640edr.330.1593179517054; Fri, 26 Jun 2020 06:51:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593179517; cv=none; d=google.com; s=arc-20160816; b=O0s0H2uwmvh2NpYWJOZjCzjcGcwXxMCYYf3K/mwNOmP9VoVOMIgVlXw8brLrExXB9g cUnCEaD0OM7SdzGhGawsp/V4oOay0FhXAEgp9Y6LtKHoRnEXhx8ZHeFsCS9s8/KRd5Xj hh3RH5lFas/2reDhijLgLPKxT5oBihKz6lZM6X5Y/Q0UB4zohl80wOJJftUjBlPxg+l8 yeXy8e61vjjyeItvT+QjyGAsdGZ3ueXsyCVDRa8zY3p/j8bmzGN3rse3Nb9SR3d2DQp/ VW4GpR3hvg2qcBwQFzHJ4j3sjspX8wvT8JBdNH5SpXmKhe5o4krxk8bAWH6lQ3WnkLUm QWJw== 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 :in-reply-to:date:references:subject:cc:to:from; bh=VFZXFX8T1SRE0Znxgw/I/D4i+gATp/RyNVxlrp03jlM=; b=0Uwi9tRUT4HKMuPKCnlZuDfBMiKNpB/xU5rr9M3vd1ARXQwX/m5Fgfvw91Q0R+79dk UIG1Mi8Ws/p3bPku+YRhOMPpIAmhMlYeRuYPX9QmK+6plCsgbd4obLAG1eRblucr7F/H hVBCBo57BOSouBCJflNOYzmul2XyfoOpmbbXLTGuwir/hR9/niznl3INZjdboHW4j/wU AKqZYA9VCI5CdEoySHziv/0152kVusD5Qtnl2zR+oHJn1vNwgNDsBD04FRaaxcEJxQVf gR/lwgSjtApCahx5INtlAcH/rTRLTBLeO/HZVE0xv8IBOE+lEJTF/KSnaQEDoRkORmOj eqtQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l15si12208822eji.501.2020.06.26.06.51.32; Fri, 26 Jun 2020 06:51:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728708AbgFZNs4 (ORCPT + 99 others); Fri, 26 Jun 2020 09:48:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728489AbgFZNs4 (ORCPT ); Fri, 26 Jun 2020 09:48:56 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D46CBC03E979 for ; Fri, 26 Jun 2020 06:48:55 -0700 (PDT) Received: from p508752b4.dip0.t-ipconnect.de ([80.135.82.180] helo=vostro) by Galois.linutronix.de with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1jooin-00048z-Aa; Fri, 26 Jun 2020 15:48:49 +0200 From: John Ogness To: Petr Mladek Cc: Peter Zijlstra , Sergey Senozhatsky , Sergey Senozhatsky , Steven Rostedt , Linus Torvalds , Greg Kroah-Hartman , Andrea Parri , Thomas Gleixner , Paul McKenney , kexec@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: truncate dict: was: Re: [PATCH v3 3/3] printk: use the lockless ringbuffer References: <20200618144919.9806-1-john.ogness@linutronix.de> <20200618144919.9806-4-john.ogness@linutronix.de> <20200625081650.GE6156@alley> Date: Fri, 26 Jun 2020 15:48:42 +0200 In-Reply-To: <20200625081650.GE6156@alley> (Petr Mladek's message of "Thu, 25 Jun 2020 10:16:50 +0200") Message-ID: <87wo3u2b0l.fsf@jogness.linutronix.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-06-25, Petr Mladek wrote: >> --- a/kernel/printk/printk.c >> +++ b/kernel/printk/printk.c >> @@ -594,22 +473,26 @@ static u32 msg_used_size(u16 text_len, u16 dict_len, u32 *pad_len) >> #define MAX_LOG_TAKE_PART 4 >> static const char trunc_msg[] = ""; >> >> -static u32 truncate_msg(u16 *text_len, u16 *trunc_msg_len, >> - u16 *dict_len, u32 *pad_len) >> +static void truncate_msg(u16 *text_len, u16 *trunc_msg_len, u16 *dict_len) >> { >> /* >> * The message should not take the whole buffer. Otherwise, it might >> * get removed too soon. >> */ >> u32 max_text_len = log_buf_len / MAX_LOG_TAKE_PART; >> + >> if (*text_len > max_text_len) >> *text_len = max_text_len; >> - /* enable the warning message */ >> + >> + /* enable the warning message (if there is room) */ >> *trunc_msg_len = strlen(trunc_msg); >> + if (*text_len >= *trunc_msg_len) >> + *text_len -= *trunc_msg_len; >> + else >> + *trunc_msg_len = 0; >> + >> /* disable the "dict" completely */ >> *dict_len = 0; > > The dictionary does not longer need to be removed at this point. > It is stored in a separate buffer. It is ignored by prb_reserve() > when there is not enough space for it. Agreed. @dict_len argument will also be dropped from the function. John Ogness