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=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 ECDD4C35671 for ; Sat, 22 Feb 2020 09:50:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C013F208C4 for ; Sat, 22 Feb 2020 09:50:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="BoawQScH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C013F208C4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 182E96E595; Sat, 22 Feb 2020 09:50:52 +0000 (UTC) Received: from mail-ot1-x344.google.com (mail-ot1-x344.google.com [IPv6:2607:f8b0:4864:20::344]) by gabe.freedesktop.org (Postfix) with ESMTPS id 033F76E595 for ; Sat, 22 Feb 2020 09:50:50 +0000 (UTC) Received: by mail-ot1-x344.google.com with SMTP id j20so4414414otq.3 for ; Sat, 22 Feb 2020 01:50:50 -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=e5S/nZCr4nqEYxH5Y3wrkaNYijjYpxHWH5hGO1LnRQ4=; b=BoawQScHyiFG89p7KByW4b9ul7MXcbq2KFCxaQBmHZsXUaIQVsUMVaaBtxIhNYQXs1 uHS+8wLAiYPdeGIrmVqUmlUt4P6s6NhYO01d+yOhKr++D52TjEaF2OgvgL0WiXAFdaXr Fp7Izvk1q6TLrcYd/AayTWFyiLLznQjQzZAtk= 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=e5S/nZCr4nqEYxH5Y3wrkaNYijjYpxHWH5hGO1LnRQ4=; b=VNKoLLcRhe7XY/REUGHxqhOQsCDk7rRK2P/qTjDhWdwFryiE/m8Tjm8n9+V2xnKDAg 1creEouHFH6fRgyB6M9OAkTfqvpr/qcFXGG+haKwTGYrblouGTp4HQ2Qk4k1uKLNKLOn evqubqUjoMRyQ7w2Zd73Rq2uLFyngLMS+UBGFO3qi4tFOnu2g0EhUIf7Rf8PKIZsnvCJ N7eqGbA1Q0RI+tRx9GXDTfQ/kQHxHLWb/ksmkFrdPyaSDB7OMNbww+2MedWy+2bf9fzG rXhbT6L0PJLfXFEX5Z1StZEEc0/d81TNpqado0Z6codw1zpcc0VQn1EhMB8exwwks5kE z2ng== X-Gm-Message-State: APjAAAWReuQNSZGUXJ0iBeGGkx52b8JU4W/ZtbQLxRhLIyzzwAI4R02x Jz8P/Uw5CjAOsO/DwxeZBL5Er5CngWFmE6PQ9cqFag== X-Google-Smtp-Source: APXvYqwWbAZQEYMHHWhS1aboYiXY2Mf9+ysoQmEML4yKTNEkgCGF5c1t/bJGb8p9rybjNZxZhghXt+84r19k6af2c2Q= X-Received: by 2002:a05:6830:18f1:: with SMTP id d17mr31777824otf.303.1582365050206; Sat, 22 Feb 2020 01:50:50 -0800 (PST) MIME-Version: 1.0 References: <20200221210319.2245170-1-daniel.vetter@ffwll.ch> <20200221210319.2245170-3-daniel.vetter@ffwll.ch> <158232098048.7320.8539611385294752480@skylake-alporthouse-com> In-Reply-To: From: Daniel Vetter Date: Sat, 22 Feb 2020 10:50:39 +0100 Message-ID: Subject: Re: [PATCH 02/51] drm/i915: Don't clear drvdata in ->release To: Chris Wilson X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Greg Kroah-Hartman , Intel Graphics Development , DRI Development , Daniel Vetter Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Sat, Feb 22, 2020 at 10:48 AM Daniel Vetter wrote: > > On Fri, Feb 21, 2020 at 10:36 PM Chris Wilson wrote: > > Quoting Daniel Vetter (2020-02-21 21:02:30) > > > For two reasons: > > > > > > - The driver core clears this already for us after we're unloaded in > > > __device_release_driver(). > > > > Even if we abort before loading? > > > > History notes that i915_pci_remove was called with a stale pointer on > > error. > > So even if there's a bug we still have the problem that clearing the > pci_drvdata in our drm_driver->release hook is way too late. You could > already have bound a new driver to the underlying device. So if driver > core doesn't clear drvdata on bind failure and we need to clear this > ourselves, then this line here could actually clear the drvdata of the > next driver instance bound to the pci device. Not that that's ever > going to happen outside of very contrived testing. > > But looking at really_probe() in base/dd.c we do clear drvdata on > failure. So no idea how/why that stale drvdata came to be. Anyway > that's kinda why I cc'ed Greg, so he could confirm that this is > correct. Looking at git history, this was fixed in driver core in commit 0998d0631001288a5974afc0b2a5f568bcdecb4d Author: Hans de Goede Date: Wed May 23 00:09:34 2012 +0200 device-core: Ensure drvdata = NULL when no driver is bound I'll add that to the commit message. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel