Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2953999ybi; Mon, 17 Jun 2019 13:25:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqwsj4g0TX0udhBbDrKdmsuDXc+THebzxZiklVla1Zwehn/ApD7owCaLA7tj8OMMuJxjqIZe X-Received: by 2002:a17:902:1e2:: with SMTP id b89mr89724815plb.7.1560803136704; Mon, 17 Jun 2019 13:25:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560803136; cv=none; d=google.com; s=arc-20160816; b=tKjZGPw4ecj64/jVOpZ+TtS+Wohna+9puTu8umPYmhyq86ERrivk9SN7vjhVnTkkv6 o5ca6loGzy7W+FNNg/lW5DaQUP3cAlAhVju0SzWTcQLqWvngfhEWwEWKf9p6n1upDORW 2Ii63lnFQSoXDwDdOb/4pO4ecXg3a20HGMdTcXfrN7l1IPDx3KMuN0Zxmh8vk9Qj4/KN tvlkwMVgG300QX19z0kt2FQNaReYs+lpiD3sh9TOmCb41m1FEqA5mq/nsF+++oOnUYQy 8tVgqEyVmGpdpIRp7K7bRq2lncn2s0HuRdN7hEaujc7uYTvWpRysbgOfeRNnQMSCTBBZ TBIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=zxqMnNyQRgtfQBPo/dIXU9o/Q4aRxbdJc19+JABq72M=; b=Uns/Gv09UTw8BXdlqtf9JEOHZkLjOUiAQiF/nJji69XgZUNrGkk75zOwgd43J8dYNq ICNS34KZudC681IE2U0J8PThGkylrT8ZKAxBjMKNsrc10JLJAsxthWYhvExFCRxmWGiF NXjgW51LfXPEoADSgN3sMd5OoC6r/9MYPkz0A4Ym/+pRlUMuMMQKmgekXrWY73zQN4QV tNace8dyzkvT2C6rQTJJwpe5ghyerx+iU7wPwCiKfSO3T50kKazy7HxA87CmtERALu/d ufVgHw6B63PINGYcwmHc1xx7h9yGqC4XG0E+2wUHZjjJQQGq/fe3IPdnY+oUs62XO7pS WiNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@shipmail.org header.s=mail header.b=mnafpFme; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j6si10746807pll.162.2019.06.17.13.25.21; Mon, 17 Jun 2019 13:25:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@shipmail.org header.s=mail header.b=mnafpFme; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728668AbfFQUY4 (ORCPT + 99 others); Mon, 17 Jun 2019 16:24:56 -0400 Received: from pio-pvt-msa1.bahnhof.se ([79.136.2.40]:53890 "EHLO pio-pvt-msa1.bahnhof.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726343AbfFQUYz (ORCPT ); Mon, 17 Jun 2019 16:24:55 -0400 X-Greylist: delayed 396 seconds by postgrey-1.27 at vger.kernel.org; Mon, 17 Jun 2019 16:24:55 EDT Received: from localhost (localhost [127.0.0.1]) by pio-pvt-msa1.bahnhof.se (Postfix) with ESMTP id 98259404EC; Mon, 17 Jun 2019 22:18:20 +0200 (CEST) Authentication-Results: pio-pvt-msa1.bahnhof.se; dkim=pass (1024-bit key; unprotected) header.d=shipmail.org header.i=@shipmail.org header.b=mnafpFme; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at bahnhof.se X-Spam-Flag: NO X-Spam-Score: -3.099 X-Spam-Level: X-Spam-Status: No, score=-3.099 tagged_above=-999 required=6.31 tests=[ALL_TRUSTED=-1, 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 wMzdDbcLcI35; Mon, 17 Jun 2019 22:18:05 +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 3E26F3F806; Mon, 17 Jun 2019 22:18:04 +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 BA38A360195; Mon, 17 Jun 2019 22:18:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=shipmail.org; s=mail; t=1560802684; bh=PScipI5AHw+qLkcTJBwlmyceItjajNZI6ZkbYCpIp5o=; h=From:To:Cc:Subject:Date:From; b=mnafpFmeQNH0EL9PxDDtoS88L4EEKidwRycfzY5O4F6w5cYXRS9jQd/8Sp41m7vbP IGa3xwnPcNIRFsIpwMtIL54qlzHImXSrhOKD0YrKYP4PMF8OYntCihTR0BEOx6vTCo WT3MhJYxH40T/yuSsoFkU1z+efK2N3j+ckFX8dPU= From: =?UTF-8?q?Thomas=20Hellstr=C3=B6m=20=28VMware=29?= To: dri-devel@lists.freedesktop.org Cc: linux-graphics-maintainer@vmware.com, pv-drivers@vmware.com, linux-kernel@vger.kernel.org Subject: [PATCH v7 0/9] Emulated coherent graphics memory Date: Mon, 17 Jun 2019 22:17:47 +0200 Message-Id: <20190617201756.12587-1-thomas@shipmail.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Planning to merge this through the drm/vmwgfx tree soon, so if there are any objections, please speak up. 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. This is a first attempt to do that for the vmwgfx driver. The mm patches has been out for RFC. I think I have addressed all the feedback I got, except a possible softdirty breakage. But although the dirty-tracking and softdirty may write-protect PTEs both care about, that shouldn't really cause any operation interference. In particular since we use the hardware dirty PTE bits and softdirty uses other PTE bits. 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%. Changes v1-v2: - Addressed a number of typos and formatting issues. - Added a usage warning for apply_to_pfn_range() and apply_to_page_range() - Re-evaluated the decision to use apply_to_pfn_range() rather than modifying the pagewalk.c. It still looks like generically handling the transparent huge page cases requires the mmap_sem to be held at least in read mode, so sticking with apply_to_pfn_range() for now. - The TTM page-fault helper vma copy argument was scratched in favour of a pageprot_t argument. Changes v3: - Adapted to upstream API changes. Changes v4: - Adapted to upstream mmu_notifier changes. (Jerome?) - Fixed a couple of warnings on 32-bit x86 - Fixed image offset computation on multisample images. Changes v5: - Updated usage warning in patch 3/9 after review comments from Nadav Amit. Changes v6: - Updated exports of new functionality in patch 3/9 to EXPORT_SYMBOL_GPL after review comments from Christoph Hellwig. Changes v7: - Re-added removed comment in ttm_bo_vm.c (Review by Hillf Danton) - Fixed an error path regression in ttm_bo_vm.c Cc: Andrew Morton Cc: Matthew Wilcox Cc: Will Deacon Cc: Peter Zijlstra Cc: Rik van Riel Cc: Minchan Kim Cc: Michal Hocko Cc: Huang Ying Cc: Souptick Joarder Cc: "Jérôme Glisse" Cc: "Christian König" Cc: linux-mm@kvack.org