From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_RED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 833ADC43603 for ; Thu, 5 Dec 2019 06:49:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 59E382077B for ; Thu, 5 Dec 2019 06:49:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Fn2cowhJ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726174AbfLEGtq (ORCPT ); Thu, 5 Dec 2019 01:49:46 -0500 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:33668 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725867AbfLEGto (ORCPT ); Thu, 5 Dec 2019 01:49:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575528582; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PN2kaQNnGa1We4eEVYDGchvloPKew2Z0oPxF8rZIDrk=; b=Fn2cowhJkJVDo34R4ijjBG34Rqrll+3FGrCbMG7j4c2cE7IqdFKrqzBDpes4t70bU/24a8 HpvlwEQELymUqw3sbnyuSokEgRQ4SuRjj09NgdxOkSUrcuLXEiFrFTxPskvVxvDzcW7190 h7XmgGUQ9EalHL21YJhlPXUZldVY78Q= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-190-as2qfbUSPIK-R_i6Z0vlEQ-1; Thu, 05 Dec 2019 01:49:41 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4ACE1107ACCA; Thu, 5 Dec 2019 06:49:40 +0000 (UTC) Received: from [10.72.12.247] (ovpn-12-247.pek2.redhat.com [10.72.12.247]) by smtp.corp.redhat.com (Postfix) with ESMTP id 11D7E10013A1; Thu, 5 Dec 2019 06:49:32 +0000 (UTC) Subject: Re: [PATCH RFC 00/15] KVM: Dirty ring interface To: Peter Xu , Paolo Bonzini Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Sean Christopherson , "Dr . David Alan Gilbert" , Vitaly Kuznetsov , "Michael S. Tsirkin" References: <20191129213505.18472-1-peterx@redhat.com> <776732ca-06c8-c529-0899-9d2ffacf7789@redhat.com> <20191204193357.GE19939@xz-x1> From: Jason Wang Message-ID: Date: Thu, 5 Dec 2019 14:49:30 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20191204193357.GE19939@xz-x1> Content-Language: en-US X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: as2qfbUSPIK-R_i6Z0vlEQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019/12/5 =E4=B8=8A=E5=8D=883:33, Peter Xu wrote: > On Wed, Dec 04, 2019 at 06:39:48PM +0800, Jason Wang wrote: >> On 2019/11/30 =E4=B8=8A=E5=8D=885:34, Peter Xu wrote: >>> Branch is here:https://github.com/xzpeter/linux/tree/kvm-dirty-ring >>> >>> Overview >>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >>> >>> This is a continued work from Lei Cao and Paolo >>> on the KVM dirty ring interface. To make it simple, I'll still start >>> with version 1 as RFC. >>> >>> The new dirty ring interface is another way to collect dirty pages for >>> the virtual machine, but it is different from the existing dirty >>> logging interface in a few ways, majorly: >>> >>> - Data format: The dirty data was in a ring format rather than a >>> bitmap format, so the size of data to sync for dirty logging does >>> not depend on the size of guest memory any more, but speed of >>> dirtying. Also, the dirty ring is per-vcpu (currently plus >>> another per-vm ring, so total ring number is N+1), while the dirt= y >>> bitmap is per-vm. >>> >>> - Data copy: The sync of dirty pages does not need data copy any mo= re, >>> but instead the ring is shared between the userspace and kernel b= y >>> page sharings (mmap() on either the vm fd or vcpu fd) >>> >>> - Interface: Instead of using the old KVM_GET_DIRTY_LOG, >>> KVM_CLEAR_DIRTY_LOG interfaces, the new ring uses a new interface >>> called KVM_RESET_DIRTY_RINGS when we want to reset the collected >>> dirty pages to protected mode again (works like >>> KVM_CLEAR_DIRTY_LOG, but ring based) >>> >>> And more. >> >> Looks really interesting, I wonder if we can make this as a library then= we >> can reuse it for vhost. > So iiuc this ring will majorly for (1) data exchange between kernel > and user, and (2) shared memory. I think from that pov yeh it should > work even for vhost. > > It shouldn't be hard to refactor the interfaces to avoid kvm elements, > however I'm not sure how to do that best. Maybe like irqbypass and > put it into virt/lib/ as a standlone module? Would it worth it? Maybe, and it looks to me some dirty pages reporting API for VFIO is=20 proposed in the same time. It will be helpful to unify them (or at least=20 leave a chance for other users). Thanks > > Paolo, what's your take? >