iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Jerome Glisse <j.glisse-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: "Christian König" <christian.koenig-5C7GfCeVMHo@public.gmane.org>
Cc: Tom St Denis <tom.stdenis-5C7GfCeVMHo@public.gmane.org>,
	"Deucher,
	Alexander" <Alexander.Deucher-5C7GfCeVMHo@public.gmane.org>,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: Feature Request: Ability to decode bus/dma address back into physical address
Date: Wed, 2 Aug 2017 14:36:41 -0400	[thread overview]
Message-ID: <20170802183641.GA4035@gmail.com> (raw)
In-Reply-To: <4f00e033-7a08-e54f-4b64-2813d5f25b5b-5C7GfCeVMHo@public.gmane.org>

On Wed, Aug 02, 2017 at 08:18:02PM +0200, Christian König wrote:
> Am 02.08.2017 um 19:33 schrieb Jerome Glisse:
> > On Wed, Aug 02, 2017 at 07:23:58PM +0200, Christian König wrote:
> > > Am 02.08.2017 um 19:13 schrieb Jerome Glisse:
> > > > On Wed, Aug 02, 2017 at 07:05:11PM +0200, Christian König wrote:
> > > > > Am 02.08.2017 um 18:43 schrieb Jerome Glisse:
> > > > > > On Wed, Aug 02, 2017 at 10:26:40AM +0200, Christian König wrote:
> > > > > > > [SNIP]
> > > > > > So to summarize you are saying you do not trust the value you get from
> > > > > > pci_map_page() ?
> > > > > Well, what we don't trust is that we actually get this value correctly into
> > > > > our page tables.
> > > > > 
> > > > > > If not then i stress again that you have all the informations you need
> > > > > > inside the amdgpu driver. You can take the same scheme i propose to
> > > > > > dump ttm.dma_address[] and compare against content of GPU page table.
> > > > > Yes, exactly. But then again we have the mapping page to dma-address
> > > > > (because that is what drivers usually need), but what we need for debugging
> > > > > is a map with the info dma-address to page.
> > > > Why would you need the reverse ? You have a GPU virtual address do the following:
> > > > GPU vaddr -> GPU page table entrie -> bus address
> > > > GPU vaddr -> bo_va_mapping -> bo_va -> bo -> page -> dma/bus address
> > > First of all the VM housekeeping structures keep the state as it is supposed
> > > to be on the next command submission and so the top of the pipeline, but the
> > > state of the page tables represent to bottom of the pipeline.
> > > 
> > > Second you can't access the BO from it's virtual address, the BO mapping is
> > > protected by the BO reservation lock. So when I want to lockup the BO I
> > > would need to lock the BO first - chicken and egg problem. That is of course
> > > solvable, but not something I would really like to do for a debugging
> > > feature.
> > Tom said that the GPU is stop and thus there is nothing happening to the vm
> > nor any of the bo right ? So there is no need to protect anything. If you
> > still allow thing to change vm (map/unmap bo ...) how do you expect to debug ?
> 
> Well the GPU is stuck (or manually stopped), but keep in mind that this is a
> very deep pipeline we are talking about here.
> 
> So even if there isn't any processing happening in the hardware any more
> there can still state changes queued up waiting for processing (or even new
> one added).
> 

I am familiar with how it all works. Vm are protected by fences so a
vm that is in use will be protected from bind/unbind if GPU is stop only
and update to virtual address space of that vm might also be block if
they were to happen through some GPU ring and not from CPU.

To me it looks like you want to know if GPU is accessing what was meant
to be access and i believe what i have outline allow that. Compare current
GPU page table entry with valid mapping.

Thus i do not see any value in trying to get bus -> page, especialy that
once you get the page you can't know to which bo it belongs without going
over all ttm tt objects and even then it might be an already "freed" page
from ttm point of view.

