Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp2249045imb; Sun, 3 Mar 2019 23:39:43 -0800 (PST) X-Google-Smtp-Source: APXvYqyGOuXID0CuyS19IbHuVVeYxzuJYE09Wqi09a3hQWAWQ3bknJxYzyoteTunvgAM3toiypaw X-Received: by 2002:a17:902:2aa8:: with SMTP id j37mr18323482plb.226.1551685183092; Sun, 03 Mar 2019 23:39:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551685183; cv=none; d=google.com; s=arc-20160816; b=soDto0mb0pBALrRgZ6+8xVJVpeMEA0W0cArlSG/xFJVyYDKMpCkiihUqrS8cGSJs4D rSTqqBv4DEGwM1QM2XpNAuRgc4+VMtZu+xgBk8AEg9HB7UPVIyGWMI+oLKUAzcqHIEeo RHKpatOMyyMW1xZuqhyy4+PHuqR8QUcjCi6lylBL3+TkIQ6DetMRgIgM72y5FNm3g/qT zJOCymcshQt1y0pweiCQ1WHY1EFu4YPClu/ymNtIkcZSp8ipPs+jMV6hfT//n5AX/qIb uGYd3yDzOhMbPz49BKVNAnk98M72GiS9txoimVkBdd4IWfmtKa0BoSGQoBGG0QzFX3Zr ou9w== 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=ImeATGrc/HA5GiNT/68WVUj+Vhz5vM8oxHAmuWTiKWE=; b=bEqC2SrHp5/aGNLR1dY794xvlpg2Cc3BvM5zl+pyqMkbOIYgPyf+1qh6KDde4S78VG aLt3Cm6KXyrqYVG96+mfvTYl3jOeR00aD8bSrLVN52cHfCIVveMN/0I45vm6KdO49q4+ TIUKICFvzLHSEInGJOlcJb7gOgus23At6zzJ+J9NiCv0Mkb/L/4eh4kaL8g9mjtEOAQ6 5qUlZy+VALLITaoub4UdMzvngx9U3gLR7whm0WDUZjxQm88wohn395d5wrfOpYqK8895 w3CeWAV488b4WljZid54/aECzyXveWSMyyiszscLo0Ez5X+FlzyRqQqh0/Mb32GtvWfq pNqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=sg+XsU1e; 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 a2si4679361pga.476.2019.03.03.23.39.28; Sun, 03 Mar 2019 23:39:43 -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=sg+XsU1e; 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 S1726138AbfCDHjC (ORCPT + 99 others); Mon, 4 Mar 2019 02:39:02 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:43770 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725550AbfCDHjB (ORCPT ); Mon, 4 Mar 2019 02:39:01 -0500 Received: by mail-pg1-f195.google.com with SMTP id l11so2451985pgq.10; Sun, 03 Mar 2019 23:39:01 -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=ImeATGrc/HA5GiNT/68WVUj+Vhz5vM8oxHAmuWTiKWE=; b=sg+XsU1e0BP/Rdj+C5onxPQm93nzcRrL8r1AxSExaoXMosx8IMQEe7uGk6BqwDX4AV 8HLVyhW3hc44uBz7XpVut8lb0kxLW4dZyWHNdMZ5mE591DhMBYgaBCdtf0pCdYXoWVhf 0T/r4bY9nNvCvVf0ZFR1XwzUVDxmUNWQkvCbYoSlWb5aRulimH9WZlYE1OX9sstl//Lj JPlDjtxDC57edOfikj9mrwq+3gDHNRO0rnWF/IqydFwwLTSXOPc8TER99mCanxNeJkTs N4nj86jUgrRZ4cYL0UmU2cBZfq3asCemhqoSpya9/mDJ74xeUCB6yLcEOMpGs1h6O4ag LkhA== 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=ImeATGrc/HA5GiNT/68WVUj+Vhz5vM8oxHAmuWTiKWE=; b=ibxFk5Xla/3boS2n4QElbQCLMeCyYm6pGRvT1ntKQXUUIki0Bjk2gkG+nVuqRFv41X N5C0pgablvwP4cuTRZr/CsSDcsJpsCrj9xk1bfZ4krtmuSJ+w0DbqaEDozLKrBVkDJaq lt17HgZ4Dsf5B1RvevrcW6hse/ARQfJOCQM4w6jBlDtIzLKPnVxu4jemJl8Mw2dEVKp6 rnNZmoKJE1B39LiZZq+DFeYld04v9dROh1RY3hzZOeJZPkp1jAnK5hlW47jqolC8aExg V71m0ffQX5dAXhs9onHZSxUVhr8NMaZ+p6G+kfA+gozcLtXCblaRBaClyRObOvz0k40p a2GQ== X-Gm-Message-State: APjAAAX0tUvD8Cgqx3CK2QeK6Qmlg7+3x7G2Mi4h+uzNeulR4KAcgoNs JWAHwAFesbKJPxTn7w/sXG898nEw X-Received: by 2002:a65:4384:: with SMTP id m4mr17161079pgp.375.1551685140931; Sun, 03 Mar 2019 23:39:00 -0800 (PST) Received: from localhost ([175.223.38.45]) by smtp.gmail.com with ESMTPSA id t4sm2953574pfh.117.2019.03.03.23.38.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 03 Mar 2019 23:38:59 -0800 (PST) Date: Mon, 4 Mar 2019 16:38:56 +0900 From: Sergey Senozhatsky To: John Ogness Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Petr Mladek , Sergey Senozhatsky , 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: <20190304073856.GA552@jagdpanzerIV> References: <20190212143003.48446-1-john.ogness@linutronix.de> <20190212143003.48446-9-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190212143003.48446-9-john.ogness@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 (02/12/19 15:29), John Ogness 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. It's one thing to do cond_resched() (or to let preemption to take over) after call_console_drivers() (when we are done printing a message to all console drivers) and another thing to let preemption to take over while we are printing a messages to the consoles. It probably would make sense to disable preemption around call_console_drivers(). -ss