RE: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-24 Thread Tian, Kevin
> From: Chia-I Wu > Sent: Saturday, February 22, 2020 2:21 AM > > On Fri, Feb 21, 2020 at 7:59 AM Sean Christopherson > wrote: > > > > On Thu, Feb 20, 2020 at 09:39:05PM -0800, Tian, Kevin wrote: > > > > From: Chia-I Wu > > > > Sent: Friday, February 21, 2020 12:51 PM > > > > If you think it

Re: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-24 Thread Gerd Hoffmann
Hi, > > The plan is for virtio-gpu device to reserve a huge memory region in > > the guest. Memslots may be added dynamically or statically to back > > the region. > > so the region is marked as E820_RESERVED to prevent guest kernel > from using it for other purpose and then virtio-gpu

Re: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-21 Thread Chia-I Wu
On Fri, Feb 21, 2020 at 7:59 AM Sean Christopherson wrote: > > On Thu, Feb 20, 2020 at 09:39:05PM -0800, Tian, Kevin wrote: > > > From: Chia-I Wu > > > Sent: Friday, February 21, 2020 12:51 PM > > > If you think it is the best for KVM to inspect hva to determine the memory > > > type with page

Re: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-21 Thread Sean Christopherson
On Thu, Feb 20, 2020 at 09:39:05PM -0800, Tian, Kevin wrote: > > From: Chia-I Wu > > Sent: Friday, February 21, 2020 12:51 PM > > If you think it is the best for KVM to inspect hva to determine the memory > > type with page granularity, that is reasonable and should work for us too. > > The

RE: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-20 Thread Tian, Kevin
> From: Chia-I Wu > Sent: Friday, February 21, 2020 12:51 PM > > (resend because gmail did not format to plain text...) > > On Thu, Feb 20, 2020 at 8:45 PM Chia-I Wu wrote: > > > > > > > > On Thu, Feb 20, 2020 at 4:23 PM Tian, Kevin wrote: > >> > >> > From: Chia-I Wu > >> > Sent: Friday,

Re: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-20 Thread Chia-I Wu
(resend because gmail did not format to plain text...) On Thu, Feb 20, 2020 at 8:45 PM Chia-I Wu wrote: > > > > On Thu, Feb 20, 2020 at 4:23 PM Tian, Kevin wrote: >> >> > From: Chia-I Wu >> > Sent: Friday, February 21, 2020 6:24 AM >> > >> > On Wed, Feb 19, 2020 at 6:38 PM Tian, Kevin wrote:

Re: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-20 Thread Chia-I Wu
On Thu, Feb 20, 2020 at 4:23 PM Tian, Kevin wrote: > > From: Chia-I Wu > > Sent: Friday, February 21, 2020 6:24 AM > > > > On Wed, Feb 19, 2020 at 6:38 PM Tian, Kevin > wrote: > > > > > > > From: Tian, Kevin > > > > Sent: Thursday, February 20, 2020 10:05 AM > > > > > > > > > From: Chia-I Wu

RE: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-20 Thread Tian, Kevin
> From: Chia-I Wu > Sent: Friday, February 21, 2020 6:24 AM > > On Wed, Feb 19, 2020 at 6:38 PM Tian, Kevin wrote: > > > > > From: Tian, Kevin > > > Sent: Thursday, February 20, 2020 10:05 AM > > > > > > > From: Chia-I Wu > > > > Sent: Thursday, February 20, 2020 3:37 AM > > > > > > > > On

Re: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-20 Thread Chia-I Wu
On Wed, Feb 19, 2020 at 6:13 PM Tian, Kevin wrote: > > > Curious... How is such slot exposed to the guest? A reserved memory > > > region? Is it static or might be dynamically added? > > The plan is for virtio-gpu device to reserve a huge memory region in > > the guest. Memslots may be added

