Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp5493090imb; Thu, 7 Mar 2019 17:32:18 -0800 (PST) X-Google-Smtp-Source: APXvYqx4Uk2x0P382e0LH9srWrDaIwn170X1J7jCyZKc1Ql+RnEd88N1KD1BztDzWR8DIUaoCUN3 X-Received: by 2002:a63:1625:: with SMTP id w37mr14135787pgl.13.1552008738722; Thu, 07 Mar 2019 17:32:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552008738; cv=none; d=google.com; s=arc-20160816; b=JtTXlqymR/LQjRF6U3BVtWp/vofyq1iG8/uDRgNgfgtXOtzZDm/Ar+mXIjEobXk7Sb p6NHWldIINqO2C2uHvP/2SqMZtOe8ryKTg8Fz8bUmkJnsNCupAT1e9l5NbJRk0Mh1ZdC cbkHslmZElvsgbyVXkdzRBBzGkUUIGoxqAWqmGJCfqY4WRn/+6dB7zUeJOfpGnMpHul2 Oi58lfxhXDwvR+lNLoqafEA1NMT/kZOi/Wht1Tx/wMpWBcv6wTgKrJgfhIeOmUdyko79 mSsjagOkd5T5OZFVZuGR8YuaxZnqwyHbn0lUqbZQ5P7/dLuWIQ29N7wO836+Tq9EmcGE rjsg== 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:dkim-signature; bh=2iv8wo/lp5LJ5Zsdyp9yEMO45Sw/Axr36FzK7/FsLqs=; b=NfA3YyHVHyty/3qlhMfswCSLLJIwoizApsUlhSka4XUs/DU3h6FS00IyChPdUU2UZA zZfbPuQ+SZwH/e48DwhBcE/2U/J8X7Muubx078bTEBsYkgihaY6ziu3DbENvkiCm2vid 1duGbkMFEJe9nvZF0v+Uf09p9tPf8xMt8IKVZb4nxnVnlU2iTaWGf48hvxCBicnscdu1 /xCGlVcNd0225w5S/cTL55nYQj8d2KCXaYqZPWM/cXayWbkqYomDlWl6Zg3QHL33xO48 DUrl5lQHXnhIjTCgJuDrSvqBz9JTER8pbeONraIRrQaWk0/kSQ5q8BFnIQbTVbtBVL/u ERtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fenz2Prg; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g5si5133546pgc.122.2019.03.07.17.32.00; Thu, 07 Mar 2019 17:32:18 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fenz2Prg; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726270AbfCHBbk (ORCPT + 99 others); Thu, 7 Mar 2019 20:31:40 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:36227 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726242AbfCHBbj (ORCPT ); Thu, 7 Mar 2019 20:31:39 -0500 Received: by mail-pf1-f195.google.com with SMTP id n22so12863507pfa.3; Thu, 07 Mar 2019 17:31:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=2iv8wo/lp5LJ5Zsdyp9yEMO45Sw/Axr36FzK7/FsLqs=; b=fenz2PrgXfUZF+sjvWv3l6FpEpl45KOCgKOudy+lassB9q8pTei5bOtsy8ajGf+Agj RUeE66dUEVU0Kon6tMu6shAst8Qhm+PzoON0BcdJOCUbBlM1JlCL/JotmbxUyFXNe5QF /d7gd2dZR6+VbUePv2xM1fDo5M2jq91EbwytD22+7X45eFkEr6/m7XoMH82B5aswFxcK HnwY+TlMTN/GIwiti52DTLf0u71F8RC4VashvKqmogV1pFqpqk8vUDZZ2S5hvhQpPcod lw9PDxrBdvGdKIEuNLS+kzHUTSTA9KouodH+ZD1dwbnrKEVo5dHZBcFml6J9UNea3kKJ XWIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=2iv8wo/lp5LJ5Zsdyp9yEMO45Sw/Axr36FzK7/FsLqs=; b=VjtsoceE+/ScOx3TaCIQ9s7JNRww5eNyUDVCptgxKAzSy0joo5JE65t1fZ3znrx4pS bKBgrGqdkQ7lijt4EAnp79G3wcAtWP9iqTSEMdKZc0hNiADhXPOVXzx8Tg81lQZRGy5C tXog9VDGKlNcQ0noWNe/AHsKvdB3BQZ+r3elPEIxWqvNKIDuji3EvFdIJ2shiwYVCQyP WjvQING01zPl+zNDL1Exiue6WMnDTbGaOAFz7rl5xqrECXKjKO/wGTsN0/w7nF2y3icu OdM6pAdR9pnNjdu3JLWut+rLfF+Oc+UIDY7WdezWRaNlos/u2YowdhKzVvuVIM4izMf+ Jvew== X-Gm-Message-State: APjAAAUMcuPnLjXeXrkJsRRWYCl0VeNfMAgePN1lma1MuWHUT8qZ6EMd a5uxR94f7R/iTlCR13UNNnw= X-Received: by 2002:a63:4d4f:: with SMTP id n15mr14284750pgl.327.1552008698671; Thu, 07 Mar 2019 17:31:38 -0800 (PST) Received: from localhost ([175.223.36.163]) by smtp.gmail.com with ESMTPSA id u11sm7919113pfh.23.2019.03.07.17.31.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 07 Mar 2019 17:31:37 -0800 (PST) Date: Fri, 8 Mar 2019 10:31:34 +0900 From: Sergey Senozhatsky To: John Ogness Cc: Sergey Senozhatsky , 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 Message-ID: <20190308013134.GB4063@jagdpanzerIV> References: <20190212143003.48446-1-john.ogness@linutronix.de> <20190212143003.48446-9-john.ogness@linutronix.de> <20190304073856.GA552@jagdpanzerIV> <87va0uopmd.fsf@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87va0uopmd.fsf@linutronix.de> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (03/07/19 13:06), John Ogness wrote: > On 2019-03-04, Sergey Senozhatsky wrote: > >> + /* the printk kthread never exits */ > >> + for (;;) { > >> + ret = prb_iter_wait_next(&iter, buf, > >> + PRINTK_RECORD_MAX, &master_seq); > >> + if (ret == -ERESTARTSYS) { > >> + continue; > >> + } else if (ret < 0) { > >> + /* iterator invalid, start over */ > >> + prb_iter_init(&iter, &printk_rb, NULL); > >> + continue; > >> + } > >> + > >> + msg = (struct printk_log *)buf; > >> + format_text(msg, master_seq, ext_text, &ext_len, text, > >> + &len, printk_time); > >> + > >> + console_lock(); > >> + if (len > 0 || ext_len > 0) { > >> + call_console_drivers(ext_text, ext_len, text, len); > >> + boot_delay_msec(msg->level); > >> + printk_delay(); > >> + } > >> + console_unlock(); > >> + } > > > > This, theoretically, creates a whole new world of possibilities for > > console drivers. Now they can do GFP_KERNEL allocations and stall > > printk_kthread during OOM; or they can explicitly reschedule from > > ->write() callback (via console_conditional_schedule()) because > > console_lock() sets console_may_schedule. > > This was the intention. This can stall the entire printing pipeline OOM -> printk_kthread() -> console_lock() -> con_foo() -> kmalloc(GFP_KERNEL) -> OOM > Although, as I mentioned in a previous response[0], perhaps we should > not loosen the requirements on write(). Right. Console drivers better stay restricted; very restricted. > It is exactly that disable_preempt() that is so harmful for realtime tasks. I'll reply in another email (later today, or tomorrow). -ss