Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2660667pxb; Tue, 13 Apr 2021 07:16:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznRpa3aWUAH8lsNWEpww68bwQqdCZNePeRkE44VcKkYA54bK5ArezxlxzSfkg+LIp1vN+l X-Received: by 2002:a05:6402:6c1:: with SMTP id n1mr34786445edy.158.1618323398293; Tue, 13 Apr 2021 07:16:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618323398; cv=none; d=google.com; s=arc-20160816; b=Vmf0RKQ1uBo5fHZYlqLt9KSf2Fgx6zC73WVnNKys3CimhoO1jzxbf84cWwQ93n8cxP DpRW8wxtJ9BZd/UsqlQ1DlxZV/lrm0DFT8QIVFb6OkkVF23VKBuamlXrfe1DGZL/5O9b Psn18Pui/SExUuaVGWKCKrr0oWEv2inshli83Fl3mhzRcYg8xsBrybdDmmYPyyiV5MDs z2fv7fxoS78hTjHEaeaexkpi+9BWTNVNkZr4qRpzn28hODvvnbH3NRcBsEv96sr2M90q kZ82eYt/51enrMYxZs5O4rH07bSpL142SG0pH9LxYLelPKZntVZYFrM5+QHLV+mb4ycX uKLQ== 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=ZbiWEY1ZGa88fflkVy9Zsq5S0LAQAGZzATGFIfnvo24=; b=Lrv+8VrLj1x4t2mVNJ39SsRvTmNAZtKjLaRrMAtbJoSgy8aBvB6mrKbAJmgUuJ8SmW FVEoFAW2r0pCPjkacn+s9n+Gq7udQWs+nnT63gjPoI6bpUv4XQbOYS1FWIMabIM9LBe2 CPC2Ezgc8MqtfBtIjYLIkZLbqFHd+rWhw2yETWWpcyAoO7dok2fFV7MhjRgl0SphqGlF clC3msH5qzVjftRAmuH00Fnn/KExmO218uaORDjTf4MM2W1JNjby2SJfhQKe4ooLCwEL 65erz8CUY5kFW455SQTiVfUbGV5od5OM//Nsb8yn9PSjGGkUdWubafNQVeD0ZbIHRXYq /aZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=r01TZ0Gy; 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 m23si4246167eds.334.2021.04.13.07.16.10; Tue, 13 Apr 2021 07:16:38 -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=r01TZ0Gy; 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 S230053AbhDMJlm (ORCPT + 99 others); Tue, 13 Apr 2021 05:41:42 -0400 Received: from mx2.suse.de ([195.135.220.15]:37882 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229805AbhDMJlm (ORCPT ); Tue, 13 Apr 2021 05:41:42 -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=1618306882; 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=ZbiWEY1ZGa88fflkVy9Zsq5S0LAQAGZzATGFIfnvo24=; b=r01TZ0Gyikr6o0kpHPaxvRi7/n4JWcOw4PzjCrp0O65q9AtvYJaYcaN0TVyDZ/GKzRV3H1 knnOWELXJ7/7G42jVdXZmWabufuoNUAnjulGNfIGHQK8yIH4AeLAoLyZgPSAjI39fvoXk1 c7gwGpf9p5jnZmCeCIdTaSzWTiVWy2E= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 530B3B130; Tue, 13 Apr 2021 09:41:22 +0000 (UTC) Date: Tue, 13 Apr 2021 11:41:21 +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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. systemd is able to flood the kernel buffer and consoles. It can be protected by ratelimiting, see the commit 750afe7babd117daabebf ("printk: add kernel parameter to control writes to /dev/kmsg"). /dev/kmsg ratelimit is a "must-to-have". systemd enables debug messages using the same "debug" parameter passed on the kernel commandline. The ratelimit allows to see the kernel messages. Note that the ratelimit is enabled by default by kernel. But it it disabled by default by systemd. So, it is effectively disabled by default. It might be possible to add retalimiting also for /dev/ttyprintk. But does it make sense just because of an artifical test case? History: /dev/ttyprintk has been added in v2.6.37 (2010) by commit 24b4b67d17c308aaa956b ("add ttyprintk driver") /dev/kmsg has been add in v3.5-rc1 (2012) by commit e11fea92e13fb91c50ba ("kmsg: export printk records to the /dev/kmsg interface") Another solution might be to obsolete /dev/ttyprintk by /dev/kmsg. We have to preserve /dev/kmsg because of systemd. Is anyone really using /dev/ttyprintk these days? Best Regards, Petr