Re: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-20 Thread Chia-I Wu
On Wed, Feb 19, 2020 at 6:38 PM Tian, Kevin wrote: > > > From: Tian, Kevin > > Sent: Thursday, February 20, 2020 10:05 AM > > > > > From: Chia-I Wu > > > Sent: Thursday, February 20, 2020 3:37 AM > > > > > > On Wed, Feb 19, 2020 at 1:52 AM Tian, Kevin wrote: > > > > > > > > > From: Paolo

RE: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-19 Thread Tian, Kevin
> From: Tian, Kevin > Sent: Thursday, February 20, 2020 10:05 AM > > > From: Chia-I Wu > > Sent: Thursday, February 20, 2020 3:37 AM > > > > On Wed, Feb 19, 2020 at 1:52 AM Tian, Kevin wrote: > > > > > > > From: Paolo Bonzini > > > > Sent: Wednesday, February 19, 2020 12:29 AM > > > > > > > >

RE: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-19 Thread Tian, Kevin
> From: Chia-I Wu > Sent: Thursday, February 20, 2020 3:18 AM > > On Wed, Feb 19, 2020 at 2:00 AM Tian, Kevin wrote: > > > > > From: Chia-I Wu > > > Sent: Saturday, February 15, 2020 5:15 AM > > > > > > On Fri, Feb 14, 2020 at 2:26 AM Paolo Bonzini > wrote: > > > > > > > > On 13/02/20 23:18,

RE: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-19 Thread Tian, Kevin
> From: Chia-I Wu > Sent: Thursday, February 20, 2020 3:37 AM > > On Wed, Feb 19, 2020 at 1:52 AM Tian, Kevin wrote: > > > > > From: Paolo Bonzini > > > Sent: Wednesday, February 19, 2020 12:29 AM > > > > > > On 14/02/20 23:03, Sean Christopherson wrote: > > > >> On Fri, Feb 14, 2020 at 1:47 PM

Re: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-19 Thread Chia-I Wu
On Wed, Feb 19, 2020 at 1:52 AM Tian, Kevin wrote: > > > From: Paolo Bonzini > > Sent: Wednesday, February 19, 2020 12:29 AM > > > > On 14/02/20 23:03, Sean Christopherson wrote: > > >> On Fri, Feb 14, 2020 at 1:47 PM Chia-I Wu wrote: > > >>> AFAICT, it is currently allowed on ARM (verified) and

Re: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-19 Thread Chia-I Wu
On Wed, Feb 19, 2020 at 2:00 AM Tian, Kevin wrote: > > > From: Chia-I Wu > > Sent: Saturday, February 15, 2020 5:15 AM > > > > On Fri, Feb 14, 2020 at 2:26 AM Paolo Bonzini wrote: > > > > > > On 13/02/20 23:18, Chia-I Wu wrote: > > > > > > > > The bug you mentioned was probably this one > > > >

RE: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-19 Thread Tian, Kevin
> From: Chia-I Wu > Sent: Saturday, February 15, 2020 5:15 AM > > On Fri, Feb 14, 2020 at 2:26 AM Paolo Bonzini wrote: > > > > On 13/02/20 23:18, Chia-I Wu wrote: > > > > > > The bug you mentioned was probably this one > > > > > > https://bugzilla.kernel.org/show_bug.cgi?id=104091 > > > > Yes,

