Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1332075ybl; Wed, 4 Dec 2019 22:51:29 -0800 (PST) X-Google-Smtp-Source: APXvYqzQSZndKYxevi1UZJe0Hcpu6jRa5pVKew4Bx+MtW/IcxYndxt4XTNtX7R7rwI5MeFhCxpiz X-Received: by 2002:a54:4781:: with SMTP id o1mr5724129oic.117.1575528689193; Wed, 04 Dec 2019 22:51:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575528689; cv=none; d=google.com; s=arc-20160816; b=U5b2hkisaaEsXXJNvKMYIz5RdI6ucxF/okpWKCFmbHeGA5X4QRXxzbdvgmNDVvNdzp KD1XvN3lL9bNKYweRlvDVNVvPA4XbRGZLKfx/eMLg1n3zbMs8KoBGLqhIJKn10eb9jvX Vg31lyP67/MrxIlGXP2KjjmS/WtSYSMvfTq4qIfPivbqM/hI4DXP7IIvsuzkqS96fj0T BoTU3RI5Aa/wVrUDdVXJzvZgMGxarFZYYBllHcRG/5i8cMFbZ6P5jsRb1SwB+ZhiJKg0 idUlXHQ0eQP82i+Cujz7RrCVrl11VY83DXbCBQCuJreijmDATKvkleGZN0zmNUZfKUEk IbLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=PN2kaQNnGa1We4eEVYDGchvloPKew2Z0oPxF8rZIDrk=; b=bMafzLgMtG0Eo61/kccT3ELWwAZqMl/k6UgaUbU68/u/Kwk7JJdtmWch2CCUO+sbdX tFBt4fF1KVmpMosy0C19eFOPJUovMO4WtfRSEy04eTWIdik/rGpsPZ6XuvVW3WwQX9AJ DUPjSLu9Dyi8/ls96o+H6hhPCpgbxWySlnQUj+qznDnWgnm3LrceLnz4Lk0uLNTPqwdZ w8hPEILZDWCOLt9xoTDztAg8A/gDZY7I+vwzf9T0mAV3jXmz53aL7Urcl9p2dw2VW3h9 ZIprabGtWVSVGjcHbQObxT/bUmJ1ZYgRt7sn8s++aob2f0okWD4y/rdUplc/w5u+nZ77 +dnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Fn2cowhJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o8si4910813oti.47.2019.12.04.22.51.12; Wed, 04 Dec 2019 22:51:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Fn2cowhJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726082AbfLEGtp (ORCPT + 99 others); Thu, 5 Dec 2019 01:49:45 -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? >