From: Balbir Singh <balbirs@nvidia.com>
To: "Christian König" <christian.koenig@amd.com>,
"Bert Karwatzki" <spasswolf@web.de>
Cc: Ingo Molnar <mingo@kernel.org>, Kees Cook <kees@kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>,
Andy Lutomirski <luto@kernel.org>,
Alex Deucher <alexander.deucher@amd.com>,
linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org
Subject: Re: commit 7ffb791423c7 breaks steam game
Date: Wed, 26 Mar 2025 09:45:43 +1100 [thread overview]
Message-ID: <261e7069-9f65-4a89-95cb-25c224ff04f1@nvidia.com> (raw)
In-Reply-To: <938c2cbd-c47f-4925-ba82-94eef54d9ebc@amd.com>
On 3/25/25 18:35, Christian König wrote:
> Am 24.03.25 um 23:48 schrieb Balbir Singh:
>>>> lspci -v reports 8G of memory at 0xfc00000000 so I assmumed that is the GPU RAM.
>>>> 03:00.0 Display controller: Advanced Micro Devices, Inc. [AMD/ATI] Navi 23
>>>> [Radeon RX 6600/6600 XT/6600M] (rev c3)
>>>> Subsystem: Micro-Star International Co., Ltd. [MSI] Device 1313
>>>> Flags: bus master, fast devsel, latency 0, IRQ 107, IOMMU group 14
>>>> Memory at fc00000000 (64-bit, prefetchable) [size=8G]
>>>> Memory at fe00000000 (64-bit, prefetchable) [size=256M]
>>>> Memory at fca00000 (32-bit, non-prefetchable) [size=1M]
>>>> Expansion ROM at fcb00000 [disabled] [size=128K]
>>> Well when you set nokaslr then that moves the BAR address of the dGPU above the limit the integrated GPU can access on the bus (usually 40 bits).
>>>
>>> Because of this the integrated GPU starts to fallback to system memory below the 4GB limit to make sure that the stuff is always accessible by everyone.
>> Why does it fallback to GPU_DMA32? Is the rest of system memory not usable (upto 40 bits)?
>
> We need to guarantee that we don't run into using bounce buffers since the high level APIs doesn't necessarily inform the kernel about the state transitions for that.
>
So effectively on larger systems (CPUs with more than 40 bits of addressing, the iGPU has to
always go through the DMA32 window)?
>> I did not realize that the iGPU is using the BAR memory of the dGPU.
>
> When the displayed content is rendered by the dGPU but the monitor connected to the iGPU you somehow need to get the image to the iGPU.
>
> The most efficient approach is that the iGPU copies the image from the dGPUs BAR directly into memory it can scanout from.
>
> Alternatively we can allocate some system memory, the dGPU copies the image into that and then iGPU then copies the image into the scanout buffer.
>
> Some newer hardware can also directly scan out from that system memory and so avoiding that extra copy. But this has a bunch of pre-requisites, for example IOMMU needs to be disabled or in pass through mode.
>
>> I guess the issue goes away when amdgpu.gttsize is set to 2GB, because 2GB fits in the DMA32 window
>
> Well I would not say that the issue goes away, it just makes your symptoms go away.
Agreed
>
> The trick is that the gttsize is what we give to the Steam game as maximum amount of system memory it can allocate. So it most likely stays below that and so the extra system memory buffer for scanout can also fit below 4GB.
>
>>> Since the memory below 4GB is very very limited we are now starting to constantly swap things in and out of that area. Basically completely killing the performance of your Steam game.
>>>
>>> As far as I can see till that point the handling is completely intentional and working as expected.
>>>
>>> The only thing which eludes me is why setting nokaslr changes the BAR of the dGPU? Can I get the full dmesg with and with nokasl?
>>>
>> IIRC, the iGPU does not work correctly, the dGPU does, so it's an iGPU addressing constraint?
>
> The problem is more that the iGPU doesn't have any local memory, but rather just uses (potentially stolen) system memory.
>
> But the questions remains: Why does the BAR move around? That should most likely not happen.
>
The second region seems to be additional, I suspect that is HMM mapping from kgd2kfd_init_zone_device()
Balbir Singh
> Regards,
> Christian.
>
>> Balbir
>>
>
next prev parent reply other threads:[~2025-03-25 22:45 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-22 12:23 Bert Karwatzki
2025-03-23 6:51 ` Balbir Singh
2025-03-24 11:23 ` Bert Karwatzki
2025-03-24 12:14 ` Christian König
2025-03-24 22:48 ` Balbir Singh
[not found] ` <938c2cbd-c47f-4925-ba82-94eef54d9ebc@amd.com>
2025-03-25 22:45 ` Balbir Singh [this message]
2025-03-25 23:21 ` Bert Karwatzki
2025-03-25 23:43 ` Balbir Singh
2025-03-26 1:50 ` Balbir Singh
2025-03-26 10:10 ` Bert Karwatzki
2025-03-26 10:36 ` Balbir Singh
2025-03-26 11:14 ` Bert Karwatzki
2025-03-27 10:53 ` Ingo Molnar
2025-03-27 22:03 ` Balbir Singh
2025-03-24 21:43 ` Balbir Singh
-- strict thread matches above, loose matches on Subject: below --
2025-03-25 10:14 Bert Karwatzki
2025-03-25 12:23 ` Christian König
2025-03-26 22:00 ` Bert Karwatzki
2025-03-26 22:58 ` Linus Torvalds
2025-03-27 0:57 ` Balbir Singh
2025-03-27 0:58 ` Bert Karwatzki
2025-03-27 10:40 ` Ingo Molnar
2025-03-24 23:07 Bert Karwatzki
[not found] ` <634e77d7-4f3c-4d1a-8aa3-1978896f9bf2@amd.com>
2025-03-25 10:25 ` Balbir Singh
2025-03-10 11:22 Bert Karwatzki
2025-03-10 21:48 ` Balbir Singh
2025-03-11 7:19 ` Balbir Singh
2025-03-11 7:28 ` Ingo Molnar
2025-03-11 11:15 ` Bert Karwatzki
2025-03-11 18:24 ` Bert Karwatzki
2025-03-11 22:10 ` Balbir Singh
2025-03-11 23:09 ` Bert Karwatzki
2025-03-12 0:26 ` Bert Karwatzki
2025-03-12 2:23 ` Balbir Singh
2025-03-12 1:24 ` Balbir Singh
2025-03-13 9:22 ` Bert Karwatzki
2025-03-13 10:40 ` Balbir Singh
2025-03-13 10:53 ` Bert Karwatzki
2025-03-13 11:47 ` Balbir Singh
2025-03-13 18:12 ` Bert Karwatzki
2025-03-13 21:54 ` Balbir Singh
2025-03-13 22:22 ` Bert Karwatzki
2025-03-14 6:14 ` Balbir Singh
2025-03-14 13:34 ` Balbir Singh
2025-03-14 14:18 ` Bert Karwatzki
2025-03-15 0:16 ` Balbir Singh
2025-03-15 17:40 ` Alex Deucher
2025-03-16 13:09 ` Bert Karwatzki
2025-03-16 20:06 ` Bert Karwatzki
2025-03-17 9:13 ` Balbir Singh
2025-03-20 9:01 ` Ingo Molnar
2025-03-20 23:55 ` Balbir Singh
2025-03-21 10:24 ` Ingo Molnar
2025-03-21 11:05 ` Balbir Singh
2025-03-22 8:04 ` Ingo Molnar
2025-03-22 9:40 ` Balbir Singh
2025-03-20 23:43 ` Bert Karwatzki
2025-03-21 4:55 ` Balbir Singh
2025-03-21 12:26 ` Bert Karwatzki
2025-03-22 2:06 ` Balbir Singh
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=261e7069-9f65-4a89-95cb-25c224ff04f1@nvidia.com \
--to=balbirs@nvidia.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=bhelgaas@google.com \
--cc=christian.koenig@amd.com \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=spasswolf@web.de \
--cc=torvalds@linux-foundation.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
all inboxes | Powered by JetHome®