RE: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-19 Thread Tian, Kevin
> From: Paolo Bonzini > Sent: Wednesday, February 19, 2020 12:29 AM > > On 14/02/20 23:03, Sean Christopherson wrote: > >> On Fri, Feb 14, 2020 at 1:47 PM Chia-I Wu wrote: > >>> AFAICT, it is currently allowed on ARM (verified) and AMD (not > >>> verified, but svm_get_mt_mask returns 0 which

Re: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-18 Thread Sean Christopherson
On Tue, Feb 18, 2020 at 05:28:51PM +0100, Paolo Bonzini wrote: > On 14/02/20 23:03, Sean Christopherson wrote: > >> On Fri, Feb 14, 2020 at 1:47 PM Chia-I Wu wrote: > >>> AFAICT, it is currently allowed on ARM (verified) and AMD (not > >>> verified, but svm_get_mt_mask returns 0 which supposedly

Re: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-18 Thread Paolo Bonzini
On 14/02/20 23:03, Sean Christopherson wrote: >> On Fri, Feb 14, 2020 at 1:47 PM Chia-I Wu wrote: >>> AFAICT, it is currently allowed on ARM (verified) and AMD (not >>> verified, but svm_get_mt_mask returns 0 which supposedly means the NPT >>> does not restrict what the guest PAT can do). This

Re: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-14 Thread Sean Christopherson
On Fri, Feb 14, 2020 at 01:56:48PM -0800, Jim Mattson wrote: > On Fri, Feb 14, 2020 at 1:47 PM Chia-I Wu wrote: > > AFAICT, it is currently allowed on ARM (verified) and AMD (not > > verified, but svm_get_mt_mask returns 0 which supposedly means the NPT > > does not restrict what the guest PAT

Re: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-14 Thread Chia-I Wu
On Fri, Feb 14, 2020 at 11:52 AM Sean Christopherson wrote: > > On Fri, Feb 14, 2020 at 11:26:06AM +0100, Paolo Bonzini wrote: > > On 13/02/20 23:18, Chia-I Wu wrote: > > > > > > The bug you mentioned was probably this one > > > > > > https://bugzilla.kernel.org/show_bug.cgi?id=104091 > > > >

Re: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-14 Thread Chia-I Wu
On Fri, Feb 14, 2020 at 2:26 AM Paolo Bonzini wrote: > > On 13/02/20 23:18, Chia-I Wu wrote: > > > > The bug you mentioned was probably this one > > > > https://bugzilla.kernel.org/show_bug.cgi?id=104091 > > Yes, indeed. > > > From what I can tell, the commit allowed the guests to create cached

Re: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-14 Thread Sean Christopherson
On Fri, Feb 14, 2020 at 11:26:06AM +0100, Paolo Bonzini wrote: > On 13/02/20 23:18, Chia-I Wu wrote: > > > > The bug you mentioned was probably this one > > > > https://bugzilla.kernel.org/show_bug.cgi?id=104091 > > Yes, indeed. > > > From what I can tell, the commit allowed the guests to

Re: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-14 Thread Paolo Bonzini
On 13/02/20 23:18, Chia-I Wu wrote: > > The bug you mentioned was probably this one > > https://bugzilla.kernel.org/show_bug.cgi?id=104091 Yes, indeed. > From what I can tell, the commit allowed the guests to create cached > mappings to MMIO regions and caused MCEs. That is different than

Re: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-13 Thread Chia-I Wu
On Thu, Feb 13, 2020 at 1:41 PM Paolo Bonzini wrote: > > On 13/02/20 22:30, Chia-I Wu wrote: > > Hi, > > > > Host GPU drivers like to give userspace WC mapping. When the userspace > > makes > > the mapping available to a guest, it also tells the guest to create a WC > > mapping. However, even

Re: [RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-13 Thread Paolo Bonzini
On 13/02/20 22:30, Chia-I Wu wrote: > Hi, > > Host GPU drivers like to give userspace WC mapping. When the userspace makes > the mapping available to a guest, it also tells the guest to create a WC > mapping. However, even when the guest kernel picks the correct memory type, > it gets ignored

[RFC PATCH 0/3] KVM: x86: honor guest memory type

2020-02-13 Thread Chia-I Wu
Hi, Host GPU drivers like to give userspace WC mapping. When the userspace makes the mapping available to a guest, it also tells the guest to create a WC mapping. However, even when the guest kernel picks the correct memory type, it gets ignored because of VMX_EPT_IPAT_BIT on Intel. This