From patchwork Wed Nov 13 13:16:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Hellstr=C3=B6m_=28Intel=29?= X-Patchwork-Id: 11241887 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D6C5A17E6 for ; Wed, 13 Nov 2019 13:16:57 +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 BF9A3222CD for ; Wed, 13 Nov 2019 13:16:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF9A3222CD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shipmail.org 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 AF8116ECF7; Wed, 13 Nov 2019 13:16:55 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from pio-pvt-msa2.bahnhof.se (pio-pvt-msa2.bahnhof.se [79.136.2.41]) by gabe.freedesktop.org (Postfix) with ESMTPS id C8BBB6ECF7 for ; Wed, 13 Nov 2019 13:16:53 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by pio-pvt-msa2.bahnhof.se (Postfix) with ESMTP id E51163F99D; Wed, 13 Nov 2019 14:16:51 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at bahnhof.se X-Spam-Flag: NO X-Spam-Score: -2.099 X-Spam-Level: X-Spam-Status: No, score=-2.099 tagged_above=-999 required=6.31 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no Received: from pio-pvt-msa2.bahnhof.se ([127.0.0.1]) by localhost (pio-pvt-msa2.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HmZ8Miue-o1C; Wed, 13 Nov 2019 14:16:50 +0100 (CET) Received: from mail1.shipmail.org (h-205-35.A357.priv.bahnhof.se [155.4.205.35]) (Authenticated sender: mb878879) by pio-pvt-msa2.bahnhof.se (Postfix) with ESMTPA id 7C1B63F746; Wed, 13 Nov 2019 14:16:48 +0100 (CET) Received: from localhost.localdomain.localdomain (h-205-35.A357.priv.bahnhof.se [155.4.205.35]) by mail1.shipmail.org (Postfix) with ESMTPSA id 9C9B6360103; Wed, 13 Nov 2019 14:16:48 +0100 (CET) From: =?utf-8?q?Thomas_Hellstr=C3=B6m_=28VMware=29?= To: airlied@gmail.com, airlied@redhat.com, daniel@ffwll.ch Subject: [git pull] vmwgfx-coherent Date: Wed, 13 Nov 2019 14:16:39 +0100 Message-Id: <20191113131639.4653-1-thomas_os@shipmail.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=shipmail.org; s=mail; t=1573651008; bh=hPRmi7iTKdK9xV42gkXyaFtIzln/DfJZiBUhuyFNgSw=; h=From:To:Cc:Subject:Date:From; b=Rl9bzSjb4z7jqnji5hE9rzz0bK7y/8aQYtRY5LODZnpdzugHfS2nHkdkMSzfcQkYC S7tiJFgCQsVOUXcpT8iSROrZY3BvhlKTQ02NUNoIDREft1sMrhPkKyzGuRdYj68NCM rXJdL8LlUhH3bTvnhS+y2bHPGI/g9vtZCw+cgA5Y= X-Mailman-Original-Authentication-Results: pio-pvt-msa2.bahnhof.se; dkim=pass (1024-bit key; unprotected) header.d=shipmail.org header.i=@shipmail.org header.b=Rl9bzSjb; dkim-atps=neutral X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Thomas_Hellstr=C3=B6m?= , linux-graphics-maintainer@vmware.com, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Dave, Daniel, Take 2 of the coherent memory patches are now ready for pulling. Following the discussion we had after the last merge attempt that had to be reverted, it might make sense to send this to Linus as a pull request separate from other DRM stuff. This time Linus has been heavily involved in the outcome of the -mm patches, and Andrew Morton has acked them for merging through DRM: https://lore.kernel.org/r/20191105195114.f75be5e76763da5546121b41@linux-foundation.org/ If you think it's too late for the 5.5 merge window, deferring to 5.6 is not a problem. There is a dependency on drm-misc: This needs to be merged after drm-misc caa478af4812, to avoid a compilation error. Cover message: Graphics APIs like OpenGL 4.4 and Vulkan require the graphics driver to provide coherent graphics memory, meaning that the GPU sees any content written to the coherent memory on the next GPU operation that touches that memory, and the CPU sees any content written by the GPU to that memory immediately after any fence object trailing the GPU operation is signaled. Paravirtual drivers that otherwise require explicit synchronization needs to do this by hooking up dirty tracking to pagefault handlers and buffer object validation. Provide mm helpers needed for this and that also allow for huge pmd- and pud entries (patch 1-3), and the associated vmwgfx code (patch 4-7). The code has been tested and exercised by a tailored version of mesa where we disable all explicit synchronization and assume graphics memory is coherent. The performance loss varies of course; a typical number is around 5%. The following changes since commit 7aef29f4d4613570f413301b0807ea66a21f5e3b: drm/ttm: Convert vm callbacks to helpers (2019-11-06 13:02:00 +0100) are available in the Git repository at: git://people.freedesktop.org/~thomash/linux vmwgfx-coherent for you to fetch changes up to 9ca7d19ff8ba6207bccab46536814fe4839df80a: drm/vmwgfx: Add surface dirty-tracking callbacks (2019-11-06 15:45:32 +0100) ---------------------------------------------------------------- Thomas Hellstrom (8): mm: Remove BUG_ON mmap_sem not held from xxx_trans_huge_lock() mm: pagewalk: Take the pagetable lock in walk_pte_range() mm: Add a walk_page_mapping() function to the pagewalk code mm: Add write-protect and clean utilities for address space ranges drm/vmwgfx: Implement an infrastructure for write-coherent resources drm/vmwgfx: Use an RBtree instead of linked list for MOB resources drm/vmwgfx: Implement an infrastructure for read-coherent resources drm/vmwgfx: Add surface dirty-tracking callbacks drivers/gpu/drm/vmwgfx/Kconfig | 1 + drivers/gpu/drm/vmwgfx/Makefile | 2 +- .../drm/vmwgfx/device_include/svga3d_surfacedefs.h | 233 +++++++++- drivers/gpu/drm/vmwgfx/vmwgfx_bo.c | 10 +- drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 44 +- drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 1 - drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c | 488 +++++++++++++++++++++ drivers/gpu/drm/vmwgfx/vmwgfx_resource.c | 193 +++++++- drivers/gpu/drm/vmwgfx/vmwgfx_resource_priv.h | 13 + drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 395 ++++++++++++++++- drivers/gpu/drm/vmwgfx/vmwgfx_ttm_glue.c | 15 +- drivers/gpu/drm/vmwgfx/vmwgfx_validation.c | 74 +++- drivers/gpu/drm/vmwgfx/vmwgfx_validation.h | 16 +- include/linux/huge_mm.h | 2 - include/linux/mm.h | 13 +- include/linux/pagewalk.h | 9 + include/uapi/drm/vmwgfx_drm.h | 4 +- mm/Kconfig | 3 + mm/Makefile | 1 + mm/mapping_dirty_helpers.c | 315 +++++++++++++ mm/pagewalk.c | 99 ++++- 21 files changed, 1875 insertions(+), 56 deletions(-) create mode 100644 drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c create mode 100644 mm/mapping_dirty_helpers.c