All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Dave Airlie <airlied@gmail.com>
Cc: "Dan Williams" <dan.j.williams@intel.com>,
	"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
	"Shawn Starr" <shawn.starr@rogers.com>,
	"Michel Dänzer" <michel@daenzer.net>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Subject: Re: mm: fix cache mode tracking in vm_insert_mixed() breaks AMDGPU [was: Re: Latest testing with drm-next-4.9-wip and latest LLVM/mesa stack - Regression in PowerPlay/DPM on CIK?]
Date: Tue, 18 Oct 2016 09:39:14 +0200	[thread overview]
Message-ID: <20161018073914.GV20761@phenom.ffwll.local> (raw)
In-Reply-To: <CAPM=9tx5ayYzTk8hm-c8JaWReNEQ3yem-r4ac5r8bFuQXzOwiA@mail.gmail.com>

On Tue, Oct 18, 2016 at 08:01:01AM +1000, Dave Airlie wrote:
> On 18 October 2016 at 07:25, Dan Williams <dan.j.williams@intel.com> wrote:
> > On Sun, Oct 16, 2016 at 1:53 PM, Dave Airlie <airlied@gmail.com> wrote:
> >> On 17 October 2016 at 04:41, Marek Olšák <maraeo@gmail.com> wrote:
> >>> On Fri, Oct 14, 2016 at 3:33 AM, Michel Dänzer <michel@daenzer.net> wrote:
> >>>>
> >>>> [ Adding Dan Williams and dri-devel ]
> >>>>
> >>>> On 14/10/16 03:28 AM, Shawn Starr wrote:
> >>>>> Hello AMD folks,
> >>>>>
> >>>>> I have discovered a problem in Linus master that affects AMDGPU, nobody would
> >>>>> notice this in drm-next-4.9-wip since its not in this repo.
> >>>>
> >>>> [...]
> >>>>
> >>>>> 87744ab3832b83ba71b931f86f9cfdb000d07da5 is the first bad commit
> >>>>> commit 87744ab3832b83ba71b931f86f9cfdb000d07da5
> >>>>> Author: Dan Williams <dan.j.williams@intel.com>
> >>>>> Date:   Fri Oct 7 17:00:18 2016 -0700
> >>>>>
> >>>>>     mm: fix cache mode tracking in vm_insert_mixed()
> >>>>>
> >>>>>     vm_insert_mixed() unlike vm_insert_pfn_prot() and vmf_insert_pfn_pmd(),
> >>>>>     fails to check the pgprot_t it uses for the mapping against the one
> >>>>>     recorded in the memtype tracking tree.  Add the missing call to
> >>>>>     track_pfn_insert() to preclude cases where incompatible aliased mappings
> >>>>>     are established for a given physical address range.
> >>>>>
> >>>>>     Link: http://lkml.kernel.org/r/
> >>>>> 147328717909.35069.14256589123570653697.stgit@dwillia2-
> >>>>> desk3.amr.corp.intel.com
> >>>>>     Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> >>>>>     Cc: David Airlie <airlied@linux.ie>
> >>>>>     Cc: Matthew Wilcox <mawilcox@microsoft.com>
> >>>>>     Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
> >>>>>     Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> >>>>>     Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
> >>>>>
> >>>>> :040000 040000 7517c0019fe49c1830b5a1d81f1dc099c5aab98a
> >>>>> fd497a604a2af5995db2b8ed1e9c640bede6adf3 M      mm
> >>>>>
> >>>>>
> >>>>> Removal of this patch stops graphics stalls.
> >>>>
> >>>> Thanks for bisecting this Shawn.
> >>>>
> >>>>
> >>>>> A friend of mine mentions,
> >>>>>
> >>>>> "looks like a graphics thingy you depend on is requesting a mapping with a
> >>>>> not-allowed cache mode, and now you are (rightfully) getting errors?"
> >>>>
> >>>> It would be nice to get some more specific pointers what amdgpu (or
> >>>> maybe ttm, since that calls vm_insert_mixed in ttm_bo_vm_fault) might be
> >>>> doing wrong.
> >>
> >>        /*
> >>          * We'd like to use VM_PFNMAP on shared mappings, where
> >>          * (vma->vm_flags & VM_SHARED) != 0, for performance reasons,
> >>          * but for some reason VM_PFNMAP + x86 PAT + write-combine is very
> >>          * bad for performance. Until that has been sorted out, use
> >>          * VM_MIXEDMAP on all mappings. See freedesktop.org bug #75719
> >>          */
> >>         vma->vm_flags |= VM_MIXEDMAP;
> >>
> >> We have that comment in the ttm code, which to me implies that mixed is
> >> doing the right thing now, but that is slow, as the interface we
> >> should be using.
> >>
> >
> > Aren't there only 2 possibilities for this regression?
> >
> > 1/ a memtype entry was never made so track_pfn_insert() returns an
> > uncached mapping
> >
> > 2/ a conflicting memtype entry exists and undefined behavior due to
> > mixed mapping types is avoided with the change.
> 
> 3/ The CPU usage through this path goes up, and slows things down,
> though I suspect you it's more an uncached mapping showing up
> when we don't expect it.

Sounds reasonable, at least we (=i915 folks) known pte caching type
tracking is ridiculously expensive. In 4.9 we have our own pte walker and
upfront (at driver load) caching type checking to avoid all that. It's in
i915_mm.c, but probably should be moved into core kernel code (next to the
io_mapping stuff, which we reused as the tracking structure).
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

      parent reply	other threads:[~2016-10-18  7:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-10 19:43 Latest testing with drm-next-4.9-wip and latest LLVM/mesa stack - Regression in PowerPlay/DPM on CIK? Shawn Starr
2016-10-10 20:55 ` Shawn Starr
2016-10-10 23:36   ` Shawn Starr
2016-10-13 18:28     ` mm: fix cache mode tracking in vm_insert_mixed() breaks AMDGPU [was: Re: Latest testing with drm-next-4.9-wip and latest LLVM/mesa stack - Regression in PowerPlay/DPM on CIK?] Shawn Starr
2016-10-14  1:33       ` Michel Dänzer
     [not found]         ` <10a1e298-df32-52a5-7694-b205794ca009-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-10-16 18:41           ` Marek Olšák
2016-10-16 20:53             ` Dave Airlie
2016-10-17 21:25               ` Dan Williams
2016-10-17 22:01                 ` Dave Airlie
2016-10-18  3:48                   ` Dave Airlie
2016-10-18 13:53                     ` Dan Williams
2016-10-19  6:42                       ` Dave Airlie
2016-10-19 10:33                         ` Marek Olšák
2016-10-20  1:11                           ` Michel Dänzer
     [not found]                             ` <2ebd438d-21e6-cee8-3062-0ef84ab6c347-otUistvHUpPR7s880joybQ@public.gmane.org>
2016-10-20  9:06                               ` Marek Olšák
2016-10-18  7:39                   ` Daniel Vetter [this message]

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=20161018073914.GV20761@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dan.j.williams@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=michel@daenzer.net \
    --cc=shawn.starr@rogers.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.