From: geoff@hostfission.com Subject: Found workaround/fix for ntp on AMD systems with PCI passthrough Date: Wed, 25 Oct 2017 08:50:43 +1100 Message-ID: <6af47870f44a208b8bcaca284573a857@hostfission.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit To: kvm@vger.kernel.org Return-path: Received: from mail1.hostfission.com ([139.99.139.48]:50474 "EHLO mail1.hostfission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751277AbdJXVup (ORCPT ); Tue, 24 Oct 2017 17:50:45 -0400 Received: from www1.hostfission.com (www1.hostfission.com [139.99.139.52]) by mail1.hostfission.com (Postfix) with ESMTP id 644C142334 for ; Wed, 25 Oct 2017 08:50:43 +1100 (AEDT) Sender: kvm-owner@vger.kernel.org List-ID: Hi All, I have spent the last few days attempting to track down the cause of the performance degradation when ntp is enabled on AMD-Vi systems and VGA pass through. A few hours ago I identified why Intel is working and AMD is not and found a work around that fixes the problem, I am now seeing near native performance with ntp enabled on an AMD Ryzen platform. https://www.3dmark.com/3dm/22878932 https://www.3dmark.com/3dm/22879024 Since my understanding of hardware at this level on this platform is limited it needs a guru to take this and implement a fix or perhaps even a quirk that can be enabled to work around this problem. In svm.c, by just changing the line in `init_vmcb` that reads: save->g_pat = svm->vcpu.arch.pat; To: save->g_pat = 0x0606060606060606; The problem is resolved. From what I understand this is setting a MTTR value that enables Write Back (WB). Since finding this gem I found the following patch set also: https://patchwork.kernel.org/patch/6748441/ This doesn't fix the problem but it seems to be heading in the right direction. -Geoff