From patchwork Sat Feb 6 01:48:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ben Widawsky X-Patchwork-Id: 8240951 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D05599F1C1 for ; Sat, 6 Feb 2016 01:48:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EAE8620266 for ; Sat, 6 Feb 2016 01:48:42 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id DF59E20225 for ; Sat, 6 Feb 2016 01:48:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C3E246E218; Fri, 5 Feb 2016 17:48:40 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id 17D496E218 for ; Fri, 5 Feb 2016 17:48:39 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 05 Feb 2016 17:48:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,403,1449561600"; d="scan'208";a="897429403" Received: from mpjoshi-mobl2.amr.corp.intel.com (HELO gibson.intel.com) ([10.252.140.202]) by fmsmga001.fm.intel.com with ESMTP; 05 Feb 2016 17:48:40 -0800 From: Ben Widawsky To: Intel GFX Date: Fri, 5 Feb 2016 17:48:37 -0800 Message-Id: <1454723317-31605-1-git-send-email-benjamin.widawsky@intel.com> X-Mailer: git-send-email 2.7.0 MIME-Version: 1.0 Cc: Ben Widawsky Subject: [Intel-gfx] [PATCH] drm/i915: Check for get_pages instead of shmem (filp) X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This behavior of checking for a shmem backed GEM object was introduced here: commit 4c914c0c7c787b8f730128a8cdcca9c50b0784ab Author: Brad Volkin Date: Tue Feb 18 10:15:45 2014 -0800 drm/i915: Refactor shmem pread setup It is possible for an object to not be a shmem backed GEM object (for example userptr objects). An example of how we hit this failure can be found through copy_batch() in the command parser because we allocate a userptr object for the batch which contains privileged instructions. Userptr calls drm_gem_private_object_init() which explicitly sets the filp to none. It is equally feasible to simply remove the check altogether. You'll probably oops with get_pages somewhere, but that's okay IMO because this condition should be a driver bug, and not trigger-able by userspace. On this note, the function name could probably benefit from a change, but whatever. NOTE: I manually retyped this from a test machine. So I haven't even compiled this exact patch. Cc: Chris Wilson Cc: Kristian Høgsberg Cc: Jordan Justen Signed-off-by: Ben Widawsky Tested-by: Jordan Justen Reviewed-by: Jordan Justen --- drivers/gpu/drm/i915/i915_gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 66b1705..a198928 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -489,7 +489,7 @@ int i915_gem_obj_prepare_shmem_read(struct drm_i915_gem_object *obj, *needs_clflush = 0; - if (!obj->base.filp) + if (!obj->ops->get_pages) return -EINVAL; if (!(obj->base.read_domains & I915_GEM_DOMAIN_CPU)) {