Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp3573357imb; Tue, 5 Mar 2019 13:02:24 -0800 (PST) X-Google-Smtp-Source: APXvYqxyujR7MybqYrrg9sx/9eseGcCZtf8cWil6uLJpkg/cSUg3bWkNL6dsnuFuKKCtjTueM0wt X-Received: by 2002:a63:460a:: with SMTP id t10mr3064671pga.354.1551819744498; Tue, 05 Mar 2019 13:02:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551819744; cv=none; d=google.com; s=arc-20160816; b=wFN5FbzacUPkHqZ3dwF1erwMZqx6ZeOYfSTuRoNUxp2hWZQiyeq3w+UsE2MYxA44fS UHY35TLwzDxYX4dCC/FIGl3uuENHL8blXl+Ujpsd2J9/q16Js4JdFwI8D6FU4DvAOg7n dEKIiFj6WlcUN/u8STsbXclonh8tpIdUYLgpdtVIuJXNBAzT44J8F2MBCY6cu5QZCEwj J+W3IYnRMmbpuOH55essGPvJyc5Dtym+KVKf7/i+xM2nlrbRHSFqNAXbI8ScbhLlZYpK pERnJUaiNa/yBccL2uhTQjgXGvvTx/Mb6S1wKxyvUiW/ZiMg44c8TIKwtwCZkTq5fvc/ ArMw== 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=s3mJclE1sf0MQuwBBvpxA5gU/OP5FxZQVqWNqt8XQBI=; b=H5zdqEFDczOOReLfgIjh1lumCtpHBMcVRWw2Rd0L2Mcmlvq7wQiO66jK/jW6dw5xic 0bGAsHXKoxsbbVQ+FqJ/ohYUb5dKYXNh7w/ho8+65loATxtEg3VbgY+CyNXuUJOL6Tmf yZYilWswNSjbBKYrMfdIov/11m5ojpVdJhADZ+LncHqgh/6Az4h0q2nOzrHhkI9DnZB3 Be+CAbiZFjKFFmu14OVTLmvNxdRMcbvOkNxOZtHQxkdqVQ3fJxuQBRD9V16SNx6c6yS4 Rg58y45O9WM+QWD0U//YyB2JrqIGgF8H1VrMGeHN2zeBnnwGfUQR+bam7qSnkNiHidiB GmhA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 70si2963716ple.294.2019.03.05.13.02.08; Tue, 05 Mar 2019 13:02:24 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728612AbfCEVBn (ORCPT + 99 others); Tue, 5 Mar 2019 16:01:43 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:47316 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726069AbfCEVBn (ORCPT ); Tue, 5 Mar 2019 16:01:43 -0500 Received: from localhost ([127.0.0.1] helo=vostro.local) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1h1HBO-0006fN-Vo; Tue, 05 Mar 2019 22:01:03 +0100 From: John Ogness To: Sergey Senozhatsky Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Petr Mladek , Steven Rostedt , Daniel Wang , Andrew Morton , Linus Torvalds , Greg Kroah-Hartman , Alan Cox , Jiri Slaby , Peter Feiner , linux-serial@vger.kernel.org, Sergey Senozhatsky Subject: Re: [RFC PATCH v1 08/25] printk: add ring buffer and kthread References: <20190212143003.48446-1-john.ogness@linutronix.de> <20190212143003.48446-9-john.ogness@linutronix.de> <20190304073856.GA552@jagdpanzerIV> <20190304100044.GC21004@jagdpanzerIV> <20190304110703.GA960@tigerII.localdomain> Date: Tue, 05 Mar 2019 22:00:58 +0100 In-Reply-To: <20190304110703.GA960@tigerII.localdomain> (Sergey Senozhatsky's message of "Mon, 4 Mar 2019 20:07:03 +0900") Message-ID: <87o96p9gtx.fsf@linutronix.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sergey, Thanks for your feedback. I am responding to this comment ahead of your previous comments because it really cuts at the heart of the proposed design. After addressing this point it will make it easier for me to respond to your other comments. NOTE: This is a lengthy response. On 2019-03-04, Sergey Senozhatsky wrote: >> But in general, channels which depend on preemptible printk will >> become totally useless in some cases. > > Which brings me to a question - what are those messages/channels? Not > important enough to be printed on consoles immediately, yet important > enough to pass the suppress_message_printing() check. I would like to clarify that message supression (i.e. console loglevel) is a method of reducing what is printed. It does nothing to address the issues related to console printing. My proposal focusses on addressing the issues related to console printing. Console printing is a convenient feature to allow a kernel to communicate information to a user without any reliance on userspace. IMHO there are 2 categories of messages that the kernel will communicate. The first is informational (usb events, wireless and ethernet connectivity, filesystem events, etc.). Since this category of messages occurs during normal runtime, we should expect that it does not cause adverse effects to the rest of the system (such as latencies and non-deterministic behavior). The second category is for emergency situations, where the kernel needs to report something unusual (panic, BUG, WARN, etc.). In some of these situations, it may be the last thing the kernel ever does. We should expect this category to focus on getting the message out as reliably as possible. Even if it means disturbing the system with large latencies. _Both_ categories are important for the user, but their requirements are different: informational: non-disturbing emergency: reliable But what if a console doesn't support the write_atomic() that the emergency category requires? Then implement it. We currently have about 80 console drivers. But what if can't be implemented? vt console, for example? Yes, the vt console would be tricky. It doesn't even support the current bust_spinlocks/oops_in_progress. But since the emergency category has a clear requirement (reliability), it means that a vt write_atomic() does not need to be concerned with system disturbance. That could help to find an implementation that will work, even for vt. > We may wave those semi-important messages good bye, I'm afraid, > preemptible printk will take care of it. You are talking about a system that is overloaded with messages to print to the console. The current printk implementation will do a better job of getting the informational messages out, but at an enormous cost to all the tasks on the system (including the realtime tasks). I am proposing a printk implementation where the tasks are not affected by console printing floods. When the CPU is allowed to dedicate itself to tasks, this obviously reduces the CPU available for console printing, and thus more messages will be lost. It is a choice to clarify printk's role (non-disturbance) and at the same time guarantee more determinism for the kernel and its tasks. As I've said, the messages of the informational category are also important. There are things that can be done to help get these messages out. For example: - Creating printk-kthreads per console (and thus per-console locks) so that printk-buffer readers are not slowing each other down. - Having printk-threads use priority-buckets based on loglevels so that (like the rt scheduler) more important messages are printed first. - Assigning the printk-kthread of more important consoles an appropriate realtime priority. > So... do we have a case here? Do we really need printk-kthread? Obviously I answer yes to that. I want messages of the information category to cause no disturbance to the system. Give the kernel the freedom to communicate to users without destroying its own performance. This can only be achieved if the messages are printed from a _fully_ preemptible context. And I want messages of the emergency category to be as reliable as possible, regardless of the costs to the system. Give the kernel a clear mechanism to _reliably_ communicate critical information. Such messages should never appear on a correctly functioning system. And again, both of the above have nothing to do with message suppression. Here I am addressing the console printing issues: reliability and disturbance. John Ogness