Message ID | 20190918125914.38497-1-thomas_os@shipmail.org (mailing list archive) |
---|---|
Headers | show
Return-Path: <SRS0=QF98=XN=kvack.org=owner-linux-mm@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 B6D1A196C for <patchwork-linux-mm@patchwork.kernel.org>; Wed, 18 Sep 2019 12:59:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 76FB3218AF for <patchwork-linux-mm@patchwork.kernel.org>; Wed, 18 Sep 2019 12:59:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=shipmail.org header.i=@shipmail.org header.b="XVUzl5dD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 76FB3218AF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shipmail.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 0CD8E6B02A8; Wed, 18 Sep 2019 08:59:37 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0847C6B02AA; Wed, 18 Sep 2019 08:59:37 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ED55E6B02AB; Wed, 18 Sep 2019 08:59:36 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0124.hostedemail.com [216.40.44.124]) by kanga.kvack.org (Postfix) with ESMTP id AFD606B02A8 for <linux-mm@kvack.org>; Wed, 18 Sep 2019 08:59:36 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 40D6F1A4C7 for <linux-mm@kvack.org>; Wed, 18 Sep 2019 12:59:36 +0000 (UTC) X-FDA: 75948047952.30.space31_53b59161c2e12 X-Spam-Summary: 2,0,0,54c9dc5bcae46cc5,d41d8cd98f00b204,thomas_os@shipmail.org,:linux-kernel@vger.kernel.org:dri-devel@lists.freedesktop.org::pv-drivers@vmware.com:linux-graphics-maintainer@vmware.com:thellstrom@vmware.com:akpm@linux-foundation.org:willy@infradead.org:will.deacon@arm.com:peterz@infradead.org:riel@surriel.com:minchan@kernel.org:mhocko@suse.com:ying.huang@intel.com:jrdr.linux@gmail.com:jglisse@redhat.com:christian.koenig@amd.com:hch@infradead.org,RULES_HIT:41:152:355:379:541:800:960:968:973:988:989:1260:1261:1277:1311:1313:1314:1345:1431:1437:1515:1516:1518:1535:1543:1593:1594:1676:1711:1730:1747:1777:1792:2198:2199:2393:2559:2562:2693:2731:3138:3139:3140:3141:3142:3355:3865:3866:3867:3868:3870:3871:3872:3874:4250:5007:6119:6261:6653:6742:7514:7576:7875:7903:7974:10004:10400:11026:11232:11658:11914:12043:12296:12297:12517:12519:12679:13161:13229:13894:14181:14394:14659:14721:21080:21451:21627:21740:21809:30012:30034:30054:30064:30069:30091,0,RBL:79.136.2.42:@sh ipmail.o X-HE-Tag: space31_53b59161c2e12 X-Filterd-Recvd-Size: 5977 Received: from pio-pvt-msa3.bahnhof.se (pio-pvt-msa3.bahnhof.se [79.136.2.42]) by imf20.hostedemail.com (Postfix) with ESMTP for <linux-mm@kvack.org>; Wed, 18 Sep 2019 12:59:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by pio-pvt-msa3.bahnhof.se (Postfix) with ESMTP id CAF1E3F869; Wed, 18 Sep 2019 14:59:28 +0200 (CEST) Authentication-Results: pio-pvt-msa3.bahnhof.se; dkim=pass (1024-bit key; unprotected) header.d=shipmail.org header.i=@shipmail.org header.b=XVUzl5dD; dkim-atps=neutral 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-msa3.bahnhof.se ([127.0.0.1]) by localhost (pio-pvt-msa3.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tHoB48kMniVl; Wed, 18 Sep 2019 14:59:25 +0200 (CEST) Received: from mail1.shipmail.org (h-205-35.A357.priv.bahnhof.se [155.4.205.35]) (Authenticated sender: mb878879) by pio-pvt-msa3.bahnhof.se (Postfix) with ESMTPA id 8C7A03F85E; Wed, 18 Sep 2019 14:59:24 +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 E06C236020A; Wed, 18 Sep 2019 14:59:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=shipmail.org; s=mail; t=1568811564; bh=nHZ5nrGPkMFImxWZGWHwng2aQcVr1Cjrduddths8zV8=; h=From:To:Cc:Subject:Date:From; b=XVUzl5dDcqXwgp/9N8S33Dj/Zw+iZxamTyBGTvfwNYoDtCBZxacLKdPszdMZ82MTr Zm5DSQSrR7Ma9rJip6E08bAy/6dQdW3WWRnNWh+mxC6yJUp0Eda44lBzFHJz9uED7k TUVSxGL6qZs601VCYABY16qidqUwAvUhH/PRoGNA= 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 Cc: pv-drivers@vmware.com, linux-graphics-maintainer@vmware.com, =?utf-8?q?T?= =?utf-8?q?homas_Hellstr=C3=B6m?= <thellstrom@vmware.com>, Andrew Morton <akpm@linux-foundation.org>, Matthew Wilcox <willy@infradead.org>, Will Deacon <will.deacon@arm.com>, Peter Zijlstra <peterz@infradead.org>, Rik van Riel <riel@surriel.com>, Minchan Kim <minchan@kernel.org>, Michal Hocko <mhocko@suse.com>, Huang Ying <ying.huang@intel.com>, Souptick Joarder <jrdr.linux@gmail.com>, =?utf-8?b?SsOpcsO0bWUgR2xpc3Nl?= <jglisse@redhat.com>, =?utf-8?q?Christian_?= =?utf-8?q?K=C3=B6nig?= <christian.koenig@amd.com>, Christoph Hellwig <hch@infradead.org> Subject: [PATCH 0/7] Emulated coherent graphics memory take 2 Date: Wed, 18 Sep 2019 14:59:07 +0200 Message-Id: <20190918125914.38497-1-thomas_os@shipmail.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.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. For the TTM changes they are hopefully in line with the long-term strategy of making helpers out of what's left of TTM. 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. 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>