From patchwork Fri Sep 6 12:20:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 11135187 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 5FE1A15E6 for ; Fri, 6 Sep 2019 12:21:08 +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 47D50206CD for ; Fri, 6 Sep 2019 12:21:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 47D50206CD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de 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 9A3016E27F; Fri, 6 Sep 2019 12:21:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by gabe.freedesktop.org (Postfix) with ESMTPS id 380DA6E280 for ; Fri, 6 Sep 2019 12:21:02 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 8B7C8AE5C; Fri, 6 Sep 2019 12:20:59 +0000 (UTC) From: Thomas Zimmermann To: daniel@ffwll.ch, noralf@tronnes.org, airlied@linux.ie, rong.a.chen@intel.com, feng.tang@intel.com, ying.huang@intel.com, sean@poorly.run, maxime.ripard@bootlin.com, maarten.lankhorst@linux.intel.com, dave@stgolabs.net, kraxel@redhat.com Subject: [PATCH v4 0/4] Implement lazy unmapping for GEM VRAM buffers Date: Fri, 6 Sep 2019 14:20:52 +0200 Message-Id: <20190906122056.32018-1-tzimmermann@suse.de> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 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: Thomas Zimmermann , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Generic fbdev emulation maps and unmaps the console BO for updating it's content from the shadow buffer. If this involves an actual mapping operation (instead of reusing an existing mapping), lots of debug messages may be printed, such as x86/PAT: Overlap at 0xd0000000-0xd1000000 x86/PAT: reserve_memtype added [mem 0xd0000000-0xd02fffff], track write-combining, req write-combining, ret write-combining x86/PAT: free_memtype request [mem 0xd0000000-0xd02fffff] as reported at [1]. Drivers using VRAM helpers may also see reduced performance as the mapping operations can create overhead. In v3 and later of the patch set, this problem is being solved by lazily unmapping the buffer as suggested by Gerd. Unmapping with drm_gem_vram_kunmap() only changes a reference counter. VRAM helpers later perform the unmapping operation when TTM evicts the buffer object from its current location. If the buffer is never evicted, the existing mapping is reused by later calls to drm_gem_vram_kmap(). v4: * lock kmap with ttm_bo_reserve() * acquire lock only once for vmap() * warn about stale mappings during buffer cleanup v3: * implement lazy unmapping v2: * fixed comment typos [1] https://lists.freedesktop.org/archives/dri-devel/2019-September/234308.html Thomas Zimmermann (4): drm/vram: Add kmap ref-counting to GEM VRAM objects drm/vram: Acquire lock only once per call to vmap()/vunmap() drm/vram: Add infrastructure for move_notify() drm/vram: Implement lazy unmapping for GEM VRAM buffers drivers/gpu/drm/drm_gem_vram_helper.c | 229 ++++++++++++++++++-------- drivers/gpu/drm/drm_vram_mm_helper.c | 12 ++ include/drm/drm_gem_vram_helper.h | 18 ++ include/drm/drm_vram_mm_helper.h | 4 + 4 files changed, 198 insertions(+), 65 deletions(-) Reviewed-by: Gerd Hoffmann --- 2.23.0