Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp2097779ybf; Mon, 2 Mar 2020 01:51:01 -0800 (PST) X-Google-Smtp-Source: APXvYqy4R4uA+v4rPTrKhvjdQo3+tWR+TR4CYPor8jYdnlv6CGu0E92qxuv9lLNA/HyduvCD0yvj X-Received: by 2002:a9d:5e8b:: with SMTP id f11mr12870681otl.110.1583142661053; Mon, 02 Mar 2020 01:51:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583142661; cv=none; d=google.com; s=arc-20160816; b=da75iQE5PjOsO8HUSUrOfLd9dDXHCcRFA8ZMmtcnmnSBbedMNyYHQob1EPVRO0jSD1 A3PedZLqcyoyCUMEaoGCx1ffJoSBoB4TXqMpOH3V5SYuHvMCS0dckT3tPIft2/PUHT+Y AJoqI6vvkK8d19BI8Lq9/3rR5qfVkjowGgzKO6u54maubKpkQaWNw79JqqipN0qSYGVp CmiJDl3+BZTZz+gqa0jvjvWRtXkDb2TsuipYTDa0pd/dk/zJft/KmO5P5X+9WHRFANLd 4v2CW6qW8oI/MNT6OXYDQYJusna+UOAcjvp3SqhrZWNdVUDypJiNgG1nF36GlsBo2i3y 4KFQ== 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=to+5ybcXBCNkrnCGf9bYvnn+UiERQDagjsh7QJ7gp6g=; b=UU7T3e7nfbjEJdRPtOwBqJ48QBRKe1Or3UyUZx3A9J+L5medAZhcqyGedjyxSmXeUZ GsFVCctFYXMUAHoo9CSTLOP1T0hBnRY0EsYu88jPwr4Za2Q6f+KmztuLwlaXBrTMOpzq coZc8HB1ZqHki9Grvo05/MEvVDdgM84WIEBPzEqRHfHTFh6fjPtzohv0onSinAc9PUaV bDr8ZRA+wQCcV7grQrIxeqCCGljiJSaYlfoi6x4N9qRg3QkagqgNLsuiqqOf58dSx2V0 Wv+eEQ2WwrT5OAjcN99bDKZEWTofOdyd4BKu4GF/yojmj4PnB/GFifa9M569yCrEzdPz 6M1w== 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 z24si6020798otm.135.2020.03.02.01.50.48; Mon, 02 Mar 2020 01:51:01 -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 S1727534AbgCBJtM (ORCPT + 99 others); Mon, 2 Mar 2020 04:49:12 -0500 Received: from mx2.suse.de ([195.135.220.15]:45102 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726956AbgCBJtL (ORCPT ); Mon, 2 Mar 2020 04:49:11 -0500 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 BB16CB0B6; Mon, 2 Mar 2020 09:49:08 +0000 (UTC) Date: Mon, 2 Mar 2020 10:49:07 +0100 From: Petr Mladek To: Sergey Senozhatsky Cc: Steven Rostedt , "Theodore Y. Ts'o" , Greg Kroah-Hartman , Lech Perczak , "linux-kernel@vger.kernel.org" , Arnd Bergmann , Krzysztof =?utf-8?Q?Drobi=C5=84ski?= , Pawel Lenkow , John Ogness , Tejun Heo , Peter Zijlstra Subject: Re: Regression in v4.19.106 breaking waking up of readers of /proc/kmsg and /dev/kmsg Message-ID: <20200302094907.qdbhe6iobegah56t@pathway.suse.cz> References: <20200228031306.GO122464@google.com> <20200228100416.6bwathdtopwat5wy@pathway.suse.cz> <20200228105836.GA2913504@kroah.com> <20200228113214.kew4xi5tkbo7bpou@pathway.suse.cz> <20200228130217.rj6qge2en26bdp7b@pathway.suse.cz> <20200228205334.GF101220@mit.edu> <20200229033253.GA212847@google.com> <20200229184719.714dee74@oasis.local.home> <20200301052219.GA83612@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200301052219.GA83612@google.com> User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun 2020-03-01 14:22:19, Sergey Senozhatsky wrote: > On (20/02/29 18:47), Steven Rostedt wrote: > [..] > > > > What do folks think? > > > > > > Well, my 5 cents, there is nothing that prevents "too-early" > > > printk_deferred() calls in the future. From that POV I'd probably > > > prefer to "forbid" printk_deffered() to touch per-CPU deferred > > > machinery until it's not "too early" anymore. Similar to what we > > > do in printk_safe::queue_flush_work(). > > > > I agree that printk_deferred() should handle being called too early. > > But the issue is with per_cpu variables correct? Not the irq_work? > > Correct. printk_deferred() and printk_safe()/printk_nmi() irq_works > are per-CPU. We use "a special" flag in printk_safe()/printk_nmi() to > tell if it's too early to modify per-CPU irq_work or not. > > I believe that we need to use that flag for all printk-safe/nmi > per-CPU data, including buffers, not only for irq_work. Just in > case if printk_safe or printk_nmi, somehow, are being called too > early. > > > We could add a flag in init/main.c after setup_per_cpu_areas() and then > > just have printk_deferred() act like a normal printk(). At that point, > > there shouldn't be an issue in calling printk() directly, is there? > > Sure, this will work. I believe we introduced a "work around" approach > in printk-safe because noone would ACK a global init/main.c flag for > printk(). If we can land a "per_cpu_areas_ready" flag (I've some doubts > here), then yes (!), let's use it and let's remove printk-safe workaround. A compromise might be to set a flag in setup_log_buf(). It is called much earlier but it seems to be safe enough. mm_init() is called close after setup_log_buf(). And it seems to be using per-cpu variables when creating caches, see: + mm_init() + kmem_cache_init() + create_boot_cache() + __kmem_cache_create() + setup_cpu_cache() It is just a detail. But I would make the flag independent on the existing printk_safe stuff. printk_safe will get removed with the lockless printk buffer. While the irq_work() will still be needed for the wakeup functions. Sergey, do you agree and want to update your patch accordingly? Best Regards, Petr