Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2918818pxb; Tue, 13 Apr 2021 13:39:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNg4XnM1Az8zeIqm+IQIGjjFH/iFrHk83Wb849JBxz3IKQLOazYRJzwJTFhtb6Po9uoN+G X-Received: by 2002:a05:6402:31b2:: with SMTP id dj18mr36138333edb.104.1618346366724; Tue, 13 Apr 2021 13:39:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618346366; cv=none; d=google.com; s=arc-20160816; b=Lrcw85bP54287DnEFJ4C8HDDaXjYRWqNxCwROvIU9SF5vDBLLc1PQpWU1P9Pc4gmHf JWferKYPvSDWeQWNUDmEF01mnW7ELIthSRNcq0J7iJRRysLM2dCMwbQt54+rvTImCLNm vSsNWZVqxM+NBV7Pja+gWF7CH4rBNsOKU6SUDmh/+lVU2UayI0a6FscTu/oaJ6CaGkWg 8pUm59JzpjvWjrfKoyC/G8mCF4HF6zYsm+E63rlSB7i7eRLJI4h1Vuzw6U8kfDQJ7ixH ughVxD7qb8+VnJSvWFTod9FEm5QzQa6UtZi9/kOXz3rkM8jctFP+m8nzKZyraNquWrsq gwjQ== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=WN+chzoRhx9YhbEJwfA7+Qxjm6vfmCFdYwwtbYAncX0=; b=CFTHJfoeefQCpFcDni2iV0YJvpOh9b/e6govoHCdTDSgULCr2lxwtq8FUgy0aRxHv6 Tzl7qs32NlC3kCObVEaLRew7k0jAqDLpgqaeDUId+6rjO+Q6kh/I573M0jg3rxCSU+Zg Bce/uoLlPYPjPsGXZEKx4Iymuf1Whsg90odFG3j2ffJxyZq/38AOuwU/WJm79kITAyYp WcUFyuj54oYYmk835Bxt+X52u2JcU0BTr1U1wvKppsLbH1J8ILjQJ71n7wCW22pN8dbX W6YmeA1fOYhbeFpQcRU9rofOerdjcIy3dtXlnagLySOXCNNqbQjTaWQriopQHWeku2Tu 7nCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b="Y/IyRnWJ"; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 13si10537598ejh.174.2021.04.13.13.39.03; Tue, 13 Apr 2021 13:39:26 -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; dkim=pass header.i=@suse.com header.s=susede1 header.b="Y/IyRnWJ"; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343803AbhDMOdo (ORCPT + 99 others); Tue, 13 Apr 2021 10:33:44 -0400 Received: from mx2.suse.de ([195.135.220.15]:51752 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239007AbhDMOdT (ORCPT ); Tue, 13 Apr 2021 10:33:19 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1618324379; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WN+chzoRhx9YhbEJwfA7+Qxjm6vfmCFdYwwtbYAncX0=; b=Y/IyRnWJNFWglv6B1coiN+9RKwDBHdcbD5spi0zrqo40qgBe7LjCuZZ5HsKrupUDVAlFux VnrTGmuFYxV49Gw0gUkCdi+6FkmQyby0SmWAZPhGUdeEHjgiqNSrHCT6mjCX3AcwgLKF7O d4d3JlfWSiNPm+GRemWseMEjcBbMN/k= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id F1916B229; Tue, 13 Apr 2021 14:32:58 +0000 (UTC) Date: Tue, 13 Apr 2021 16:32:58 +0200 From: Petr Mladek To: Samo =?utf-8?B?UG9nYcSNbmlr?= Cc: Tetsuo Handa , Jiri Slaby , Sergey Senozhatsky , Steven Rostedt , John Ogness , linux-kernel@vger.kernel.org, Greg Kroah-Hartman Subject: Re: How to handle concurrent access to /dev/ttyprintk ? Message-ID: References: <20210403041444.4081-1-penguin-kernel@I-love.SAKURA.ne.jp> <3c15d32f-c568-7f6f-fa7e-af4deb9b49f9@i-love.sakura.ne.jp> <051b550c-1cdd-6503-d2b7-0877bf0578fc@i-love.sakura.ne.jp> <157d81a5eb9e56e47e40c1cd652cdc7a915cb755.camel@t-2.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <157d81a5eb9e56e47e40c1cd652cdc7a915cb755.camel@t-2.net> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 2021-04-13 13:10:50, Samo Pogačnik wrote: > Dne 13.04.2021 (tor) ob 11:41 +0200 je Petr Mladek napisal(a): > > On Mon 2021-04-12 14:41:27, Samo Pogačnik wrote: > > > Dne 12.04.2021 (pon) ob 19:39 +0900 je Tetsuo Handa napisal(a): > > > > What is the intended usage of /dev/ttyprintk ? > > > > > > > > > > The intended use of 'ttyprintk' is to redirect console to /dev/ttyprintk > > > via the TIOCCONS ioctl. After successfull redirection, all console > > > messages get "merged" with kernel messages and as such automatically > > > processed > > > (stored/transferred) by the syslog service for example. > > > > The same can be achieved by /dev/kmsg that was created by systemd > > developers. > > > 'kmsg' and 'ttyprintk' are different types of drivers and as such rather > complementary than exclusive. The 'ttyprintk' being a tty driver allows > for a system wide automatic redirection of anything written to the > console. I might miss something. But how can one setup ttyprintk as the system wide console? I do not see any code that would use ttyprintk in struct console. Or am I too focused on the printk/kernel-side of view? > On the other hand 'kmsg' is probably better suited for a per process > output redirection/injection of its output into kernel messages. > Maybe i am wrong, but 'systemd' could also find 'ttyprintk' usefull? /dev/kmsg allows both read and write from/to the kernel log buffer. The write callback allows to pass a certain loglevel from the user space in the format "message" The read callback passes a lot of meta information in the format ",,,[,additional_values, ... ];\n" IMHO, /dev/kmsg provides a super set of functionality over /dev/ttyprintk. But I am not familiar with the tty layer and all its use-cases. To make it clear. I do not resist on removing ttyprintk by any means. It was just an idea. I am not even sure if it is possible to obsolete tty drivers. Best Regards, Petr