Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1061732yba; Thu, 4 Apr 2019 03:31:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqx0klIDwp4LYtOsAJF7yygpaO+H5qoo30Fu3bXda8x16w32IK9iEUvEswMRTtP9JqvqIuMA X-Received: by 2002:a62:e411:: with SMTP id r17mr4973508pfh.127.1554373877600; Thu, 04 Apr 2019 03:31:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554373877; cv=none; d=google.com; s=arc-20160816; b=VJ0wjz2/+QqqFD1GGG5+bFucdZGXSKp+FrMIvmWs0ofPIL2nH7cwdC03764hGPQO3g 3FjOvLgc4AU/MkvQJFKqv16byEn7zAOz+fxS6/wdkb5Jnir9cxZXqrovmUHjSeXX9IfP Y/btHlK3Kqk+GAjZaxxIEEzQVWMdHbo5liuzMG67LyK5N7+XqUvwG5QsnNA8Fveo2dVA FRcDccKSH1xtL1jxGFoCejVoKaCr+aKiApo5ZkTXnjMbyyWif/yRXanC3CWM2Gyf0Vf4 D1JFZKdeJo6EHLGnBQcvRol7hVoqcq8qGL1+LIaDFRG4ezrRoHsRbCOxki83otUxVyk7 C9Mg== 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:from:to:content-transfer-encoding :mime-version; bh=TZ4LevpGfpGrFCylrIUcBQJL4+HdEpZeFlz7Yxc7Knc=; b=VqFvJoxoGn0Gl9ETJuIfikqFjShhhAmLirDoMqZWSSQphC8ps3iT4gfIGF0AlJsosV GcK0UVmoTw9/C7FUhOHe9o2o38jhhRhk7ExLBuEj0fcbHoG1ifgtCAzfu1psLF6aXDKp 225dEK5IBiOYF79yqM9dQ4KApv0hyj4+FE6k3X52Me7+4dCGcsnhCj3xb3VjQIik8Xlw kjny91g8Z/Jod2Neg+YR/zOMSQWc4ezQ40EI1WRLrpdHho03ncuLeypXpdKKTVfLDlW5 0CFcIPENJY46rSF7DgmlmdtDryNAA64w+sr/sBVY8o6x9fy4iz4NhFM5H06iKTbOOlYs U9Dw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h73si16691741pfj.220.2019.04.04.03.31.02; Thu, 04 Apr 2019 03:31:17 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729253AbfDDK3M convert rfc822-to-8bit (ORCPT + 99 others); Thu, 4 Apr 2019 06:29:12 -0400 Received: from mail.fireflyinternet.com ([109.228.58.192]:62821 "EHLO fireflyinternet.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726563AbfDDK3M (ORCPT ); Thu, 4 Apr 2019 06:29:12 -0400 X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from localhost (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP (TLS) id 16128560-1500050 for multiple; Thu, 04 Apr 2019 11:29:02 +0100 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT To: Jani Nikula , Janusz Krzysztofik , Joonas Lahtinen , Rodrigo Vivi From: Chris Wilson In-Reply-To: <20190404102445.12303-1-janusz.krzysztofik@linux.intel.com> Cc: Janusz Krzysztofik , David Airlie , intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org References: <20190404102445.12303-1-janusz.krzysztofik@linux.intel.com> Message-ID: <155437373474.7532.10868620123516507965@skylake-alporthouse-com> User-Agent: alot/0.6 Subject: Re: [Intel-gfx] [PATCH] drm/i915: Fix context IDs not released on driver hot unbind Date: Thu, 04 Apr 2019 11:28:59 +0100 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Janusz Krzysztofik (2019-04-04 11:24:45) > From: Janusz Krzysztofik > > In case the driver gets unbound while a device is open, kernel panic > may be forced if a list of allocated context IDs is not empty. > > When a device is open, the list may happen to be not empty because a > context ID, once allocated by a context ID allocator to a context > assosiated with that open file descriptor, is released as late as > on device close. > > On the other hand, there is a need to release all allocated context IDs > and destroy the context ID allocator on driver unbind, even if a device > is open, in order to free memory resources consumed and prevent from > memory leaks. The purpose of the forced kernel panic was to protect > the context ID allocator from being silently destroyed if not all > allocated IDs had been released. Those open fd are still pointing into kernel memory where the driver used to be. The panic is entirely correct, we should not be unloading the module before those dangling pointers have been made safe. This is papering over the symptom. How is the module being unloaded with open fd? If all the fd have been closed, how have we failed to flush and retire all requests (thereby unpinning the contexts and all other pointers). -Chris