Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp631839ybm; Wed, 27 May 2020 04:20:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbLknrvsP1BkCeuMncJi1Da0U/95ArK933oCmmxC/xvRcXwC94hvGhZbs2WIiQOezlw4fN X-Received: by 2002:a17:906:17d1:: with SMTP id u17mr5442435eje.242.1590578434236; Wed, 27 May 2020 04:20:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590578434; cv=none; d=google.com; s=arc-20160816; b=reGtakcEC+jmjtUSX6pnjPkMCJ0MWfaxScVjliaUgcdzIxvo/z8CwzjU6pE8t5vstK PDFcaUJeR0zWv9IjOf+cicxWdYo5JC9gEtrqJAK7nfMTw7sa2xD58WIY4NBMNM11zlFQ 2XilQ+YHY9j+TRMfoyRs+wFZ99AhIrh6ATgSY5pySVVW9KF8+ZAUvFczzjXEKKg3yPHu DHfsRMUU4sjMSi3PrVVyI5isMBilxJxARj2mUf5RBbTuqLyOfuqYbmsWMaARyzeXsChb Uh1z4iZQF5wIFBBCPCQj7xgtiqUkwoovXVfCoY9jYHdPy/kcI9G/mTaKDs8aMMFgM02s I/FA== 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; bh=BYihUqzcqDhIBwtioznoNgqjva9qKx/fAT0fRh6aJr4=; b=CpLZvmFIEViXXMi3qYUV3zorLNsbxElNx63h1qgMAubgQaccbS1RWqPK9MLDVzmPAA UaMrS3qN3unkJZT/QuEMHeuh1IEB/lnKTDEnQs+HhefIKZ6bhQuYZpqVNL8t+wkDd2mt bUHOS6gKmuwNZ6o9KB9hyidBlzzlkiLT/qsw/5gAWX4ga4y3Wc6yFPJSH3jNiF0xjHgW 92CpYAbRZqapCxGkn4+S/rJmPUAnatg/sjt5YbGqqbOKeIGu0THCdrJd3qV2EO3Q3pK0 Mloh+0gLFInRacSC0G4gshuAnkVII1gGonLLtHBIZ0AK7G4Azq22NINPqzztMMxUMqe4 8kTA== 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 rh27si1775018ejb.217.2020.05.27.04.20.10; Wed, 27 May 2020 04:20:34 -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 S2388049AbgE0Ihv (ORCPT + 99 others); Wed, 27 May 2020 04:37:51 -0400 Received: from mx2.suse.de ([195.135.220.15]:50258 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387858AbgE0Ihv (ORCPT ); Wed, 27 May 2020 04:37:51 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 70657AD65; Wed, 27 May 2020 08:37:51 +0000 (UTC) Date: Wed, 27 May 2020 10:37:47 +0200 From: Petr Mladek To: Tetsuo Handa Cc: Sergey Senozhatsky , Andrew Morton , linux-kernel@vger.kernel.org, Dmitry Vyukov , Ondrej Mosnacek , Steven Rostedt Subject: Re: [PATCH] twist: allow converting pr_devel()/pr_debug() into printk(KERN_DEBUG) Message-ID: <20200527083747.GA27273@linux-b0ei> References: <20200524145034.10697-1-penguin-kernel@I-love.SAKURA.ne.jp> <20200525084218.GC5300@linux-b0ei> <20200525091157.GF755@jagdpanzerIV.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Mon 2020-05-25 19:43:04, Tetsuo Handa wrote: > On 2020/05/25 17:42, Petr Mladek wrote: > > I see few drawbacks with this patch: > > > > 1. It will cause adding much more messages into the logbuffer even > > though they are not flushed to the console. It might cause that > > more important messages will get overridden before they reach > > console. They might also make hard to read the full log. > > Since the user of this twist option will select console loglevel in a way > KERN_DEBUG messages are not printed to consoles, KERN_DEBUG messages will > be immediately processed (and space for future messages will be reclaimed). > Therefore, I don't think that more important messages will get overridden. This is not fully true. More important messages will still be printed to the console. The debug messages will not be skipped before the older messages are proceed. I mean that many debug messages might cause losing more important ones before the old important messages are proceed. > This twist option might increase possibility of mixing KERN_DEBUG messages > and non-KERN_DEBUG messages due to KERN_CONT case. > > But if these concerns turn out to be a real problem, we can redirect > pr_devel()/pr_debug() to simple snprintf() which evaluates arguments > but discards the result without storing into the logbuffer. > > > > > 2. Crash inside printk() causes recursive messages. They are currently > > printed into the printk_safe() buffers and there is a bigger risk > > that they will not reach the console. > > Currently "static char textbuf[LOG_LINE_MAX];" is "static" because it is used > under logbuf_lock. If we remove "static", we can use "char textbuf[LOG_LINE_MAX];" > without logbuf_lock. Then, we can bring potentially dangerous-and-slow vscnprintf() > in vprintk_store() to earlier stage (and vprintk_store() will need to do simple > copy) so that oops in printk() will happen before entering printk-safe context. > I think that this change follows a direction which lockless logbuf will want. No, LOG_LINE_MAX is too big to be allocated on stack. Well, it would be possible to call vsprintf() with NULL buffer. It is normally used to calculate the length of the message before it is printed. But it also does all the accesses without printing anything. > > Have you tested this patch by the syzcaller with many runs, please? > > Did it helped to actually discover more bugs? > > Did it really made things easier? > > syzbot can't test with custom patches. The only way to test this patch is > to send to e.g. linux-next.git which syzbot is testing. OK, we could try this via some test branch that will go into linux-next but it would not be scheduled for the next merge window. For the testing, this patch might be good enough. For eventual upstreaming, I would prefer to handle this in lib/dynamic_debug.c by enabling all entries by default. This would solve all DYNAMIC_DEBUG_BRANCH() users at one place. Anyway, I would like to see a proof that it really helped to find some bugs an easier way before upstreaming. Best Regards, Petr