Message ID | 20190926115548.44000-1-thomas_os@shipmail.org (mailing list archive) |
---|---|
Headers | show
Return-Path: <SRS0=y8WL=XV=lists.freedesktop.org=dri-devel-bounces@kernel.org> 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 462F614ED for <patchwork-dri-devel@patchwork.kernel.org>; Thu, 26 Sep 2019 11:56:06 +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 2DBE8222BE for <patchwork-dri-devel@patchwork.kernel.org>; Thu, 26 Sep 2019 11:56:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2DBE8222BE 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 097506ECCF; Thu, 26 Sep 2019 11:56:05 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from pio-pvt-msa1.bahnhof.se (pio-pvt-msa1.bahnhof.se [79.136.2.40]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2FD4A6ECDC for <dri-devel@lists.freedesktop.org>; Thu, 26 Sep 2019 11:56:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by pio-pvt-msa1.bahnhof.se (Postfix) with ESMTP id A8D263F715; Thu, 26 Sep 2019 13:56:02 +0200 (CEST) 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-msa1.bahnhof.se ([127.0.0.1]) by localhost (pio-pvt-msa1.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WDsAyHNrQ3C6; Thu, 26 Sep 2019 13:56:01 +0200 (CEST) Received: from mail1.shipmail.org (h-205-35.A357.priv.bahnhof.se [155.4.205.35]) (Authenticated sender: mb878879) by pio-pvt-msa1.bahnhof.se (Postfix) with ESMTPA id B2F303F6F6; Thu, 26 Sep 2019 13:55:56 +0200 (CEST) Received: from localhost.localdomain.localdomain (h-205-35.A357.priv.bahnhof.se [155.4.205.35]) by mail1.shipmail.org (Postfix) with ESMTPSA id DD602360311; Thu, 26 Sep 2019 13:55:55 +0200 (CEST) From: =?utf-8?q?Thomas_Hellstr=C3=B6m_=28VMware=29?= <thomas_os@shipmail.org> To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mm@kvack.org Subject: [PATCH v2 0/5] Emulated coherent graphics memory take 2 Date: Thu, 26 Sep 2019 13:55:43 +0200 Message-Id: <20190926115548.44000-1-thomas_os@shipmail.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=shipmail.org; s=mail; t=1569498956; bh=sSyG1uzep6Io+55nV8hhwYEwrrW+pXAnmhIE4329T4s=; h=From:To:Cc:Subject:Date:From; b=I3LkGRaLhcuaKFJs3wQ/Ifyy+mgUG1d6eQUd1f+JgFOlmoZowj1oHWzReXYhiT/yJ XrUHyb8jp+8t+/vNHwz95vUyUN6OHFyVLz3Pt8O8idMK6yK7NAngaupy2kxaTPvSUe Xw0vxEj9DkrNdum02gtR69pWj4ig+4RiOv9eAO04= X-Mailman-Original-Authentication-Results: pio-pvt-msa1.bahnhof.se; dkim=pass (1024-bit key; unprotected) header.d=shipmail.org header.i=@shipmail.org header.b="I3LkGRaL"; dkim-atps=neutral X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development <dri-devel.lists.freedesktop.org> List-Unsubscribe: <https://lists.freedesktop.org/mailman/options/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=unsubscribe> List-Archive: <https://lists.freedesktop.org/archives/dri-devel> List-Post: <mailto:dri-devel@lists.freedesktop.org> List-Help: <mailto:dri-devel-request@lists.freedesktop.org?subject=help> List-Subscribe: <https://lists.freedesktop.org/mailman/listinfo/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=subscribe> Cc: =?utf-8?q?Thomas_Hellstr=C3=B6m?= <thellstrom@vmware.com>, Michal Hocko <mhocko@suse.com>, Rik van Riel <riel@surriel.com>, pv-drivers@vmware.com, Minchan Kim <minchan@kernel.org>, Will Deacon <will.deacon@arm.com>, Matthew Wilcox <willy@infradead.org>, Christoph Hellwig <hch@infradead.org>, Peter Zijlstra <peterz@infradead.org>, =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= <jglisse@redhat.com>, linux-graphics-maintainer@vmware.com, Souptick Joarder <jrdr.linux@gmail.com>, Huang Ying <ying.huang@intel.com>, Andrew Morton <akpm@linux-foundation.org>, =?utf-8?q?Christian_K=C3=B6nig?= <christian.koenig@amd.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" <dri-devel-bounces@lists.freedesktop.org> |
Series |
Emulated coherent graphics memory take 2
|
expand
|
From: Thomas Hellström <thellstrom@vmware.com> 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 has signaled. Paravirtual drivers that otherwise require explicit synchronization needs to do this by hooking up dirty tracking to pagefault handlers and buffer object validation. The mm patch page walk interface has been reworked to be similar to the reworked page-walk code (mm/pagewalk.c). There have been two other solutions to consider: 1) Using the page-walk code. That is currently not possible since it requires the mmap-sem to be held for the struct vm_area_struct vm_flags and for huge page splitting. The pagewalk code in this patchset can't hold the mmap sems since it will lead to locking inversion. We have an established locking order mmap_sem -> dma_reservation -> i_mmap_lock, whereas holding the mmap_sem in this case would require dma_reservation -> i_mmap_lock -> mmap_sem. Instead it uses an operation mode similar to unmap_mapping_range() where the i_mmap_lock is held. 2) Using apply_to_page_range(). The primary use of this code is to fill page tables. The operation modes are IMO sufficiently different to motivate re-implementing the page-walk. 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%. I would like to merge this code through the DRM tree, so an ack to include the new mm helpers in that merge would be greatly appreciated. Changes since RFC: - Merge conflict changes moved to the correct patch. Fixes intra-patchset compile errors. - Be more aggressive when turning ttm vm code into helpers. This makes sure we can use a const qualifier on the vmwgfx vm_ops. - Reinstate a lost comment an fix an error path that was broken when turning the ttm vm code into helpers. - Remove explicit type-casts of struct vm_area_struct::vm_private_data - Clarify the locking inversion that makes us not being able to use the mm pagewalk code. Changes since v1: - Removed the vmwgfx maintainer entry for as_dirty_helpers.c, updated commit message accordingly - Removed the TTM patches from the series as they are merged separately through DRM. Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Matthew Wilcox <willy@infradead.org> Cc: Will Deacon <will.deacon@arm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Rik van Riel <riel@surriel.com> Cc: Minchan Kim <minchan@kernel.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Huang Ying <ying.huang@intel.com> Cc: Souptick Joarder <jrdr.linux@gmail.com> Cc: Jérôme Glisse <jglisse@redhat.com> Cc: Christian König <christian.koenig@amd.com> Cc: Christoph Hellwig <hch@infradead.org>