Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp313352ybl; Sun, 1 Dec 2019 03:05:10 -0800 (PST) X-Google-Smtp-Source: APXvYqyZydLIC7sC5qj4RbZdPm31hG+FEiT0owxP9s/89dTK9SEXZTkitRbVbOevn0DfeNTS69QV X-Received: by 2002:a05:6402:1251:: with SMTP id l17mr19263845edw.236.1575198310498; Sun, 01 Dec 2019 03:05:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575198310; cv=none; d=google.com; s=arc-20160816; b=xMoZTzRQ5+F4dH64SdKnyyEPiiI0MDgeQI6PQ288KG7XiuUQtyTsoXlGo/uEeYe9iX vyTLrECFDL+JpB983eJd0Ney8mCO4BPA21Tn+BSTklQMRs895gzllqXnXMcwmfs7EhbI rei3kPFpfV0CcqdyWhp0kanS0JtKqLv9rF4u40IiO7DrpiMNUij3q/K8xKeFnXCAZZGV 6gIHGZFYzhDnzAEY+1XsjXs/XcN8ZuIFHJQEO7Ame04/UrL5hHvK2WgMGY0BUVeBSTp2 RrMLMCxBSzWS3GmuC9V2z5b2GwJptV7OrhK6a2bMQ2AXskjFt31RLDAG+ty/I6odS7GE 1RDQ== 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:message-id:subject:cc :to:from:date:dkim-signature; bh=P0S0aNiZhUDcMgsUFhIruZb/8EnKELSIe5M3uXc7iyE=; b=0GouyC/UpnuKddoCR6Y1374R0U0l1fs9Rt01rZonoaunUCpMSg0KQZ0zwp0kw5E4Df 8IA+gm+VRta80Tqs4V5CZfxtABJ3EkVrRIal/oCjeSvmkFsyeVo0t3QFZ/wv6OxukbmE zlOLejS27mp5cyZPUNAvtFiYfimrPI/ri5CPyc9a3DBIsq8Am0yVp3R+UaNPZdCGjjRP u76/HSdcIsTciR77qrEGBnYmdEWny6ppNw2Zk2IMbkK0x9Gzq3u17C+sMFEQkRwg0FH/ nZ/omJIvqx96Q+sh1YpMEEK+yUVFu8R4liM7m7qa3GXiglHFQcv6OoylToKXGRHOQ4hj hcMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=d1dp5Fbs; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w2si19859651edf.32.2019.12.01.03.04.14; Sun, 01 Dec 2019 03:05:10 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=d1dp5Fbs; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726256AbfLAKqb (ORCPT + 99 others); Sun, 1 Dec 2019 05:46:31 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:33253 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726129AbfLAKqa (ORCPT ); Sun, 1 Dec 2019 05:46:30 -0500 Received: by mail-wr1-f68.google.com with SMTP id b6so10872628wrq.0 for ; Sun, 01 Dec 2019 02:46:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=P0S0aNiZhUDcMgsUFhIruZb/8EnKELSIe5M3uXc7iyE=; b=d1dp5FbskpIiq/Iltcoldq8H3LtOaBqEO5V50+j6IizbaQMBp8g66124ITLnJ6LIBG NAvP+MMt7VLRJiN4So2jLc0DyRQ6r95TV6LrbEcndeVfjmb6bZ1w3kbY3aGIhiyJSI73 0CZEx72oCIrIEYOHpF2SW9fNS4Vn5uhgjbl5juzDKYmeXzB0DJhgaVxQSIszNmNddocR HXIpDjK9lGKInTK7AAjEVfDZhUpUShRr4dOsM16yKiFITbiq6PAG1PTX6cCHchctm0k4 YfYfJW3MBZCK2BQlHZqy/WEYktws5nuJBlFYvD4J3PyILgchjdNjJH3ZaKSKxG/Ee+Mk Jj7g== 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 :references:mime-version:content-disposition:in-reply-to:user-agent; bh=P0S0aNiZhUDcMgsUFhIruZb/8EnKELSIe5M3uXc7iyE=; b=ESY4Mh6Bp5fNYKCBVSVNx8yawkY7O6u0ZWQ6xVlbrrn0LyY9AT5MhLtdyjjAQC//Ms hqUiVdq7ZrCSizvBclnG1a46LkGG+PUMBGxKbEe2aBZZTS2oLXsw9tQbygRjsgwpLkpD HZSRqBltFlKQYuTuIBnSOTBiH6OsdnvEdcC+LrbRAntOm+qfiRKyfqq7CWt752YCECma PJNQ3Vk3DGUFxz09onysj6I1Wvu9DiXA+BvWCqIAufW4jcwwN56MwiDZFAVjiXNSuqcO jg2DEU9w2Q6lTAq1D1n9x88VCbLa5OppQOL7n1Vt5KL/+g9t+HIhB+61TK1j7AK2l+A8 o2kQ== X-Gm-Message-State: APjAAAVQdiLRSBjYwlEt/XsZdZnp6NUGl9oK1b9RHaRcRc6Kespd2DM+ EPCQZwYdwy8F43mTArn+W2I= X-Received: by 2002:adf:e6c6:: with SMTP id y6mr3574256wrm.284.1575197187829; Sun, 01 Dec 2019 02:46:27 -0800 (PST) Received: from gmail.com (54033286.catv.pool.telekom.hu. [84.3.50.134]) by smtp.gmail.com with ESMTPSA id q5sm19624126wmc.27.2019.12.01.02.46.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Dec 2019 02:46:26 -0800 (PST) Date: Sun, 1 Dec 2019 11:46:24 +0100 From: Ingo Molnar To: Linus Torvalds Cc: mceier@gmail.com, Davidlohr Bueso , kernel test robot , Davidlohr Bueso , Thomas Gleixner , Peter Zijlstra , Borislav Petkov , LKML , lkp@lists.01.org, "Kenneth R. Crudup" Subject: Re: [x86/mm/pat] 8d04a5f97a: phoronix-test-suite.glmark2.0.score -23.7% regression Message-ID: <20191201104624.GA51279@gmail.com> References: <20191127005312.GD20422@shao2-debian> <20191130212729.ykxstm5kj2p5ir6q@linux-p48b> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 * Linus Torvalds wrote: > On Sat, Nov 30, 2019 at 2:09 PM Mariusz Ceier wrote: > > > > Contents of /sys/kernel/debug/x86/pat_memtype_list on master > > (32ef9553635ab1236c33951a8bd9b5af1c3b1646) where performance is > > degraded: > > Diff between good and bad case: > > @@ -1,8 +1,8 @@ > PAT memtype list: > write-back @ 0x55ba4000-0x55ba5000 > write-back @ 0x5e88c000-0x5e8b5000 > -write-back @ 0x5e8b4000-0x5e8b8000 > write-back @ 0x5e8b4000-0x5e8b5000 > +write-back @ 0x5e8b4000-0x5e8b8000 > write-back @ 0x5e8b7000-0x5e8bb000 > write-back @ 0x5e8ba000-0x5e8bc000 > write-back @ 0x5e8bb000-0x5e8be000 > @@ -21,15 +21,15 @@ > uncached-minus @ 0xec260000-0xec264000 > uncached-minus @ 0xec300000-0xec320000 > uncached-minus @ 0xec326000-0xec327000 > -uncached-minus @ 0xf0000000-0xf0001000 > uncached-minus @ 0xf0000000-0xf8000000 > +uncached-minus @ 0xf0000000-0xf0001000 > uncached-minus @ 0xfdc43000-0xfdc44000 > uncached-minus @ 0xfe000000-0xfe001000 > uncached-minus @ 0xfed00000-0xfed01000 > uncached-minus @ 0xfed10000-0xfed16000 > uncached-minus @ 0xfed90000-0xfed91000 > -write-combining @ 0x2000000000-0x2100000000 > -write-combining @ 0x2000000000-0x2100000000 > +uncached-minus @ 0x2000000000-0x2100000000 > +uncached-minus @ 0x2000000000-0x2100000000 > uncached-minus @ 0x2100000000-0x2100001000 > uncached-minus @ 0x2100001000-0x2100002000 > uncached-minus @ 0x2ffff10000-0x2ffff20000 > > the first two differences are just trivial ordering differences for > overlapping ranges (starting at 0x5e8b4000 and 0xf0000000) > respectively. > > But the final difference is a real difference where it used to be WC, > and is now UC-: > > -write-combining @ 0x2000000000-0x2100000000 > -write-combining @ 0x2000000000-0x2100000000 > +uncached-minus @ 0x2000000000-0x2100000000 > +uncached-minus @ 0x2000000000-0x2100000000 > > which certainly could easily explain the huge performance degradation. Indeed, as two days ago I speculated to Kenneth R. Crudup who reported a similar slowdown on i915: > * Ingo Molnar wrote: > > > * Kenneth R. Crudup wrote: > > > > > > > As soon as the i915 driver module is loaded, it takes over the > > > > EFI framebuffer on my machine (HP Spectre X360 with Intel UHD620 > > > > Graphics) and the subsequent text (as well as any VTs) is > > > > rendered much more slowly. I don't know if the i915/DRM guys need > > > > to do anything to their code to take advantage of this change to > > > > the PATs, but reverting this change (after the associated > > > > subseqent commits) has fixed that issue for me. > > > > > > > > Let me know if you need any further info. > > > > > > This is almost certainly the PAT bits being wrong in the > > > pagetables, i.e. an x86 bug, not a GPU driver bug. > > > > > > > > > Davidlohr, any idea what's going on? The interval tree conversion went > > > bad. The slowdown symptoms are consistent with perhaps the framebuffer > > > not getting WC mapped, but uncacheable mapped: > > > > > > ptr = io_mapping_map_wc(&i915_vm_to_ggtt(vma->vm)->iomap, > > > vma->node.start, > > > vma->node.size); > > > > > > Which is a wrapper around ioremap_wc(). > > > > > > To debug this it would be useful to do a before/after comparison of the > > > kernel pagetables: > > > > > > - before: git checkout 8d04a5f97a^1 > > > - after: git checkout 8d04a5f97a And yesterday: > [...] > > There's another similar bugreport of a -20% GL performance drop, from > the ktest automated benchmark suite: > > https://lkml.kernel.org/r/20191127005312.GD20422@shao2-debian > > My shot-in-the-dark hypothesis is that perhaps we somehow fail to find > a newly mapped memtype and leave a key ioremap_wc() area uncached, > instead of write-combining? > > The order of magnitude of the slowdown would be roughly consistent with > that, in GPU limited workloads - it would be more marked in 3D scenes > with a lot of vertices or perhaps a lot of texture changes. > > But this is really just a random guess. It's not an unconditional regression, as both Boris and me tried to reproduce it on different systems that do ioremap_wc() as well and didn't measure a slowdown, but something about the memory layout probably triggers the tree management bug. Thanks, Ingo