From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52716) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XkDxW-0001z8-6G for qemu-devel@nongnu.org; Fri, 31 Oct 2014 11:19:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xk2x4-00086R-5G for qemu-devel@nongnu.org; Thu, 30 Oct 2014 23:32:44 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:1397) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xk2x3-0006Iw-HW for qemu-devel@nongnu.org; Thu, 30 Oct 2014 23:32:38 -0400 Message-ID: <5453022D.4040801@huawei.com> Date: Fri, 31 Oct 2014 11:29:49 +0800 From: zhanghailiang MIME-Version: 1.0 References: <1412356087-16115-1-git-send-email-aarcange@redhat.com> <544E1143.1080905@huawei.com> <20141029174607.GK19606@redhat.com> <545221A4.9030606@huawei.com> <20141031022327.GA13275@google.com> In-Reply-To: <20141031022327.GA13275@google.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 00/17] RFC: userfault v2 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Feiner Cc: Robert Love , Dave Hansen , Jan Kara , kvm@vger.kernel.org, Neil Brown , Stefan Hajnoczi , qemu-devel@nongnu.org, KOSAKI Motohiro , Michel Lespinasse , Andrea Arcangeli , Taras Glek , Andrew Jones , Juan Quintela , Hugh Dickins , Isaku Yamahata , Mel Gorman , Sasha Levin , Android Kernel Team , "Dr. David Alan Gilbert" , "Huangpeng (Peter)" , Andres Lagar-Cavilla , Christopher Covington , Anthony Liguori , Paolo Bonzini , Keith Packard , Wenchao Xia , linux-kernel@vger.kernel.org, Andy Lutomirski , Minchan Kim , Dmitry Adamushko , Johannes Weiner , Mike Hommey , Andrew Morton On 2014/10/31 10:23, Peter Feiner wrote: > On Thu, Oct 30, 2014 at 07:31:48PM +0800, zhanghailiang wrote: >> On 2014/10/30 1:46, Andrea Arcangeli wrote: >>> On Mon, Oct 27, 2014 at 05:32:51PM +0800, zhanghailiang wrote: >>>> I want to confirm a question: >>>> Can we support distinguishing between writing and reading memory for userfault? >>>> That is, we can decide whether writing a page, reading a page or both trigger userfault. >>> Mail is going to be long enough already so I'll just assume tracking >>> dirty memory in userland (instead of doing it in kernel) is worthy >>> feature to have here. > > I'll open that can of worms :-) > >> [...] >> Er, maybe i didn't describe clearly. What i really need for live memory snapshot >> is only wrprotect fault, like kvm's dirty tracing mechanism, *only tracing write action*. >> >> So, what i need for userfault is supporting only wrprotect fault. i don't >> want to get notification for non present reading faults, it will influence >> VM's performance and the efficiency of doing snapshot. > > Given that you do care about performance Zhanghailiang, I don't think that a > userfault handler is a good place to track dirty memory. Every dirtying write > will block on the userfault handler, which is an expensively slow proposition > compared to an in-kernel approach. > Agreed, but for doing live memory snapshot (VM is running when do snapsphot), we have to do this (block the write action), because we have to save the page before it is dirtied by writing action. This is the difference, compared to pre-copy migration. >> Also, i think this feature will benefit for migration of ivshmem and vhost-scsi >> which have no dirty-page-tracing now. > > I do agree wholeheartedly with you here. Manually tracking non-guest writes > adds to the complexity of device emulation code. A central fault-driven means > for dirty tracking writes from the guest and host would be a welcome > simplification to implementing pre-copy migration. Indeed, that's exactly what > I'm working on! I'm using the softdirty bit, which was introduced recently for > CRIU migration, to replace the use of KVM's dirty logging and manual dirty > tracking by the VMM during pre-copy migration. See Great! Do you plan to issue your patches to community? I mean is your work based on qemu? or an independent tool (CRIU migration?) for live-migration? Maybe i could fix the migration problem for ivshmem in qemu now, based on softdirty mechanism. > Documentation/vm/soft-dirty.txt and pagemap.txt in case you aren't familiar. To I have read them cursorily, it is useful for pre-copy indeed. But it seems that it can not meet my need for snapshot. > make softdirty usable for live migration, I've added an API to atomically > test-and-clear the bit and write protect the page. How can i find the API? Is it been merged in kernel's master branch already? Thanks, zhanghailiang