Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp110339ybi; Tue, 16 Jul 2019 17:14:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqws1HtuhCbcYTHDyqHMSpNaWjEi3rPKmqmq8bwlEur/13waszTIdZj9gSuHUblBSxrqIuRT X-Received: by 2002:a17:90a:3270:: with SMTP id k103mr38531664pjb.54.1563322482692; Tue, 16 Jul 2019 17:14:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563322482; cv=none; d=google.com; s=arc-20160816; b=ySJwhJNPLA+opOppFPbPi0HVGMmZd8YugGMKxMW9JB9GiUldI1MdVhcy8TNj4BA9SF kxGp+W8CMk+JBKEUAJtwbOlXPnURqjL7FU9hvc0y8NHm6awwLHsApvjakV3b99Ol4+Nt 4Q01sqpcbs9m8UBqMb2dw5lLpiAg9AlRq+LiD24KtTLlUCWaTwj3ao1KTMYDDgNCaw0E W6r5iOJGTOIQlOZxZw0Gy/2UHViaUpONUFVbq9oJkw/Up0QH3+MjcGPlg+o2Gkf2aH/k NeWIErvRPj9CiCSt23C0mh/iabJ9L4prz+hXuTc5ww4REvQ/IEAJT7POcPe+GKfnDRHk 1ONQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=D/eYjZgozPvgUajffWeA6V7Zmj+rx5wYX1ns8tvrFbI=; b=SqyDCqqv103/+sCxGnTsQGL2z+rSOZSJAQR/umESRRSXOKXljhDILpDOuUGTIgs6GI b1lz3CBhFMgnKzXlyhaLQ16ADS3vjac1skpOVQ7LqPAIUjN9ty+NMPnajUIRovk9x3OH 9a6V36tmTDUnRaZ6EWzmcmBwrjuvtaju9eawPF5W1sBjXMFvIyryZ/ijsIiVqZL6u04i wZsDY5JAcD8gqICWl0sykITcSaO9lYMMdsfTYrwZ4qbuSLG6DBemD4+ZBPP7hthUM07q W8HcjnAdhx67y/tXUTKUOc8XNddDojDOv2Ft+NcHCS1QfAnGaoE3F3Ch+DEhup2d/AGy DgCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RR2GArgA; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x21si19894326pjt.37.2019.07.16.17.14.26; Tue, 16 Jul 2019 17:14: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=pass header.i=@gmail.com header.s=20161025 header.b=RR2GArgA; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389027AbfGQANX (ORCPT + 99 others); Tue, 16 Jul 2019 20:13:23 -0400 Received: from mail-ed1-f66.google.com ([209.85.208.66]:44627 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728235AbfGQANX (ORCPT ); Tue, 16 Jul 2019 20:13:23 -0400 Received: by mail-ed1-f66.google.com with SMTP id k8so22640127edr.11 for ; Tue, 16 Jul 2019 17:13:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=D/eYjZgozPvgUajffWeA6V7Zmj+rx5wYX1ns8tvrFbI=; b=RR2GArgAq8SesCevWMlZ5weS7j9gS98QGvXopun5L+UMHZUEPYDRk7AR/hrFKt2KFl 3VNfgodCd8uXhPrO4XxCDQ2MG29ysjEOy6uPp3vv7bF74W6m+oPGR90Ourw+MKZJUzM5 8pBDtTwWh8prYLzslqKOH0QEA+7njMI9z7kGUAlir6GHXr3ybP+rkZ4huzQ8QbY0SGeX xr4/4LAMBS2Q9OrUarPlsFPMDTnBlWfaFlS64HCXZuoSW7kDHtLF6p7oEHH4yMSkYRaV E7LC/1VEvDBR4r8tN4TmUxj4B3rZ8rH4z+5Z5EkYlH18TOM0uSrtrVcHxt5ZUl6bT15Z abeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=D/eYjZgozPvgUajffWeA6V7Zmj+rx5wYX1ns8tvrFbI=; b=bDDzlbmg1Cl5XZNYTmrXYWNe5WM3npdZt4Jpup5NhlmggPZWS091CS61BCe150II81 edjUPG498k+CPO8r+gItRXavqfdRm8g8aY3/Jcr9tw6JZ4kyVrS4oSdVmQBV0lwEjINu +eWPKNMUFzUNaBE9s1yMX2E0DnBjs8ooCBZWU6TfngUu9C3t8ZV4j/aCQhIfImGZp38M nLMZwGttox2Xp4Xcz5S021FXW+7KEKJ9xci0j+29UcdCK9CAimoXQKZeZ7obwhhL5znB JhqvBiJgCFfN+X0PZ4ZZ/1C+ooRxOZPP0ZI8V7WlkG6i0V/VVpW3d5MG+E/r7S5dohvr jFNg== X-Gm-Message-State: APjAAAV21CIWCjs2LT22+bbcIjhKsxRKQUhuJ6fIUN4Rv3U9kssWcvAf j6S3A0I/IaVXX0JoXqGrV9kzc9dcA1FULzbeFdg= X-Received: by 2002:a50:9177:: with SMTP id f52mr32148765eda.294.1563322401427; Tue, 16 Jul 2019 17:13:21 -0700 (PDT) MIME-Version: 1.0 References: <20190716213746.4670-1-robdclark@gmail.com> <20190716213746.4670-3-robdclark@gmail.com> <87lfwxh7mo.fsf@anholt.net> In-Reply-To: <87lfwxh7mo.fsf@anholt.net> From: Rob Clark Date: Tue, 16 Jul 2019 17:13:10 -0700 Message-ID: Subject: Re: [PATCH v3 3/3] drm/vgem: use normal cached mmap'ings To: Eric Anholt Cc: dri-devel , Chris Wilson , Intel Graphics Development , Rob Clark , David Airlie , Daniel Vetter , Emil Velikov , Eric Biggers , Deepak Sharma , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" 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 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. BR, -R