Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1987538yba; Mon, 15 Apr 2019 02:33:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqwwwsMtE8/RIw/MSjauHXGbYC6xe2pN1Fiv+SOH9D9QIyAGZiTon7CiGasxbFdk72wA1hg2 X-Received: by 2002:a63:36ce:: with SMTP id d197mr70410451pga.180.1555320812345; Mon, 15 Apr 2019 02:33:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555320812; cv=none; d=google.com; s=arc-20160816; b=ENqX7fiNt3AX84YfZic6qQXC8I3QzkNwVnZE5LZfNvpp88w3zXy39s3qsqiGgWZkV+ 4ScEJBNUU3LfUkqrjFMxD+e5iU6cWNGOMMovxXc+lCktxEjPBJzibOW0qFvmbSSmx+3n pHs87niHcy4LFP4mKoQQAw1/l7zUozq3xlgRoD1e8HNm2dbACH/KD2nD/dSiE1UEa5Gg ctcx7Y1p1nmGgunuNkh5HGXC3YVpLHE+qnGVBsAKbGtjRgjAUSuzgZloykBcehsDHoSi WUlMsX/wXFVWE9rIKWpOq/R23RqWr/0pv2EwTKerxda1Y/Na9Uc5BFaezPWOSi0uH4Os eujg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=2qQwhdB421Qs0uWk8Slq+6JwlD5A2OSiEdeM5YjOvIs=; b=RLMeNAX7RPEAP5Eg9bm3Pw3gT3Pf6a81xRs4AURIr9Ov1bGqQj30tByMo48KSxpuuK WtBsclFy+ZRcnX1yxZ8p5IOzs6Li0iHHIrKT2T3xC9go95zGW9EnRW/bJsIwQi5b84Ag +jWpkibVOLzHeFLngEod0Uc47tMyTiOuBDIw7+nAS6gHVRS4gOPsTb1ioPfypyzjED5Q nWIfywoKe3uIojSRUlKkvRI5m4UGydJ9XHAbfnrjoHHfsnyeSgBjFInNj8H9Cab5RwU5 yJimL+0M76OxFeeAXiOI4A3Q2ROEAm7cBgXaRxYVY7GE9LRLIUYb5aTBg7iYY1zWpEiG pZ7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=dBqaVp2z; 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 i1si35433717plt.68.2019.04.15.02.33.16; Mon, 15 Apr 2019 02:33:32 -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; dkim=fail header.i=@ffwll.ch header.s=google header.b=dBqaVp2z; 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 S1726644AbfDOJca (ORCPT + 99 others); Mon, 15 Apr 2019 05:32:30 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:43283 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725779AbfDOJca (ORCPT ); Mon, 15 Apr 2019 05:32:30 -0400 Received: by mail-ed1-f66.google.com with SMTP id j20so3846066edq.10 for ; Mon, 15 Apr 2019 02:32:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=2qQwhdB421Qs0uWk8Slq+6JwlD5A2OSiEdeM5YjOvIs=; b=dBqaVp2zfsW7DxkosP1fho0b5Em13Dj6agL8htiwaqz+z1attu13/AdwJvLnweJdmJ kmQMRTwDBee5x9gVksSxL5KqJl4mTuEE8b8UmGERvbjLQg72g0YLXiPhF4KpPOY7mQTO VU1Krg0R/2xeR/Gprs4jRq/R64rGrPfbm80Oo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=2qQwhdB421Qs0uWk8Slq+6JwlD5A2OSiEdeM5YjOvIs=; b=ezMFyGGZaHstOb5CBrsAQcHI9yVK5gMW1sqERQxn0+NN4d66lI48aiBdAWnRYYWd3i C4yIAmsTWxk7MnBAscfIVpaNtn3nuwpuulCInyxBpeLOpFEOsK+elfJZUxZbUuqi8wv+ dD2XuDebSV6/0tjVT6mq9pnlzBnZtOysguR61N+Y00I93K+VUftQJdk6/STAnSnsWyDv uM2brfres4JSBKF98eqp6fB+i1RKUgI1+jMESOiCmsGbogA6Gd4oyi2zXAlXMlMnk7eQ UdJOabVb6s/pqOxeH5EKGJpn58EzONkiC81b3HNI0mfS7RUy3Uw5/TOeaH6NJTJ3lHrz 6f2w== X-Gm-Message-State: APjAAAVSX3VmB69rlVwS+IZuCV73AY44OrmdlxPGMSFQTcVOyh978sbX B5g4I3yuRNDe0POvm02Z9uAKag== X-Received: by 2002:a50:82a6:: with SMTP id 35mr22620089edg.15.1555320748955; Mon, 15 Apr 2019 02:32:28 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id p1sm7187077ejf.40.2019.04.15.02.32.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 15 Apr 2019 02:32:27 -0700 (PDT) Date: Mon, 15 Apr 2019 11:32:25 +0200 From: Daniel Vetter To: Janusz Krzysztofik Cc: Joonas Lahtinen , Jani Nikula , Rodrigo Vivi , David Airlie , Daniel Vetter , Chris Wilson , michal.wajdeczko@intel.com, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Janusz Krzysztofik Subject: Re: [PATCH 1/2] drm/i915: Use drm_dev_unplug() Message-ID: <20190415093225.GZ2665@phenom.ffwll.local> Mail-Followup-To: Janusz Krzysztofik , Joonas Lahtinen , Jani Nikula , Rodrigo Vivi , David Airlie , Chris Wilson , michal.wajdeczko@intel.com, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Janusz Krzysztofik References: <20190405130235.7707-1-janusz.krzysztofik@linux.intel.com> <20190405130235.7707-2-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190405130235.7707-2-janusz.krzysztofik@linux.intel.com> X-Operating-System: Linux phenom 4.19.0-1-amd64 User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 05, 2019 at 03:02:34PM +0200, Janusz Krzysztofik wrote: > From: Janusz Krzysztofik > > The driver does not currently support unbinding from a device which is > in use. Since open file descriptors may still be pointing into kernel > memory where the device structures used to be, entirely correct kernel > panics protect the driver from being unbound as we should not be > unbinding it before those dangling pointers have been made safe. > > According to the documentation found inside drivers/gpu/drm/drm_drv.c, > drm_dev_unplug() should be used instead of drm_dev_unregister() in > order to make a device inaccessible to users as soon as it is unpluged. > Follow that advice to make those possibly dangling pointers safe, > protected by DRM layer from a user who is otherwise left pointing into > possibly reused kernel memory after the driver has been unbound from > the device. Once done, also cancel inflight operations immediately by > calling i915_gem_set_wedged(). > > Signed-off-by: Janusz Krzysztofik > Reviewed-by: Chris Wilson Reviewed-by: Daniel Vetter > --- > drivers/gpu/drm/i915/i915_drv.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c > index 9df65d386d11..66163378c481 100644 > --- a/drivers/gpu/drm/i915/i915_drv.c > +++ b/drivers/gpu/drm/i915/i915_drv.c > @@ -1596,7 +1596,7 @@ static void i915_driver_unregister(struct drm_i915_private *dev_priv) > i915_pmu_unregister(dev_priv); > > i915_teardown_sysfs(dev_priv); > - drm_dev_unregister(&dev_priv->drm); > + drm_dev_unplug(&dev_priv->drm); > > i915_gem_shrinker_unregister(dev_priv); > } > -- > 2.20.1 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch