From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: KVM: How does is PAT emulation supposed to work? Date: Mon, 13 Apr 2015 07:16:24 +0200 Message-ID: <552B5128.4010909@siemens.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit To: kvm Return-path: Received: from thoth.sbs.de ([192.35.17.2]:41160 "EHLO thoth.sbs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750708AbbDMFQ1 (ORCPT ); Mon, 13 Apr 2015 01:16:27 -0400 Received: from mail2.siemens.de (localhost [127.0.0.1]) by thoth.sbs.de (8.14.3/8.14.3) with ESMTP id t3D5GPcY013128 for ; Mon, 13 Apr 2015 07:16:25 +0200 Received: from md1f2u6c.ww002.siemens.net (md1czxqc.ww300.siemens.net [139.22.39.75]) by mail2.siemens.de (8.14.3/8.14.3) with SMTP id t3D5GPiZ020541 for ; Mon, 13 Apr 2015 07:16:25 +0200 Sender: kvm-owner@vger.kernel.org List-ID: Hi all, while digging into the PAT topic for Jailhouse, I also wondered how KVM deals with it. And I'm still not getting it complete - or there is a bug: KVM intercepts all guest writes to the PAT MSR and instead keeps the guest value in vcpu->arch.pat. But, besides returning that value back on read accesses, arch.pat has no other purpose. On Intel, we only seem to have proper emulation - through hardware - when VMX supports PAT switching (see vmx_set_msr). On AMD, the situation is even worse as the g_pat save field is not updated at all on PAT writes. That seems to be a low hanging fruit to bring svm on the same support level as vmx. Or am I missing something? Jan PS: If someone has a good idea for a simple test case on machines without IOMMU (like my current boxes), thus without a chance to use device pass-through to stress guest PAT settings, I would be all ears. -- Siemens AG, Corporate Technology, CT RTC ITP SES-DE Corporate Competence Center Embedded Linux