Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3376488ybi; Fri, 19 Jul 2019 02:15:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqxYVGhLm1ZuAIKNqU5AlJ/fOMakAS2f2Zjf86sJDBVQU1NURiQWdQaoLYsVDW20NE9vGNuT X-Received: by 2002:a17:902:6a2:: with SMTP id 31mr52931191plh.296.1563527742136; Fri, 19 Jul 2019 02:15:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563527742; cv=none; d=google.com; s=arc-20160816; b=IrL2Z0xsMjfQYDWB+nW01ZuRyclbPMekUKA481cRRI/je3FqKEqFDAfVsnrHYp2V4w UDJswue7RnrTJSjbUisWIVD2MTxBJwzW8y/fd+ojE1qCNJUUSNqFLncoSdEFyPEcmbWg sSIi+cbiH5Qxs7ZgMhGzvCbIrX0H/vm7hGmKFo4V4XrKdqfhWftJkJE37a1IpmYvdWHb iB+3GgySTKcTqbUlHZ3rbMP++HJSYnAxSu/iw82hedNZun/O73xB7S+qTEOLSvlVHHR9 VuTQ+Ede/lx6hXjzQm5TM3JD50rayei1n+/s/TBBHAFMLjFE73N9XHFnQT1sSBFZtVfr PeGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=Dy3eiftsHgEHO+bH2d+Vo7Yj2Uyc+Sk/TwZVrada+Bw=; b=qavS6puGg5XpLJ923qyvDt5Fx0pgCKm4jcpr06F8At+T3i1i/fZ71JVqTHTrSDsrkb U7q9UHJYC4Zp+YEwvHcdCAjy+EsK8cwovsH3nE8/Y+lHafm/V0c9KtRE3KeoUpQnkfed XIHm2Tph8M7Kee7J11yKcMdm9p1lB53FdGzwAT4DUkKggqN2lxF+63e87TPBrYGOZ6cG NaNdkWTBq9FxkHAKb9eQrB255cgU1BSmqm0ZQjothBboZNWWZ5QWgt54R7csbPxAKpPT HCkpD10/O922FpTDmW5N9nNu1Upbe8+6VGdmo8lbtbUo7ezlwQvFNsEYYYe5JYuVcPF0 75yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=NgzALEiE; 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 e129si1524955pgc.344.2019.07.19.02.15.25; Fri, 19 Jul 2019 02:15:42 -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 header.i=@ffwll.ch header.s=google header.b=NgzALEiE; 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 S1726893AbfGSJNT (ORCPT + 99 others); Fri, 19 Jul 2019 05:13:19 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:33499 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725794AbfGSJNT (ORCPT ); Fri, 19 Jul 2019 05:13:19 -0400 Received: by mail-ed1-f68.google.com with SMTP id i11so33853679edq.0 for ; Fri, 19 Jul 2019 02:13:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=Dy3eiftsHgEHO+bH2d+Vo7Yj2Uyc+Sk/TwZVrada+Bw=; b=NgzALEiEIP/wom8Q6GPOA1eTwCqfuDSwYRT4pTiN0svfxty8C46zOPR5oqWBl6sKYN c3tPHABjFwEJBusU078wzdryzWYwNGa6XkEBumqKeEoogixd5tOeF0yhtjpYLQ5f7P1Y F4yJCHJAwr+LS3OZyGjE2++8/S+TLAX14C0Wg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=Dy3eiftsHgEHO+bH2d+Vo7Yj2Uyc+Sk/TwZVrada+Bw=; b=jxZZjmVyqv2YpCVVFFl0iD8SO9E06+lYrTQebgSSjTirCUALqkmAXt+q/OMghwe0oC em9NpRG12jDIJff9wR6aolq12932tZeSuX3rSJXH1/GFvUO2aKj4klaTM0ShAhPLJgwI QL2C6ileCVxNQso4924EzsOsLM1+qlA8aR4fV9uc8WHXHwCjG5lcLlxu5zniippMyaPo i6zygG+6sWnMlKyG24edPgPl/ENpLHhn0zjnhGKwYNECm0rFepmwoDHRISPe0fBwjtsm WVuL0EUbmVEecXg4u7JOu4Xotg83+E7YITeoyxxOZCRNIDchS3p4Fy3Q61UKxcDAzJk0 kaPQ== X-Gm-Message-State: APjAAAW4NbXbp68PUKns3BMYjM9A0V5PDwwr428ShF7LWcBLbmD/eRFN y2nPM7XlT9b9Y5VKAWqS/BA= X-Received: by 2002:a50:e69a:: with SMTP id z26mr45147649edm.41.1563527597630; Fri, 19 Jul 2019 02:13:17 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id f24sm8699434edf.30.2019.07.19.02.13.16 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 19 Jul 2019 02:13:16 -0700 (PDT) Date: Fri, 19 Jul 2019 11:13:14 +0200 From: Daniel Vetter To: Rob Clark Cc: Eric Anholt , dri-devel , Chris Wilson , Intel Graphics Development , Rob Clark , David Airlie , Daniel Vetter , Emil Velikov , Eric Biggers , Deepak Sharma , Linux Kernel Mailing List Subject: Re: [PATCH v3 3/3] drm/vgem: use normal cached mmap'ings Message-ID: <20190719091314.GH15868@phenom.ffwll.local> Mail-Followup-To: Rob Clark , Eric Anholt , dri-devel , Chris Wilson , Intel Graphics Development , Rob Clark , David Airlie , Emil Velikov , Eric Biggers , Deepak Sharma , Linux Kernel Mailing List References: <20190716213746.4670-1-robdclark@gmail.com> <20190716213746.4670-3-robdclark@gmail.com> <87lfwxh7mo.fsf@anholt.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux phenom 4.19.0-5-amd64 User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 16, 2019 at 05:13:10PM -0700, Rob Clark wrote: > On Tue, Jul 16, 2019 at 4:39 PM Eric Anholt wrote: > > > > Rob Clark writes: > > > > > From: Rob Clark > > > > > > Since there is no real device associated with VGEM, it is impossible to > > > end up with appropriate dev->dma_ops, meaning that we have no way to > > > invalidate the shmem pages allocated by VGEM. So, at least on platforms > > > without drm_cflush_pages(), we end up with corruption when cache lines > > > from previous usage of VGEM bo pages get evicted to memory. > > > > > > The only sane option is to use cached mappings. > > > > This may be an improvement, but... > > > > pin/unpin is only on attaching/closing the dma-buf, right? So, great, > > you flushed the cached map once after exporting the vgem dma-buf to the > > actual GPU device, but from then on you still have no interface for > > getting coherent access through VGEM's mapping again, which still > > exists. > > In *theory* one would detach before doing further CPU access to > buffer, and then re-attach when passing back to GPU. > > Ofc that isn't how actual drivers do things. But maybe it is enough > for vgem to serve it's purpose (ie. test code). > > > I feel like this is papering over something that's really just broken, > > and we should stop providing VGEM just because someone wants to write > > dma-buf test code without driver-specific BO alloc ioctl code. > > yup, it is vgem that is fundamentally broken (or maybe more > specifically doesn't fit in w/ dma-mappings view of how to do cache > maint), and I'm just papering over it because people and CI systems > want to be able to use it to do some dma-buf tests ;-) > > I'm kinda wondering, at least for arm/dt based systems, if there is a > way (other than in early boot) that we can inject a vgem device node > into the dtb. That isn't a thing drivers should normally do, but (if > possible) since vgem is really just test infrastructure, it could be a > way to make dma-mapping happily think vgem is a real device. Or we just extend drm_cflush_pages with the cflushing we need (at least for those arms where this is possible, let's ignore the others) and accept for a few more years that dma-api doesn't fit? Note this would need to be a full copypasta of what the arch code has (since just exporting the function was shot down before), but I really don't care about the resulting wailing if we do this. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch