From patchwork Fri Dec 23 14:57:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9487489 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 74D0E601D7 for ; Fri, 23 Dec 2016 14:58:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6791925D9E for ; Fri, 23 Dec 2016 14:58:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5CAED26212; Fri, 23 Dec 2016 14:58:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4188525D9E for ; Fri, 23 Dec 2016 14:58:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1DBCA6E069; Fri, 23 Dec 2016 14:58:35 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wj0-x241.google.com (mail-wj0-x241.google.com [IPv6:2a00:1450:400c:c01::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id D4F046E069; Fri, 23 Dec 2016 14:58:13 +0000 (UTC) Received: by mail-wj0-x241.google.com with SMTP id j10so40601678wjb.3; Fri, 23 Dec 2016 06:58:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mr/briHidjEGNQ7GVe8kD0hHxm5OwPrPGc48Mwu4N/g=; b=Nw8aZmOeDKNm0SJ3HHwdXuLmanOfKJFUJ4MrgoWl/6R1QJL34ojeM89LaQqOquGQWO QgaCNu8sbwQMX0IESNe35A1r5Galmf+VQp1XS+P6Sffuj0+zNP7fefZGqxI2CPddJVmj vxHdYQ05nH51FKRbYY689/J7q2NvbbEa6i+rgMil+k4cjTDPsUhKdI08D68v/v/ta0k9 g7XTFszBac7ntUf9QsV5hapaPpmJWMeSpZ6pd/nlCaPKPjb+m3NUUNt/LavYL/NNI8y1 ca2WY66odr4fnWSwtIFHYg/nftubg/gGb9WvLDWZa8OFdakX8E+AG8xVRr8HDqCvSAxq zRQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=mr/briHidjEGNQ7GVe8kD0hHxm5OwPrPGc48Mwu4N/g=; b=HlBY0QSC46SVvFtX2OB2hXu/E0Wk3C2Mqlnt9dyPWvYNPZA6Aoyf4/gUoty5rTpMSV rWUelDpd7eEL0R3JLvUzo9xZhupjzFRZlfWXxX63QWqwyjb9EuqQXbC92+ze3IIIPdj7 N3UYT9xxx1JHacpNnW5LDpafrjVgDsvsVWNO/OXmg/c8Lg77xc4q+GwGa+CXDDHkU8mf d5hK0FdvIWcdVjwZEsaMbQ+kcHGixDZC8s0Ot8QrpTzdf8knSZDm6NjdJ1IXstpL9WEK MqC64q8aIage0ZLOpeT6ddqtJcVq7ATlyJZEQvbTAar7hDM4XTSSUCiTVjr2L8zpP8qK RuHQ== X-Gm-Message-State: AIkVDXLqDV2fgG70G+dqVLZlyZWBaMZlo/oz70HKBHWg5DhzyhtmiprftavybfTvW626dw== X-Received: by 10.194.26.103 with SMTP id k7mr12983328wjg.157.1482505091836; Fri, 23 Dec 2016 06:58:11 -0800 (PST) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id i15sm40786462wjs.16.2016.12.23.06.58.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Dec 2016 06:58:11 -0800 (PST) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 23 Dec 2016 14:57:57 +0000 Message-Id: <20161223145804.6605-3-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20161223145804.6605-1-chris@chris-wilson.co.uk> References: <20161223145804.6605-1-chris@chris-wilson.co.uk> MIME-Version: 1.0 Cc: drm-intel-fixes@lists.freedesktop.org Subject: [Intel-gfx] [PATCH 03/10] drm/i915: Don't clflush before release phys object 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-Virus-Scanned: ClamAV using ClamSMTP When we teardown the backing storage for the phys object, we copy from the coherent contiguous block back to the shmemfs object, clflushing as we go. Trying to clflush the invalid sg beforehand just oops and would be redundant (due to it already being coherent, and clflushed afterwards). Reported-by: Ville Syrjälä Signed-off-by: Chris Wilson Cc: Joonas Lahtinen Cc: Reviewed-by: Joonas Lahtinen --- drivers/gpu/drm/i915/i915_gem.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index bdb37bd3813b..09185d431b52 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -246,14 +246,16 @@ i915_gem_object_get_pages_phys(struct drm_i915_gem_object *obj) static void __i915_gem_object_release_shmem(struct drm_i915_gem_object *obj, - struct sg_table *pages) + struct sg_table *pages, + bool needs_clflush) { GEM_BUG_ON(obj->mm.madv == __I915_MADV_PURGED); if (obj->mm.madv == I915_MADV_DONTNEED) obj->mm.dirty = false; - if ((obj->base.read_domains & I915_GEM_DOMAIN_CPU) == 0 && + if (needs_clflush && + (obj->base.read_domains & I915_GEM_DOMAIN_CPU) == 0 && !cpu_cache_is_coherent(obj->base.dev, obj->cache_level)) drm_clflush_sg(pages); @@ -265,7 +267,7 @@ static void i915_gem_object_put_pages_phys(struct drm_i915_gem_object *obj, struct sg_table *pages) { - __i915_gem_object_release_shmem(obj, pages); + __i915_gem_object_release_shmem(obj, pages, false); if (obj->mm.dirty) { struct address_space *mapping = obj->base.filp->f_mapping; @@ -2232,7 +2234,7 @@ i915_gem_object_put_pages_gtt(struct drm_i915_gem_object *obj, struct sgt_iter sgt_iter; struct page *page; - __i915_gem_object_release_shmem(obj, pages); + __i915_gem_object_release_shmem(obj, pages, true); i915_gem_gtt_finish_pages(obj, pages);