Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp216092imj; Wed, 13 Feb 2019 07:12:34 -0800 (PST) X-Google-Smtp-Source: AHgI3IZE/roH8yr/lj+nsuKqfULQ3xrVWbivaHg/FUJNAgaQPGhpyQ70P1J9DM0faFDpLAUAFU3i X-Received: by 2002:aa7:8497:: with SMTP id u23mr940742pfn.253.1550070754583; Wed, 13 Feb 2019 07:12:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550070754; cv=none; d=google.com; s=arc-20160816; b=sS+BhtN0bnP5dtpvyrk2flVpxitSC2dZYDDEAsp2FiEgHT701+/tD4d+8MMC5VdAf8 3yhBYpzvMGFSlOukGTfAq8CyIkg+Nawuvy/qdEVtZtKlrTdMWraFCMFlUtcnMsRobFn5 f+3M1bIvCuhZvD/2nI6FhrbJrtGonqv+IdbEpkA73IY/TNeZPBTEBCXXxGQXiSaK4ue7 0RffDtZlzvm3Rl+14FXUZVGhe7fDefeUdYtPmSn0JIFFuZ2LEKQ0dknqm+1M/ZS/7LP6 X3tFaha/wgfvIfZOv04fUtKpUpzIsIEr3cqGH9Nutv7ZF6fOKrD/fWfJOnY/zvFevrcZ weDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from; bh=I6JKvanJrkCBH0Qux9WP1sqBTxUEGZpQtrNtbB4tySM=; b=d9X2HnQlUswMPBKZ13miFAIRIxFilbz6G1qkqxW4F6i7+NRjLM3W2RyMRcLs6+K0iT 5gZBkH4HFlmisoMTQLjLXRrdwjEsNnCAKElI2FaQeaVHCbdpYG8x/MBLhN+pXm4ZqjuM xTeNbty9Z1vi6CFwW/BcZZrGKB3+Z2u9YxR3xLmkNpKG7bZS0P+OnKtonYRl24Ld/djz BDI2fhPLa05nRE28s1HJ2cYz1TGw4I0Bt1YYldL21JOid90H+EeRCssN61FbLD5IxyOD EWCt1T4YwdaESvWo/R2+xhuQo51Z3X+pLyy69bZcwHqDWrIr/xTCz8osDV7KbHcZ/u1u afJQ== 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 u7si18043423pfu.270.2019.02.13.07.12.18; Wed, 13 Feb 2019 07:12:34 -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 S1731339AbfBMOP5 (ORCPT + 99 others); Wed, 13 Feb 2019 09:15:57 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:46615 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726654AbfBMOP4 (ORCPT ); Wed, 13 Feb 2019 09:15:56 -0500 Received: from localhost ([127.0.0.1] helo=vostro.local) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1gtvKC-000314-OO; Wed, 13 Feb 2019 15:15:44 +0100 From: John Ogness To: Sergey Senozhatsky Cc: 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 References: <20190212143003.48446-1-john.ogness@linutronix.de> <20190213014141.GB8097@jagdpanzerIV> Date: Wed, 13 Feb 2019 15:15:42 +0100 In-Reply-To: <20190213014141.GB8097@jagdpanzerIV> (Sergey Senozhatsky's message of "Wed, 13 Feb 2019 10:41:41 +0900") Message-ID: <878syj22r5.fsf@linutronix.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-02-13, Sergey Senozhatsky wrote: >> - console_flush_on_panic() currently is a NOP. It is pretty clear how >> this could be implemented if atomic_write was available. But if no >> such console is registered, it is not clear what should be done. Is >> this function really even needed? > > If you now rely on a fully preemptible printk kthread to flush > pending logbuf messages, then console_flush_on_panic() is your > only chance to see those pending logbuf messages on the serial > console when the system dies. Anything critical would have already been immediately print to the emergency consoles. And if an emergency console was available, console_flush_on_panic() could be a special case where _all_ unseen messages (regardless of importance) are printed to the emergency console. > Non-atomic consoles should become atomic once you call bust_spinlocks(1), > this is what we currently have: > > panic() > bust_spinlocks(1) // sets oops_in_progress > console_flush_on_panic() > call_console_drivers() > -> serial_driver_write() > if (oops_in_progress) > locked = spin_trylock_irqsave(&port->lock); > uart_console_write(); > if (locked) > spin_unlock_irqrestore(&port->lock); I don't like bust_spinlocks() because drivers end up implementing oops_in_progress with exactly that... ignoring their own locks. I prefer consoles are provided with a locking mechanism that they can use to support a separate NMI-safe write function. My series introduces console_atomic_lock() for exactly this purpose. But this doesn't help here. Here we are talking about a crashing system that does _not_ have an emergency console. And in this case I would say messages would be lost (just like they are now if all you have is a vt console and it was busy). I suppose we could keep the current bust_spinlocks() stuff for the special case that there are no emergency consoles available. It's better than nothing, but also not really reliable. Preferrably we figure out how to implement write_atomic for all console drivers. John Ogness