From: geoff--- via iommu <iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>
To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: AMD Ryzen KVM/NPT/IOMMU issue
Date: Wed, 25 Oct 2017 07:16:46 +1100 [thread overview]
Message-ID: <f0680cfe52b9196ee4a1d3ab28a7aefa@hostfission.com> (raw)
In-Reply-To: <1b4a39530fde35783be63470003f0911-9M2dFRIgpjGrDvn5mFPilA@public.gmane.org>
I have isolated it to a single change, although I do not completely
understand what other implications it might have.
By just changing the line in `init_vmcb` that reads:
save->g_pat = svm->vcpu.arch.pat;
To:
save->g_pat = 0x0606060606060606;
This enables write back and performance jumps through the roof.
This needs someone with more experience to write a proper patch that
addresses this in a smarter way rather then just hard coding the value.
This patch looks like an attempt to fix this issue but it yields no
detectable performance gains.
https://patchwork.kernel.org/patch/6748441/
Any takers?
On 2017-10-25 06:08, geoff-9M2dFRIgpjGrDvn5mFPilA@public.gmane.org wrote:
> I have identified the issue! With NPT enabled I am now getting near
> bare
> metal performance with PCI pass through. The issue was with some stubs
> that have not been properly implemented. I will clean my code up and
> submit a patch shortly.
>
> This is a 10 year old bug that has only become evident with the recent
> ability to perform PCI pass-through with dedicated graphics cards. I
> would expect this to improve performance across most workloads that use
> AMD NPT.
>
> Here are some benchmarks to show what I am getting in my dev
> environment:
>
> https://www.3dmark.com/3dm/22878932
> https://www.3dmark.com/3dm/22879024
>
> -Geoff
>
>
> On 2017-10-24 16:15, geoff-9M2dFRIgpjGrDvn5mFPilA@public.gmane.org wrote:
>> Further to this I have verified that IOMMU is working fine, traces and
>> additional printk's added to the kernel module were used to check. All
>> accesses are successful and hit the correct addresses.
>>
>> However profiling under Windows shows there might be an issue with
>> IRQs
>> not reaching the guest. When FluidMark is running at 5fps I still see
>> excellent system responsiveness with the CPU 90% idle and the GPU load
>> at 6%.
>>
>> When switching PhysX to CPU mode the GPU enters low power mode,
>> indicating that the card is no longer in use. This would seem to
>> confirm that the GPU is indeed in use by the PhysX API correctly.
>>
>> My assumption now is that the IRQs from the video card are getting
>> lost.
>>
>> I could be completely off base here but at this point it seems like
>> the
>> best way to proceed unless someone cares to comment.
>>
>> -Geoff
>>
>>
>> On 2017-10-24 10:49, geoff-9M2dFRIgpjGrDvn5mFPilA@public.gmane.org wrote:
>>> Hi,
>>>
>>> I realize this is an older thread but I have spent much of today
>>> trying to
>>> diagnose the problem.
>>>
>>> I have discovered how to reliably reproduce the problem with very
>>> little effort.
>>> It seems that reproducing the issue has been hit and miss for people
>>> as it seems
>>> to primarily affect games/programs that make use of nVidia PhysX. My
>>> understanding of npt's inner workings is quite primitive but I have
>>> still spent
>>> much of my time trying to diagnose the fault and identify the cause.
>>>
>>> Using the free program FluidMark[1] it is possible to reproduce the
>>> issue, where
>>> on a GTX 1080Ti the rendering rate drops to around 4 fps with npt
>>> turned on, but
>>> if turned off the render rate is in excess of 60fps.
>>>
>>> I have produced traces for with and without ntp enabled during these
>>> tests which
>>> I can provide if it will help. So far I have been digging through how
>>> npt works
>>> and trying to glean as much information as I can from the source and
>>> the AMD
>>> specifications but much of this and how mmu works is very new to me
>>> so progress
>>> is slow.
>>>
>>> If anyone else has looked into this and has more information to share
>>> I would be
>>> very interested.
>>>
>>> Kind Regards,
>>> Geoffrey McRae
>>> HostFission
>>> https://hostfission.com
>>>
>>>
>>> [1]:
>>> http://www.geeks3d.com/20130308/fluidmark-1-5-1-physx-benchmark-fluid-sph-simulation-opengl-download/
next prev parent reply other threads:[~2017-10-24 20:16 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-23 23:49 AMD Ryzen KVM/NPT/IOMMU issue geoff--- via iommu
[not found] ` <b88fc14b230d7ecac6066bdd9e95be19-9M2dFRIgpjGrDvn5mFPilA@public.gmane.org>
2017-10-24 5:15 ` geoff--- via iommu
[not found] ` <cb2b1ee0a3b705e668ac3cf19cfa1ecc-9M2dFRIgpjGrDvn5mFPilA@public.gmane.org>
2017-10-24 19:08 ` geoff--- via iommu
[not found] ` <1b4a39530fde35783be63470003f0911-9M2dFRIgpjGrDvn5mFPilA@public.gmane.org>
2017-10-24 20:16 ` geoff--- via iommu [this message]
2017-10-24 21:31 ` Alex Williamson
[not found] ` <20171024233137.295a6b39-1yVPhWWZRC1BDLzU/O5InQ@public.gmane.org>
2017-10-24 21:39 ` geoff--- via iommu
[not found] ` <a909bd77b381f5beef6d74c97307265d-9M2dFRIgpjGrDvn5mFPilA@public.gmane.org>
2017-10-24 23:39 ` Nick Sarnie
-- strict thread matches above, loose matches on Subject: below --
2017-06-28 19:17 Graham Neville
2017-05-03 14:37 Matthias Ehrenfeuchter
[not found] ` <575f8fbc-0fdc-f336-e3da-53f27da4b2e1-5Zrl/DuVEGLQT0dZR+AlfA@public.gmane.org>
2017-05-03 16:28 ` Nick Sarnie
[not found] ` <CAOcCaLbdi9KZoXiV5htjShc_mYvZ5jK2B3Ot7NeM=3v_ZA39aA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-05-05 12:05 ` Matthias Ehrenfeuchter
2017-05-05 17:27 ` Alex Williamson
[not found] ` <20170505112706.7785948c-1yVPhWWZRC1BDLzU/O5InQ@public.gmane.org>
2017-06-25 5:55 ` Nick Sarnie
[not found] ` <CAOcCaLbAS0FkRrG8YZNM5rYUtCFeUGkdgdy=4o16Njufdy8Gag-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-28 17:23 ` Suravee Suthikulpanit
2017-06-28 17:26 ` Steven Walter
[not found] ` <CAK8d-aJ+XHi+5sr6bHj3D2BaG94v6Lyk1C_ZuA4erDVhEyp-uQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-28 18:53 ` Suravee Suthikulpanit
[not found] ` <5d2ea709-8f90-bfaa-975d-48aed39e75ad-5C7GfCeVMHo@public.gmane.org>
2017-06-28 19:08 ` Alex Williamson
[not found] ` <20170628130855.76c2b700-DGNDKt5SQtizQB+pC5nmwQ@public.gmane.org>
2017-06-28 19:28 ` Bridgman, John
2017-06-28 19:29 ` Bridgman, John
[not found] ` <BN6PR12MB13481A39CD3EA714754FEE49E8DD0-/b2+HYfkarQX0pEhCR5T8QdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-06-28 19:52 ` Graham Neville
[not found] ` <CAEk7i1-Ar0ES8ekmSGiRrrWzTz8gFb2RDTW6KsbuNdDubVerww-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-28 20:33 ` Paolo Bonzini
2017-06-28 22:34 ` Nick Sarnie
[not found] ` <CAOcCaLao_Y-8KP60baoSehtCu7C5CVnuuZNEom-zi54Fa2h+sQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-29 0:21 ` Thiago Padilha
[not found] ` <CAAq2Xdpu_rv7FgVfGCv-nYttGzH6hZujqdYvcf4qgXetkOGLzw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-29 1:50 ` Thiago Padilha
[not found] ` <CAAq2XdppNcKcmbJhPQ9WfTowKSmp76jhDa9JHM1rc92Enx=1Zg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-29 1:54 ` Nick Sarnie
2017-07-01 14:15 ` Thiago Padilha
2017-10-17 4:16 ` Nick Sarnie
[not found] ` <545f19a3-4923-cdec-4ce9-2a4155a04f6a-5C7GfCeVMHo@public.gmane.org>
2017-06-28 17:31 ` Alex Williamson
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=f0680cfe52b9196ee4a1d3ab28a7aefa@hostfission.com \
--to=iommu-cuntk1mwbs9qetfly7kem3xjstq8ys+chz5vsktnxna@public.gmane.org \
--cc=geoff-9M2dFRIgpjGrDvn5mFPilA@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