Jérôme

  parent reply	other threads:[~2017-08-02 18:36 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-01 10:07 Feature Request: Ability to decode bus/dma address back into physical address Tom St Denis
     [not found] ` <8379cf5a-7539-e221-c678-20f617fb4337-5C7GfCeVMHo@public.gmane.org>
2017-08-01 17:25   ` Jerome Glisse
     [not found]     ` <30eb1ecb-c86f-4d3b-cd49-e002f46e582d@amd.com>
     [not found]       ` <30eb1ecb-c86f-4d3b-cd49-e002f46e582d-5C7GfCeVMHo@public.gmane.org>
2017-08-01 18:04         ` Jerome Glisse
     [not found]           ` <483ecda0-2977-d2ea-794c-320e429d7645@amd.com>
     [not found]             ` <483ecda0-2977-d2ea-794c-320e429d7645-5C7GfCeVMHo@public.gmane.org>
2017-08-01 19:03               ` Jerome Glisse
     [not found]                 ` <42c5fe2b-f179-cb71-03d3-7ae991543edb@amd.com>
     [not found]                   ` <42c5fe2b-f179-cb71-03d3-7ae991543edb-5C7GfCeVMHo@public.gmane.org>
2017-08-01 19:55                     ` Jerome Glisse
     [not found]                       ` <20170801195556.GD3443-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-01 20:26                         ` Tom St Denis
     [not found]                           ` <77e557d2-aa75-46c4-88a7-cca5448ea08e-5C7GfCeVMHo@public.gmane.org>
2017-08-01 20:43                             ` Deucher, Alexander
2017-08-01 21:01                             ` Jerome Glisse
     [not found]                               ` <20170801210105.GE3443-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-01 21:38                                 ` Tom St Denis
     [not found]                                   ` <2cd345ee-d5ad-1ad7-508a-86225e65621c-5C7GfCeVMHo@public.gmane.org>
2017-08-02  4:42                                     ` Jerome Glisse
     [not found]                                       ` <20170802044214.GA6285-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-02  8:26                                         ` Christian König
     [not found]                                           ` <4a2b004b-ebc2-9331-84c4-4e6672dd7b97-5C7GfCeVMHo@public.gmane.org>
2017-08-02 16:43                                             ` Jerome Glisse
     [not found]                                               ` <20170802164343.GA3105-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-02 17:05                                                 ` Christian König
     [not found]                                                   ` <5ecbb5c2-fe4e-fd84-43b5-67ae06c5a032-5C7GfCeVMHo@public.gmane.org>
2017-08-02 17:13                                                     ` Jerome Glisse
     [not found]                                                       ` <20170802171303.GB3105-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-02 17:23                                                         ` Christian König
     [not found]                                                           ` <d4a6ad38-522c-2928-2ef1-1f7cd2267c4e-5C7GfCeVMHo@public.gmane.org>
2017-08-02 17:33                                                             ` Jerome Glisse
     [not found]                                                               ` <20170802173311.GC3105-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-02 18:18                                                                 ` Christian König
     [not found]                                                                   ` <4f00e033-7a08-e54f-4b64-2813d5f25b5b-5C7GfCeVMHo@public.gmane.org>
2017-08-02 18:36                                                                     ` Jerome Glisse [this message]
2017-08-02 18:42                                                     ` Robin Murphy
     [not found]                                                       ` <2f9da712-1559-6593-e512-c0508e21d747-5wv7dgnIgG8@public.gmane.org>
2017-08-02 19:25                                                         ` Tom St Denis
2017-08-01 20:43                         ` Alex Williamson
     [not found]                           ` <20170801144320.63bda17d-DGNDKt5SQtizQB+pC5nmwQ@public.gmane.org>
2017-08-01 21:38                             ` Tom St Denis
     [not found]                               ` <aa08a829-b472-cc39-b1a3-6a7d01f64da1-5C7GfCeVMHo@public.gmane.org>
2017-08-01 22:42                                 ` Alex Williamson
     [not found]                                   ` <20170801164250.3bae6436-DGNDKt5SQtizQB+pC5nmwQ@public.gmane.org>
2017-08-04  9:43                                     ` Joerg Roedel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170802183641.GA4035@gmail.com \
    --to=j.glisse-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=Alexander.Deucher-5C7GfCeVMHo@public.gmane.org \
    --cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=tom.stdenis-5C7GfCeVMHo@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).