Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1741987ybl; Thu, 19 Dec 2019 02:12:01 -0800 (PST) X-Google-Smtp-Source: APXvYqyWJYqMak8ESrGnLJMQHcZC0LGXMPZxuKVaOZbJ80NWE+eV5ZmzapTnCLZ9TmON4fuWtG0P X-Received: by 2002:a9d:630d:: with SMTP id q13mr7566750otk.31.1576750321821; Thu, 19 Dec 2019 02:12:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576750321; cv=none; d=google.com; s=arc-20160816; b=0GwDz4499o39cCPaPKFwkAZ6WQjnrwv6oOqB/heoSn5kjwnUNHGkwNk+9PCDDGPk+S Pu9yuIiV3C5AWn26Ba0dYn934d7AZJ9Y5GvboIyLHTIdCiSAu+LDvSyL74VuK/qoivo4 +ufdBoXjhwCquLvFm5yCmmaQWKiXwh8afR+JCnrZIhK4/jJkM7cJu1yLXOeJxpXjW2yn 0ny20RIYw4AXnRCQY7BtTyr9UDKvmK2UWKQ0l2qgzPoXr5cLtNr6rWTtL96sO3l9h4At bRKBa1AxTqq1Q4ABMVyhc7YpXMvk3di3sku/w7Un8lrsA/z7BY8QAfwqKdLV+RPyPPBN gv/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=8Cr4KDsrSrUXnbU/Gr6Foj6VfqdF5VwH1MBdetl2SOg=; b=ilIIBlyudx7GyfOcH+SEMfJAmgFrYcLHwH/wVCojGjxG/e20/UJNIlKm5ZCn41hWMQ BBE/r3HxLkjci5s6b8LuBe4qN5xlCh0zVsW5gJOEpPYQJNaoNy4kyOpxhzAAVhADRnJ1 N2fCgZ98CBsUUEU9HLduDI7CKEPrnYbV6yLTXHqw1r5uej/5sPRpP9BZRCZ2rdUB9vi5 lzMoCrqF9YUQns/Mq4OmzJeVmUWwlZxZppwzm+FQVh4rcKsakZIfX/sbUdr0m60so5G9 WHEQ544TxCjEgAEBQQCJFdhc1bijTJZSG8QNJPTn4EI23ogzyjVmVX/KhJ96Pgn/kEHC Rnzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=DAdi4AJA; 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 44si1877051otu.77.2019.12.19.02.11.48; Thu, 19 Dec 2019 02:12:01 -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=@ffwll.ch header.s=google header.b=DAdi4AJA; 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 S1726681AbfLSKKu (ORCPT + 99 others); Thu, 19 Dec 2019 05:10:50 -0500 Received: from mail-oi1-f196.google.com ([209.85.167.196]:44014 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726609AbfLSKKt (ORCPT ); Thu, 19 Dec 2019 05:10:49 -0500 Received: by mail-oi1-f196.google.com with SMTP id p125so242143oif.10 for ; Thu, 19 Dec 2019 02:10:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8Cr4KDsrSrUXnbU/Gr6Foj6VfqdF5VwH1MBdetl2SOg=; b=DAdi4AJAgSRWd7DNciQSFAP3HrKk34OYvC989VkKAT5AYDSuaR2HvJQIl7PfwTtmAa aRU/cySx3nfaeflRJijnSNuJRonpNKlwMQvd/U0NQ5MDbIwDVdNDLuDFEUDLuEIxYdk7 Ur6BC0beoIjLF9tjm7iELb/AGfJD783mQajF0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8Cr4KDsrSrUXnbU/Gr6Foj6VfqdF5VwH1MBdetl2SOg=; b=lPN7E1ov9BCbPQy0orOFATaK/WGkV8EuHjRuHFgdEirK4d/3YL4LETTBtI6zotYo1V Bn+sGXMM33q/cCJoARdKYV2yjrJpQYp5kQkj/DV5B5xLKrxJQ8rc0ii3zr0tVrDt8ghn wNE2cxQEVEkR6mZ0k2Sw71tcFI48j92HAiccvGWSKsxgnxmZjUbgNGbF8/rLEUAYzc6M Qs6xvetgVTV4ulpy54blq1bzCZyR9YpG2/fwJgNgt/1pH0KVRrlKpWrKpEKk4xrPRSCT xzRGsNK/YtVUW1AA/E75zqTfqLEfrr+SHFrnNN8pC4J97Wn6kev79CqngFFjrDEYXwDe xHSQ== X-Gm-Message-State: APjAAAVTyqb6prrWrQ4OJ1NAm3rRRNAWQ8TkrXKS59wIWQYsJEGn1agH zZkFRaTVrChASGdIxlC1iUfdP8mhuqkoJoiZdIZ20A== X-Received: by 2002:aca:d985:: with SMTP id q127mr1737283oig.132.1576750248829; Thu, 19 Dec 2019 02:10:48 -0800 (PST) MIME-Version: 1.0 References: <07899bd5-e9a5-cff0-395f-b4fb3f0f7f6c@huawei.com> In-Reply-To: From: Daniel Vetter Date: Thu, 19 Dec 2019 11:10:37 +0100 Message-ID: Subject: Re: Warnings in DRM code when removing/unbinding a driver To: John Garry Cc: Ezequiel Garcia , "kongxinwei (A)" , "Chenfeng (puck)" , "airlied@linux.ie" , Thomas Zimmermann , Linuxarm , "dri-devel@lists.freedesktop.org" , "linux-kernel@vger.kernel.org" , Gerd Hoffmann , dbueso@suse.de Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 19, 2019 at 11:03 AM John Garry wrote: > > On 19/12/2019 09:54, Daniel Vetter wrote: > > On Wed, Dec 18, 2019 at 7:08 PM John Garry wrote: > >> > >> + > >> > >> So the v5.4 kernel does not have this issue. > >> > >> I have bisected the initial occurrence to: > >> > >> commit 37a48adfba6cf6e87df9ba8b75ab85d514ed86d8 > >> Author: Thomas Zimmermann > >> Date: Fri Sep 6 14:20:53 2019 +0200 > >> > >> drm/vram: Add kmap ref-counting to GEM VRAM objects > >> > >> The kmap and kunmap operations of GEM VRAM buffers can now be called > >> in interleaving pairs. The first call to drm_gem_vram_kmap() maps the > >> buffer's memory to kernel address space and the final call to > >> drm_gem_vram_kunmap() unmaps the memory. Intermediate calls to these > >> functions increment or decrement a reference counter. > >> > >> So this either exposes or creates the issue. > > > > Yeah that's just shooting the messenger. > > OK, so it exposes it. > > Like I said, for most drivers > > you can pretty much assume that their unload sequence has been broken > > since forever. It's not often tested, and especially the hotunbind > > from a device (as opposed to driver unload) stuff wasn't even possible > > to get right until just recently. > > Do you think it's worth trying to fix this for 5.5 and earlier, or just > switch to the device-managed interface for 5.6 and forget about 5.5 and > earlier? I suspect it's going to be quite some trickery to fix this properly and everywhere, even for just one driver. Lots of drm drivers unfortunately use anti-patterns with wrong lifetimes (e.g. you can't use devm_kmalloc for anything that hangs of a drm_device, like plane/crtc/connector). Except when it's for a real hotunpluggable device (usb) we've never bothered backporting these fixes. Too much broken stuff unfortunately. -Daniel > > Thanks, > John -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch