Received: by 2002:ac0:cd8c:0:0:0:0:0 with SMTP id d12csp101156imp; Sat, 9 Mar 2019 17:32:56 -0800 (PST) X-Google-Smtp-Source: APXvYqxgwu3yf31GbaCcQQkc88Pm0u08HMMWVtza1GRVfhXHPt2YCSWlfP2sx4oGPWWJHrt0bg7P X-Received: by 2002:a63:f91b:: with SMTP id h27mr5371951pgi.399.1552181576608; Sat, 09 Mar 2019 17:32:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552181576; cv=none; d=google.com; s=arc-20160816; b=D6iBviiwGnfxdQo8biNImZcomuevovl7aXQQxM6DIFVpBVfQA4Pj5+iyk26GaUg6DJ Zd0NbYQDeg2B2YwBdWMBraZv5Fysz7FIVqmNLia3H77FfNTpru3bM8TDKVWdInkhf81q pkDDO30sCIWSKukOGL18p+jd5Ff+pADF3rPEK4MC0Y+GeMa4b2b7KziRIAjgqrJHh/NW TuUq8FJnD7lSkK7AmG98gBF1bQ1po5zPIfnc+6YdPhu1SyjnvR6qKmbADXFzQBANZbR5 eeWjHYU4Av1DF/JC5BQV+KT1EHlS0DIXBLO7m1ynlxhffALp5KJTbcfxUdfGbvMZiZfT QU1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:content-transfer-encoding :content-disposition:mime-version:message-id:subject:cc:to:from:date :dkim-signature; bh=MeHX5aKYuZoGS7XrVhdAnETrAHw6BjbFCXO1z3UFY6M=; b=giybwMQ/DlBnKrho53X7JgDURgIrVU2Np9eaUeFL1pm5cXzqCO8lswy41ErZKo6UN7 e/wryIsp6K+2SZPGGyeW5XmSi9h7gxE6nHmcy2W3cphFpAugnu9XWF9eKA6xdfOGJSau APOj05i2J9+92+hxXD/YvXn4eNQdB/9KoAlgMFgWdhUHhObz9DTjzq/Qi3G5ggEq80UJ Sl4i977oWFZusfXZOBRc8xLYD/zw+TSNmGakpY/rfRyS75oyfpWRSS58cREk7q6aoLfy FId3SekBay0/Cqpj/P//Ns6pEr8+KBrsjqyt0HKuKqjsYQi5xwI1G+KXRjLyIuQ5leiJ TEJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VDK00HHl; 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 g1si1789306plt.318.2019.03.09.17.32.26; Sat, 09 Mar 2019 17:32:56 -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=VDK00HHl; 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 S1726418AbfCJBby (ORCPT + 99 others); Sat, 9 Mar 2019 20:31:54 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:40796 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726340AbfCJBby (ORCPT ); Sat, 9 Mar 2019 20:31:54 -0500 Received: by mail-wr1-f67.google.com with SMTP id t6so1314649wrw.7 for ; Sat, 09 Mar 2019 17:31:52 -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:mime-version:content-disposition :content-transfer-encoding:user-agent; bh=MeHX5aKYuZoGS7XrVhdAnETrAHw6BjbFCXO1z3UFY6M=; b=VDK00HHl7lo7XMeOKUbR4qxJx61RO36v7KOEZL/Fzzdmbw24XUqVagtyXYDOCQyEUL 5DXUBXl3hrEVWQBhqEij4+S7huiQquTVpR0W+52ezxqfdX/sJUu3lH9L/NOHqL0VCCWO QOjlV+ImrYL1INdIXWxBbxjNSrIfHKPd2AcPmZIy55ET3CecBnDcZPEaIIQ4ZipcFchu epMFZ1q+8sMkBsXbNRC0aGGFiXT/KNZS/VrZCnx59788/nbi6CEtz/0IyPCGFcdveaOk gT0s/ZrdEvyL1Zq9XXYomJQ1XjfG8nl2xuXDpKJ0yfiKVOEfDCLw9+YkNGQ1OocCywyC q33w== 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:mime-version :content-disposition:content-transfer-encoding:user-agent; bh=MeHX5aKYuZoGS7XrVhdAnETrAHw6BjbFCXO1z3UFY6M=; b=YNPu+yftnKnraRKPnDKz0mM+9DGopV2mh0k46JP6l7nh2UJCTgRKoWZ5/Q8XDoMrkY AeKMNACVnTvRhxgBVFKc3w7OI+BGXnOYGkHAzcLSdMQG6jr1gXHKQew5zjkXJUHmSAdp in9M5b8OgTFxRerr2Q/GnkNKfa0jUTAre0s5FCA4J5Sldm1rY161Tn1qjqwxRM1a3e74 ORo7bmd3YltDXnxDRJl/uH/Qjma5+UgAltJR1/0IDVhe0HtMbHHv2frTH4nMFb8rdbVg EagcfpM1ATNo/eUWYNW7+k6yY530o5dMoy7sXk3gTRfOvLi9qVuHCfd12Fp388Vaogo5 9Gqg== X-Gm-Message-State: APjAAAX//BjAjHzm+y5Lf1uYZ1VwpmT5dcjdlqWlzHjiT9cSC/omAeDy qjreD6Ut2NFAZZqc2i4cjQY= X-Received: by 2002:adf:ed48:: with SMTP id u8mr7840919wro.185.1552181511528; Sat, 09 Mar 2019 17:31:51 -0800 (PST) Received: from darwi-home-pc (ip-109-42-3-226.web.vodafone.de. [109.42.3.226]) by smtp.gmail.com with ESMTPSA id u4sm17151586wmb.25.2019.03.09.17.31.48 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sat, 09 Mar 2019 17:31:50 -0800 (PST) Date: Sun, 10 Mar 2019 02:31:42 +0100 From: "Ahmed S. Darwish" To: David Airlie , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Alex Deucher , Christian =?iso-8859-1?Q?K=F6nig?= , David Zhou , Ard Biesheuvel , Matt Fleming Cc: Linus Torvalds , Greg Kroah-Hartman , John Ogness , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: DRM-based Oops viewer Message-ID: <20190310013142.GA3376@darwi-home-pc> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 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? 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