From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B8D6C04EB9 for ; Wed, 5 Dec 2018 14:28:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D4F9D20878 for ; Wed, 5 Dec 2018 14:28:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D4F9D20878 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727431AbeLEO2w (ORCPT ); Wed, 5 Dec 2018 09:28:52 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:55524 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726918AbeLEO2w (ORCPT ); Wed, 5 Dec 2018 09:28:52 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4F45080D; Wed, 5 Dec 2018 06:28:51 -0800 (PST) Received: from [10.1.196.62] (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1ADC13F59C; Wed, 5 Dec 2018 06:28:49 -0800 (PST) Subject: Re: [PATCH] drm/rockchip: Allow driver to be shutdown on reboot/kexec To: =?UTF-8?Q?Heiko_St=c3=bcbner?= , Brian Norris Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, Guenter Roeck , linux-kernel@vger.kernel.org References: <20180805124807.18169-1-marc.zyngier@arm.com> <20181205030127.GA200921@google.com> <1693737.bVF0dcvACY@diego> From: Marc Zyngier Openpgp: preference=signencrypt Autocrypt: addr=marc.zyngier@arm.com; prefer-encrypt=mutual; keydata= xsFNBE6Jf0UBEADLCxpix34Ch3kQKA9SNlVQroj9aHAEzzl0+V8jrvT9a9GkK+FjBOIQz4KE g+3p+lqgJH4NfwPm9H5I5e3wa+Scz9wAqWLTT772Rqb6hf6kx0kKd0P2jGv79qXSmwru28vJ t9NNsmIhEYwS5eTfCbsZZDCnR31J6qxozsDHpCGLHlYym/VbC199Uq/pN5gH+5JHZyhyZiNW ozUCjMqC4eNW42nYVKZQfbj/k4W9xFfudFaFEhAf/Vb1r6F05eBP1uopuzNkAN7vqS8XcgQH qXI357YC4ToCbmqLue4HK9+2mtf7MTdHZYGZ939OfTlOGuxFW+bhtPQzsHiW7eNe0ew0+LaL 3wdNzT5abPBscqXWVGsZWCAzBmrZato+Pd2bSCDPLInZV0j+rjt7MWiSxEAEowue3IcZA++7 ifTDIscQdpeKT8hcL+9eHLgoSDH62SlubO/y8bB1hV8JjLW/jQpLnae0oz25h39ij4ijcp8N t5slf5DNRi1NLz5+iaaLg4gaM3ywVK2VEKdBTg+JTg3dfrb3DH7ctTQquyKun9IVY8AsxMc6 lxl4HxrpLX7HgF10685GG5fFla7R1RUnW5svgQhz6YVU33yJjk5lIIrrxKI/wLlhn066mtu1 DoD9TEAjwOmpa6ofV6rHeBPehUwMZEsLqlKfLsl0PpsJwov8TQARAQABzSNNYXJjIFp5bmdp ZXIgPG1hcmMuenluZ2llckBhcm0uY29tPsLBewQTAQIAJQIbAwYLCQgHAwIGFQgCCQoLBBYC AwECHgECF4AFAk6NvYYCGQEACgkQI9DQutE9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: ARM Ltd Message-ID: Date: Wed, 5 Dec 2018 14:28:48 +0000 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: <1693737.bVF0dcvACY@diego> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, On 05/12/2018 14:11, Heiko Stübner wrote: > Hi Brian, > > Am Mittwoch, 5. Dezember 2018, 04:01:34 CET schrieb Brian Norris: >> + others >> >> Hi, >> >> On Sun, Aug 05, 2018 at 01:48:07PM +0100, Marc Zyngier wrote: >>> Leaving the DRM driver enabled on reboot or kexec has the annoying >>> effect of leaving the display generating transactions whilst the >>> IOMMU has been shut down. >>> >>> In turn, the IOMMU driver (which shares its interrupt line with >>> the VOP) starts warning either on shutdown or when entering the >>> secondary kernel in the kexec case (nothing is expected on that >>> front). >>> >>> A cheap way of ensuring that things are nicely shut down is to >>> register a shutdown callback in the platform driver. >>> >>> Signed-off-by: Marc Zyngier >>> --- >> >> This patch made it into 4.20-rc1 as well as -stable, and it has caused >> regressions for me, on the Kevin and Scarlet [1] RK3399 platforms. >> >> On >> shutdown/reboot, I see this: >> >> [ 94.742559] WARNING: CPU: 4 PID: 2035 at >> drivers/gpu/drm/drm_mode_config.c:477 drm_mode_config_cleanup+0x1c4/0x294 >> ... >> [ 94.775904] CPU: 4 PID: 2035 Comm: reboot Tainted: G W >> 4.20.0-rc5+ #83 [ 94.784651] Hardware name: Google Scarlet (DT) >> [ 94.789611] pstate: 20000005 (nzCv daif -PAN -UAO) >> [ 94.794959] pc : drm_mode_config_cleanup+0x1c4/0x294 >> [ 94.800500] lr : drm_mode_config_cleanup+0x108/0x294 >> ... >> [ 94.898683] Call trace: >> [ 94.901410] drm_mode_config_cleanup+0x1c4/0x294 >> [ 94.906565] rockchip_drm_unbind+0x4c/0x8c >> [ 94.911138] component_master_del+0x88/0xb8 >> [ 94.915807] rockchip_drm_platform_remove+0x2c/0x44 >> [ 94.921243] rockchip_drm_platform_shutdown+0x20/0x2c >> [ 94.926881] platform_drv_shutdown+0x2c/0x38 >> [ 94.931647] device_shutdown+0x164/0x1b8 >> [ 94.936016] kernel_restart_prepare+0x40/0x48 >> [ 94.940878] kernel_restart+0x20/0x68 >> [ 94.944964] __se_sys_reboot+0x1ac/0x204 >> [ 94.949331] __arm64_sys_reboot+0x2c/0x38 >> [ 94.953806] el0_svc_common+0xa4/0xec >> [ 94.957891] el0_svc_compat_handler+0x30/0x3c >> [ 94.962753] el0_svc_compat+0x8/0x18 >> [ 94.966740] ---[ end trace b9ba2e701f4fb233 ]--- >> [ 95.255169] Memory manager not clean during takedown. >> [ 95.260824] WARNING: CPU: 4 PID: 2035 at drivers/gpu/drm/drm_mm.c:950 >> drm_mm_takedown+0x34/0x44 ... >> [ 95.292314] CPU: 4 PID: 2035 Comm: reboot Tainted: G W >> 4.20.0-rc5+ #83 [ 95.301061] Hardware name: Google Scarlet (DT) >> [ 95.306020] pstate: 60000005 (nZCv daif -PAN -UAO) >> [ 95.311369] pc : drm_mm_takedown+0x34/0x44 >> [ 95.315940] lr : drm_mm_takedown+0x34/0x44 >> ... >> [ 95.415857] drm_mm_takedown+0x34/0x44 >> [ 95.420042] rockchip_drm_unbind+0x64/0x8c >> [ 95.424613] component_master_del+0x88/0xb8 >> [ 95.429283] rockchip_drm_platform_remove+0x2c/0x44 >> [ 95.434728] rockchip_drm_platform_shutdown+0x20/0x2c >> [ 95.440360] platform_drv_shutdown+0x2c/0x38 >> [ 95.445127] device_shutdown+0x164/0x1b8 >> [ 95.449504] kernel_restart_prepare+0x40/0x48 >> [ 95.454358] kernel_restart+0x20/0x68 >> [ 95.458436] __se_sys_reboot+0x1ac/0x204 >> [ 95.462812] __arm64_sys_reboot+0x2c/0x38 >> [ 95.467287] el0_svc_common+0xa4/0xec >> [ 95.471373] el0_svc_compat_handler+0x30/0x3c >> [ 95.476235] el0_svc_compat+0x8/0x18 >> [ 95.480215] ---[ end trace b9ba2e701f4fb234 ]--- >> >> It's especially bad on -stable kernels, where I believe the remove() >> paths were even worse. This triggers a variety of OOPSes, and it's not >> clear if those are simply because of backports (e.g., RK3399 did not >> have support in 4.4.y, but our downstream has merged all sorts of >> backports to make it work). >> >> Anyway, the above warnings occur on v4.20-rc, which I think is >> justification enough for a revert. > > That's strange. I remember testing quite a number of shutdown/reboot > cycles before applying that patch. And for good measure did the same > again right now. > > - Kevin, with netboot firmware, booting into Debian+console only > - Bob, with stock firmware, booting into Debian+KDE Plasma > - Scarlet, with stock firmware, booting into Debian+KDE Plasma > > With some random number of reboot and shutdowns on each I didn't > see any warnings at all. And I've been using this very patch for quite a while now. Before suggesting a revert, I'd rather we understand what is going on, and why is the DRM layer crapping itself that badly for a legitimate operation (it is certainly better to have a shutdown than to let the VOP scan out crap once the IOMMU has been shut down). In short, don't shoot the messenger. > >> I plan to submit a revert which I hope can go to 4.20 as well as >> -stable. I'd hope the remove()/shutdown() paths should be fixed before >> this gets applied again, and that it does not get shipped to -stable >> kernels. > > But judging by the fact that the warning indicates that somthing is still > holding onto a framebuffer and a rmmod rockchipdrm is not possible > at runrtime for likely the same reason, I guess we really might be creating > a problem with that shutdown. That's a potential root cause. > > Can you maybe give "drm/rockchip: shutdown drm subsystem on shutdown" [2] > a try? When the underlying issue of rebooting surfaced we had 2 competing > solutions, so we at least don't reopen the issue, that people have problems > rebooting? kexec working is certainly something I need. And I'd like to understand why Brian sees this and nobody else. Thanks, M. -- Jazz is not dead. It just smells funny...