From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755103AbcEBTCT (ORCPT ); Mon, 2 May 2016 15:02:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39659 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754224AbcEBTCF (ORCPT ); Mon, 2 May 2016 15:02:05 -0400 Date: Mon, 2 May 2016 21:02:03 +0200 From: Andrea Arcangeli To: "Kirill A. Shutemov" Cc: Jerome Glisse , Oleg Nesterov , Hugh Dickins , Linus Torvalds , Andrew Morton , Alex Williamson , kirill.shutemov@linux.intel.com, linux-kernel@vger.kernel.org, "linux-mm@kvack.org" Subject: Re: GUP guarantees wrt to userspace mappings Message-ID: <20160502190203.GD12310@redhat.com> References: <20160428232127.GL11700@redhat.com> <20160429005106.GB2847@node.shutemov.name> <20160428204542.5f2053f7@ul30vt.home> <20160429070611.GA4990@node.shutemov.name> <20160429163444.GM11700@redhat.com> <20160502104119.GA23305@node.shutemov.name> <20160502111513.GA4079@gmail.com> <20160502121402.GB23305@node.shutemov.name> <20160502133919.GB4079@gmail.com> <20160502150013.GA24419@node.shutemov.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160502150013.GA24419@node.shutemov.name> User-Agent: Mutt/1.6.0 (2016-04-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 02 May 2016 19:02:05 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 02, 2016 at 06:00:13PM +0300, Kirill A. Shutemov wrote: > Switching to non-fast GUP would help :-P If we had a race in khugepaged or ksmd against gup_fast O_DIRECT we'd get flood of bugreports of data corruption with KVM run with cache=direct. Just wanted to reassure there's no race, explained how the serialization to force a fallback to non-fast GUP works in previous email. This issue we're fixing for the COW is totally unrelated to KVM too, because it uses MADV_DONTFORK, but the other races with O_DIRECT against khugepaged/kksmd would still happen if we didn't already have proper serialization against get_user_pages_fast. > Alternatively, we have mmu_notifiers to track changes in userspace > mappings. This is always the absolute best solution, then no gup pins are used at all and all VM functionality is activated regardless of the secondary MMU, just most IOMMUs can't generate a synchronous page fault, when they fault the I/O is undefined. It'd be like if when you get a page fault in the CPU, when you return from the fault you go to then next instruction and during the fault you've no way to even emulate the faulting instruction.