Re: [RFCv2 08/16] KVM: Use GUP instead of copy_from/to_user() to access guest memory

2020-10-26 Thread John Hubbard
On 10/26/20 6:28 AM, Matthew Wilcox wrote: On Sun, Oct 25, 2020 at 09:44:07PM -0700, John Hubbard wrote: On 10/25/20 9:21 PM, Matthew Wilcox wrote: I don't think the page pinning approach is ever valid. For file Could you qualify that? Surely you don't mean that the entire pin_user_pages sto

Re: [RFCv2 08/16] KVM: Use GUP instead of copy_from/to_user() to access guest memory

2020-10-26 Thread Jason Gunthorpe
On Mon, Oct 26, 2020 at 01:28:30PM +, Matthew Wilcox wrote: > > > It's been five years since DAX was merged, and page pinning still > > > doesn't work. How much longer before the people who are pushing it > > > realise that it's fundamentally flawed? > > > > Is this a separate rant about *on

Re: [RFCv2 08/16] KVM: Use GUP instead of copy_from/to_user() to access guest memory

2020-10-26 Thread Matthew Wilcox
On Sun, Oct 25, 2020 at 09:44:07PM -0700, John Hubbard wrote: > On 10/25/20 9:21 PM, Matthew Wilcox wrote: > > I don't think the page pinning approach is ever valid. For file > > Could you qualify that? Surely you don't mean that the entire pin_user_pages > story is a waste of time--I would have

Re: [RFCv2 08/16] KVM: Use GUP instead of copy_from/to_user() to access guest memory

2020-10-25 Thread John Hubbard
On 10/25/20 9:21 PM, Matthew Wilcox wrote: On Thu, Oct 22, 2020 at 12:58:14PM -0700, John Hubbard wrote: On 10/22/20 4:49 AM, Matthew Wilcox wrote: On Tue, Oct 20, 2020 at 01:25:59AM -0700, John Hubbard wrote: Should copy_to_guest() use pin_user_pages_unlocked() instead of gup_unlocked? We wro

Re: [RFCv2 08/16] KVM: Use GUP instead of copy_from/to_user() to access guest memory

2020-10-25 Thread Matthew Wilcox
On Thu, Oct 22, 2020 at 12:58:14PM -0700, John Hubbard wrote: > On 10/22/20 4:49 AM, Matthew Wilcox wrote: > > On Tue, Oct 20, 2020 at 01:25:59AM -0700, John Hubbard wrote: > > > Should copy_to_guest() use pin_user_pages_unlocked() instead of > > > gup_unlocked? > > > We wrote a "Case 5" in Docum

Re: [RFCv2 08/16] KVM: Use GUP instead of copy_from/to_user() to access guest memory

2020-10-22 Thread John Hubbard
On 10/22/20 4:49 AM, Matthew Wilcox wrote: On Tue, Oct 20, 2020 at 01:25:59AM -0700, John Hubbard wrote: Should copy_to_guest() use pin_user_pages_unlocked() instead of gup_unlocked? We wrote a "Case 5" in Documentation/core-api/pin_user_pages.rst, just for this situation, I think: CASE 5: Pi

Re: [RFCv2 08/16] KVM: Use GUP instead of copy_from/to_user() to access guest memory

2020-10-22 Thread Matthew Wilcox
On Tue, Oct 20, 2020 at 01:25:59AM -0700, John Hubbard wrote: > Should copy_to_guest() use pin_user_pages_unlocked() instead of gup_unlocked? > We wrote a "Case 5" in Documentation/core-api/pin_user_pages.rst, just for > this > situation, I think: > > > CASE 5: Pinning in order to write to the

Re: [RFCv2 08/16] KVM: Use GUP instead of copy_from/to_user() to access guest memory

2020-10-22 Thread Kirill A. Shutemov
On Tue, Oct 20, 2020 at 10:29:44AM -0700, Ira Weiny wrote: > On Tue, Oct 20, 2020 at 09:18:51AM +0300, Kirill A. Shutemov wrote: > > New helpers copy_from_guest()/copy_to_guest() to be used if KVM memory > > protection feature is enabled. > > > > Signed-off-by: Kirill A. Shutemov > > --- > > inc

Re: [RFCv2 08/16] KVM: Use GUP instead of copy_from/to_user() to access guest memory

2020-10-20 Thread Ira Weiny
On Tue, Oct 20, 2020 at 09:18:51AM +0300, Kirill A. Shutemov wrote: > New helpers copy_from_guest()/copy_to_guest() to be used if KVM memory > protection feature is enabled. > > Signed-off-by: Kirill A. Shutemov > --- > include/linux/kvm_host.h | 4 ++ > virt/kvm/kvm_main.c | 90 ++

Re: [RFCv2 08/16] KVM: Use GUP instead of copy_from/to_user() to access guest memory

2020-10-20 Thread Kirill A. Shutemov
On Tue, Oct 20, 2020 at 01:25:59AM -0700, John Hubbard wrote: > On 10/19/20 11:18 PM, Kirill A. Shutemov wrote: > > New helpers copy_from_guest()/copy_to_guest() to be used if KVM memory > > protection feature is enabled. > > > > Signed-off-by: Kirill A. Shutemov > > --- > > include/linux/kvm_h

Re: [RFCv2 08/16] KVM: Use GUP instead of copy_from/to_user() to access guest memory

2020-10-20 Thread John Hubbard
On 10/19/20 11:18 PM, Kirill A. Shutemov wrote: New helpers copy_from_guest()/copy_to_guest() to be used if KVM memory protection feature is enabled. Signed-off-by: Kirill A. Shutemov --- include/linux/kvm_host.h | 4 ++ virt/kvm/kvm_main.c | 90 +++-

[RFCv2 08/16] KVM: Use GUP instead of copy_from/to_user() to access guest memory

2020-10-19 Thread Kirill A. Shutemov
New helpers copy_from_guest()/copy_to_guest() to be used if KVM memory protection feature is enabled. Signed-off-by: Kirill A. Shutemov --- include/linux/kvm_host.h | 4 ++ virt/kvm/kvm_main.c | 90 +++- 2 files changed, 75 insertions(+), 19 deletions(-)