Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp1036322imc; Mon, 11 Mar 2019 05:11:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqzXEihPOZ2RUnfeh8cSSTuSDyuJ28U0BmkwGiX5pK7FIl3ATb1huTqikfzn6ypSlzTN8DyB X-Received: by 2002:a17:902:6942:: with SMTP id k2mr33313643plt.136.1552306311577; Mon, 11 Mar 2019 05:11:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552306311; cv=none; d=google.com; s=arc-20160816; b=qDOfj24/6QORYYg8wfI14tl3Rw78d7qZSxwYvTSdSWn9dvc9rVDMiLsngq4lKA6unn C3Eo1pjg0n+i/Z+bWHF1UVUrGLkUjlsgy9Yd/0Fj71rJLS3QWD1HXGNjMM0ENuJo+FiI p0pC3u+4UzZbWtyARpcQ0hs5CqW+Nrl1Nu0eqD7bEcm6XPe3KWcpHjSlJf6uDcE3JAE+ HTnC5D9SGv7Xx7PrMVsTW0PrdRZg6c3I23u3shxGhtoZsYHDC3xf09gYhqLzBiEwtp1N sPuMj/oG23yZkcQ0J/3ttAoCM2wOuJLmeI3N0RX6bgl4AcJAM1+aVD3XnonMJO2XKJhT XbsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:subject:user-agent:message-id :references:cc:in-reply-to:organization:from:to :content-transfer-encoding:mime-version; bh=EC3CM0/XhMGl5hT3REWq/PGtPA8sew5K1d9tAraywyQ=; b=TVhpTgI/5IeR/q8dm8DnaIABV3yx7EVG07+AsPMqyIC/L4c7Wl0m0NPSCY/LdplQFd Ta8VsNFP4BndZVFAgkETJzFDA6V7MLaHAqXFV6mLL0YL/A+L313Ysk0954/ojVG1VfqD jUg3rgVnRiyZB+07HDP/LMM/HoPyEGpIeI0kSrGgHT8L+VjhRB80vggwLyx+vtH631Eo 1NwM5Rzg1D87IQRft1xeAMY1jC4uchvuPDQt11pXdyZOSTmGPwtjVagXT3+RcE2P7Dm1 bAidWBnnwqRJmZ5ec01W1RdHB1gTcHs71DYW9ruCNjn030fBbcfv57OqnACxoR/rEY7b Q25w== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s194si4873570pgs.47.2019.03.11.05.11.25; Mon, 11 Mar 2019 05:11:51 -0700 (PDT) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727236AbfCKMK4 convert rfc822-to-8bit (ORCPT + 99 others); Mon, 11 Mar 2019 08:10:56 -0400 Received: from mga09.intel.com ([134.134.136.24]:6093 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726652AbfCKMKz (ORCPT ); Mon, 11 Mar 2019 08:10:55 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Mar 2019 05:10:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,467,1544515200"; d="scan'208";a="140971751" Received: from jlahtine-desk.ger.corp.intel.com (HELO localhost) ([10.252.10.139]) by orsmga002.jf.intel.com with ESMTP; 11 Mar 2019 05:10:50 -0700 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT To: "Ahmed S. Darwish" , Alex Deucher , Ard Biesheuvel , =?utf-8?q?Christian_K=C3=B6nig?= , Daniel Vetter , David Airlie , David Zhou , Jani Nikula , Matt Fleming , Rodrigo Vivi From: Joonas Lahtinen Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo In-Reply-To: <20190310013142.GA3376@darwi-home-pc> Cc: Linus Torvalds , Greg Kroah-Hartman , John Ogness , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20190310013142.GA3376@darwi-home-pc> Message-ID: <155230624946.5208.5177271872742391668@jlahtine-desk.ger.corp.intel.com> User-Agent: alot/0.7 Subject: Re: DRM-based Oops viewer Date: Mon, 11 Mar 2019 14:10:49 +0200 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Ahmed S. Darwish (2019-03-10 03:31:42) > Hello DRM/UEFI maintainers, > > Several years ago, I wrote a set of patches to dump the kernel > log to disk upon panic -- through BIOS INT 0x13 services. [1] > > The overwhelming response was that it's unsafe to do this in a > generic manner. Linus proposed a video-based viewer instead: [2] > > If you want to do the BIOS services thing, do it for video: copy the > oops to low RAM, return to real mode, re-run the graphics card POST > routines to initialize text-mode, and use the BIOS to print out the > oops. That is WAY less scary than writing to disk. > > Of course it's 2019 now though, and it's quite known that > Intel is officially obsoleting the PC/AT BIOS by 2020.. [3] > > Researching whether this can be done from UEFI, it was also clear > that UEFI "Runtime Services" do not provide any re-initialization > routines. [4] > > The maximum possible that UEFI can provide is a GOP-provided > framebuffer that's ready to use by the OS -- even after the UEFI > boot phase is marked as done through ExitBootServices(). [5] > > Of course, once native drivers like i915 or radeon take over, > such a framebuffer is toast... [6] > > Thus a possible remaining option, is to display the oops through > "minimal" DRM drivers provided for each HW variant... Since > these special drivers will run only and fully under a panic() > context though, several constraints exist: > > - The code should be fully synchronous (irqs are disabled) > - It should not allocate any dynamic memory > - It should make minimal assumptions about HW state > - It should not chain into any other kernel subsystem > - It has ample freedom to use delay-based loops and the > like, the kernel is already dead. > > How feasible is it to have such a special "DRM viewoops" > framework + its minimal drivers in the kernel? There is already (efi-)pstore, and I believe it could be already integrated to distros so that the captured error is displayed on next boot. So the user experience difference would only be seeing the error immediately vs. on boot? For that gain, it might be bit much work to create failsafe mode to each driver, but others may disagree. Regards, Joonas > The target is to start from i915, since that's what in my > laptop now, and work from there.. > > Some final notes: > > - The NT kernel has a similar concept, but for storage instead. > They're used to dump core under kernel panic() situations, > and are called "Minoport storage drivers". [7] > > - Since Windows 7+, a very fancy Blue Screen of Death is > displayed, with Unicode and whatnot, implying GPU drivers > involvement. [8] > > - Mac OS X also does something similar [9] > > - On Linux laptops, the current situation is _really_ bad. > > In any graphical session, type "echo c > /proc/sysrq-trigger"; > the screen will just completely freeze... > > Desired first goal: just print the panic() log > > Thanks a lot, > > [1] https://lore.kernel.org/lkml/20110125134748.GA10051@laptop > [2] https://lore.kernel.org/lkml/AANLkTinU0KYiCd4p=z+=ojbkeEoT2G+CAYvdRU02KJEn@mail.gmail.com > > [3] https://uefi.org/sites/default/files/resources/Brian_Richardson_Intel_Final.pdf > > [4] UEFI v2.7 spec, Chapter 8, "Services — Runtime Services" > [5] UEFI v2.7 spec, Section 12.9, "Graphics Output Protocol" > "The Graphics Output Protocol supports this capability by > providing the EFI OS loader access to a hardware frame buffer > and enough information to allow the OS to draw directly to > the graphics output device." > > [6] linux/drivers/gpu/drm/i915/i915_drv.c::i915_kick_out_firmware_fb() > linux/drivers/gpu/drm/radeon/radeon_drv.c::radeon_pci_probe() > > [7] https://docs.microsoft.com/en-us/windows-hardware/drivers/storage/restrictions-on-miniport-drivers-that-manage-the-boot-drive > > [8] https://upload.wikimedia.org/wikipedia/commons/archive/5/56/20181019151937%21Bsodwindows10.png > [9] https://upload.wikimedia.org/wikipedia/commons/4/4a/Mac_OS_X_10.2_Kernel_Panic.jpg > > --darwi > http://darwish.chasingpointers.com