Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp2218994imb; Sun, 3 Mar 2019 22:41:11 -0800 (PST) X-Google-Smtp-Source: AHgI3IYIP4O+VPMxj05e4y4LPxKKiuDUUHZdH5ZJGRD0ObUiGc3C4KTo4GrN0sCKurmwlpYUE8Og X-Received: by 2002:aa7:8299:: with SMTP id s25mr18624308pfm.56.1551681671657; Sun, 03 Mar 2019 22:41:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551681671; cv=none; d=google.com; s=arc-20160816; b=UXzMbtj+jtkvS0o2uwu7K+l9GvKm8CX/WXx3yMIqeeWBAqVquq9gYfVug5nweC+EFW DOoK8uWR/Xbl6lmKFSt7VgRMT+cAtmRWAyyxGLVJeze5dtpBPH+yICZF+bNXoModfQYZ R0dia8OBeyg86lZXnLtdIHZU7voC1SFHR/kovjNk6LOL9ihqQJbNLEn2YZtvTg2A+mWZ q9ndFzan2VSlCcqRQJmbKOtIsbWlnUFoemgMqmaHNW1V1ZDl0HE2UNx9OLzrVmD9ioYi yes44LVEleC+aBdKD14vaUZieuAzo2GAlubGh2G2JoAybwS4wINRSWjTjLhEQ3+ZWqyH bfZQ== 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=uq1bGwpHAh1MRIMEpTw9BZatcsUSAFnua0mccOXG7mQ=; b=zVH52QR71q9auXn9+Rk0zYMvvqT8VlgG0rMLDRovvXz1gg5C4kyhgWZRNyfKT/rbti J124A7Pk40fB3hG2ookWTY/Rasa47iUqK23hgLcRHrH8R04KLPqpjFeD6wI+t/+AHTsH g3oU644v2XOU//9a2u89K6arMG8CmOp6wRjhHqInsCm6mObHl+rfZUQkGyFFThA2obLO GlfcKRprmmsWYOYssCAFwBUSFUHLy8qxrDdITZlo9oRCnvEcVcRMj84YsgRd7QGR5eS9 L3eAj5LeYKgJc/ObILr2qElBM1AI6x1d3ssF1bC+x8rdfLeRI3lA/TGsVjPElSQ4MRHC qk0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vbVeXM+e; 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 r203si4497906pgr.517.2019.03.03.22.40.56; Sun, 03 Mar 2019 22:41:11 -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=vbVeXM+e; 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 S1726101AbfCDGkB (ORCPT + 99 others); Mon, 4 Mar 2019 01:40:01 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:39980 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725981AbfCDGkB (ORCPT ); Mon, 4 Mar 2019 01:40:01 -0500 Received: by mail-pf1-f194.google.com with SMTP id h1so2261179pfo.7; Sun, 03 Mar 2019 22:40:00 -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=uq1bGwpHAh1MRIMEpTw9BZatcsUSAFnua0mccOXG7mQ=; b=vbVeXM+exN1MW+hyH4w2O1Vq+FLSspw91SUMd35iSmmbZw352mg0tQj8CHgkmZzHx7 Z36Y7H5+j4qBgXsWhZSGNPfVpS28PwS/D8afvaDLSLyDEHXBe81EgbVes19zjYIJfCEP 79LoJO6VLe+lWGZtq6xlHymG9kcujF8Vn3/7LHV38z1JPgAbrjaNxG+hAqfcobpN0dl0 fvEp8wFr9mQ9HFFeSedqm2eLmixV4G1l+Z4a3QYYEyfFiPTQBpOJ69DwuDsANmfc4zFr bZlMAVoory+vrTaY6ZupAZ0frxT0JZ5uTyUD5NqMSwRJfAVXBp1aQ3pKaH1vogeUzkqv HtHw== 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=uq1bGwpHAh1MRIMEpTw9BZatcsUSAFnua0mccOXG7mQ=; b=PqySzUp5umP2bsa1Be07qR8BLjBwV4VZCxtvcZNCc7yrVTrVD4uDZWMt+wYOOqZ41a u692AadHGW8877NSP3oSx8JxGd32d4w9rCGyRPCfURrkQI2FPAC9rP7qXUweNgsvD+xa jSi8n/wRhIp6EBhHWvvEa745bpH0ZEl9NYidI1npGY0uUt4hpOauZPUch2pYyJ2mr/tg ON7KT047mEycYq7wLvRWMOqiVklmmC95uLpY2TCqa78Ftf6LujgAGPbS5b6/XkfSRIKV +I8Tu+XAYYBqsENeKxRL1DfetnPVnE9iTIehwwDZXADd4eOqv7MFENXk2vDckgsKhs/x fdOw== X-Gm-Message-State: APjAAAUBC7wZMkAjn/Iu/ht65fjy6+38mYvNIWICXvVNqBu2ufXO6rlp wiFpOWmgWXVkbFgJ94lkPUY= X-Received: by 2002:a17:902:33c2:: with SMTP id b60mr18852636plc.211.1551681600373; Sun, 03 Mar 2019 22:40:00 -0800 (PST) Received: from localhost ([175.223.38.45]) by smtp.gmail.com with ESMTPSA id q7sm9808825pfa.119.2019.03.03.22.39.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 03 Mar 2019 22:39:59 -0800 (PST) Date: Mon, 4 Mar 2019 15:39:56 +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 00/25] printk: new implementation Message-ID: <20190304063956.GC6648@jagdpanzerIV> References: <20190212143003.48446-1-john.ogness@linutronix.de> <20190213013101.GA8097@jagdpanzerIV> <87d0nv248b.fsf@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87d0nv248b.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 Hi John, On (02/13/19 14:43), John Ogness wrote: > Hi Sergey, > > I am glad to see that you are getting involved here. Your previous > talks, work, and discussions were a large part of my research when > preparing for this work. YAYY! Thanks! That's a pretty massive research and a patch set! [..] > If we are talking about an SMP system where logbuf_lock is locked, the > call chain is actually: > > panic() > crash_smp_send_stop() > ... wait for "num_online_cpus() == 1" ... > printk_safe_flush_on_panic(); > console_flush_on_panic(); > > Is it guaranteed that the kernel will successfully stop the other CPUs > so that it can print to the console? Right. By the way, this reminds that I sort of wanted to send a patch which would unconditionally raw_spin_lock_init(&logbuf_lock) (without the num_online_cpus() check) in printk_safe_flush_on_panic(). > And then there is console_flush_on_panic(), which will ignore locks and > write to the consoles, expecting them to check "oops_in_progress" and > ignore their own internal locks. > > Is it guaranteed that locks can just be ignored and backtraces will be > seen and legible to the user? That's a tricky question. In the same way we may have no guarantees that all consoles can sport ->atomic() write API. And then have no guarantees that every system will have ->atomic consoles. > > Do you see large latencies because of logbuf spinlock? > [..] > > For slow consoles, this can cause large latencies for some misfortunate > tasks. Yes, makes sense. > > One thing that I have learned is that preemptible printk does not work > > as expected; it wants to be 'atomic' and just stay busy as long as it > > can. > > We tried preemptible printk at Samsung and the result was just bad: > > preempted printk kthread + slow serial console = lots of lost > > messages > > As long as all critical messages are print directly and immediately to > an emergency console, why is it is problem if the informational messages > to consoles are sometimes delayed or lost? And if those informational > messages _are_ so important, there are things the user can do. For > example, create a realtime userspace task to read /dev/kmsg. > > > We also had preemptile printk in the upstream kernel and reverted the > > patch (see fd5f7cde1b85d4c8e09); same reasons - we had reports that > > preemptible printk could "stall" for minutes. > > But in this case the preemptible task was used for printing critical > tasks as well. Then the stall really is a problem. I am proposing to > rely on emergency consoles for critical messages. By changing printk to > support 2 different channels (emergency and non-emergency), we can focus > on making each of those channels optimal. Right. Assuming that we always have at least one ->atomic channel we can prioritize (and sacrifice !atomic channels, etc.). People, sort of, already can prioritize some channels; IIRC, netcon can be configured to print messages only when oops_in_progress and to drop messages otherwise. Things can get different if ->atomic channel is not available. -ss