Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1600209ybl; Thu, 5 Dec 2019 04:09:26 -0800 (PST) X-Google-Smtp-Source: APXvYqy9ChR6DRADDXA6tpCSOV7jIhk9rELBkIZnhRDG0VLYcy3QYmX3dKBM5ACHxNlla0g7rDo/ X-Received: by 2002:aca:2208:: with SMTP id b8mr6606082oic.76.1575547766100; Thu, 05 Dec 2019 04:09:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575547766; cv=none; d=google.com; s=arc-20160816; b=iH8wkRCZ/B6yIyC+Imz72sx49/Lo/qWL7M1IUkRlUYPuPn86U2Cz+ZHHHyC6DvB0ZQ 3LgzUl16oJ3dzm8Be8bFrzzG956oLhTLZIIHB6IyzRs9I4e/ExsDkM/MRGGb9SfD/pi9 24j85io7+4gc9sgzxXIkUghfqEPNYpUXQ5DKxDEClTtZ/4RiDB+1POTEbTOpepjTY/X0 bURnxzjFLoBljE/3KoHyBrpULLzqnW0B4I7908J4nka3xNiWtPKoNJlQLEDdXyMaE+bd ToMKTsqNWoWTX22fVG/nmupeEY+nIKcGaBbh/DxNre1YlulPCZsXJc+Jys+WbaYSNzS5 Osgg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:user-agent:in-reply-to:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=KKnePFkA3a3Jg8CAkFy2V9ZPhak/skft+CWcf44aQ2I=; b=WZGywtuHF52m93s/stKMo5YnveX9WBsSqarx4CMxWtUNc3+Mr8wSEjBTP7IhbwskcB DMzDwyTbtjqzvH8gK4r6MVy6KvhcdL4Naec8z9gK5VdxSOOd/M/HN/sY3qIq7bFbNRCv UyRtJ0kOcQ1yLTQZMBBvbhlo2SeeerYfVsv4F4eyFrWAhy12RgsSyx8qKT/KmWctB+0t Sq5XpNV4iYvaRpG+E/ossimvb4s1Nw5TSkhlau5Ma25I+3KVEM0JIZFSRFZHrO9JHJKr fXzCZ0dYeiM2Qrq2qP0GaybWP0my5HKPGqzOPievbCT6ebUCUTyxUCPe6EjE3fUFlwiy 3KRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=E9hsmWva; 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 y186si4741623oig.241.2019.12.05.04.09.13; Thu, 05 Dec 2019 04:09:26 -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=E9hsmWva; 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 S1729332AbfLEMIJ (ORCPT + 99 others); Thu, 5 Dec 2019 07:08:09 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:53975 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729096AbfLEMII (ORCPT ); Thu, 5 Dec 2019 07:08:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575547687; 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=KKnePFkA3a3Jg8CAkFy2V9ZPhak/skft+CWcf44aQ2I=; b=E9hsmWva3PFczTfk8cjepVm1S4/kqFrUW8TnW3GL7/r9wVZFUoCEXCwdAsYqJxvdVbismT v6Ix0OzyNLh42JGPoUCriw3g13TZBF2AXJsqYbm82Iv3pPbx2JMTiN9F7ZY3QPJO1CarQb +O5hEuCpeNirNPIGLEwjDEJwQg5XEQc= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-18-Z0a8k683OSycm3Jsm2exig-1; Thu, 05 Dec 2019 07:08:03 -0500 Received: by mail-qk1-f197.google.com with SMTP id d26so1974443qkk.8 for ; Thu, 05 Dec 2019 04:08:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=Yem3+ayZlS+BgE7nY75md4w+1lEY3LEm7zBYY/k2QI0=; b=jy4EWZ0hpnNTXM4r4Bu840fS2pPA8WL/g/CSp6yT+/+P4j6sMZ8uTTg9l78gW4nQ78 jHBUL1PfNrKwGRFN+G0jtIxu3EAc/bhUpdlkXRq/kB6CZTm4H1cLRTuZPmUsrBWZW6b4 qkgAiBFNWjOHhH87G+L8j48hTidkPIa/HcE+/GDQjfNS1tqG5qTTvSNav4DPoiSI7qe/ ECrDn5gaZVhMgxLw+vfu6OJP3CDG/k0j4wTny/YHoSB6MvdgiHLTo17+1KGdx1qDb5l8 XerK3VFO+nqo7qGkkvnHiG+Kv0GjZcBYxlpOf8EG9DmifZ7GiIy7XlWMfk0GCKtemXUk atew== X-Gm-Message-State: APjAAAUMYcM8x9I0nIMKvOlyCyHGzYD4/lAqdl6ioUrQTc8w1f5pKcc0 /BH0h9qQpRBcy7ayV4Ir434nRyxtWCLZ7ogVSJLKuzQuQ8O9pMQDHsvWvCQrQNhTnVun/8wJnis 0lblhQkepal0f2pzoKkFCZtQV X-Received: by 2002:a37:4fd8:: with SMTP id d207mr8005351qkb.464.1575547683442; Thu, 05 Dec 2019 04:08:03 -0800 (PST) X-Received: by 2002:a37:4fd8:: with SMTP id d207mr8005316qkb.464.1575547683077; Thu, 05 Dec 2019 04:08:03 -0800 (PST) Received: from xz-x1 ([2607:9880:19c0:3f::3]) by smtp.gmail.com with ESMTPSA id y184sm4852359qkd.128.2019.12.05.04.08.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Dec 2019 04:08:02 -0800 (PST) Date: Thu, 5 Dec 2019 07:08:00 -0500 From: Peter Xu To: Jason Wang Cc: Paolo Bonzini , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Sean Christopherson , "Dr . David Alan Gilbert" , Vitaly Kuznetsov , "Michael S. Tsirkin" Subject: Re: [PATCH RFC 04/15] KVM: Implement ring-based dirty memory tracking Message-ID: <20191205120800.GA9673@xz-x1> References: <20191129213505.18472-1-peterx@redhat.com> <20191129213505.18472-5-peterx@redhat.com> <1355422f-ab62-9dc3-2b48-71a6e221786b@redhat.com> <20191204195230.GF19939@xz-x1> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) X-MC-Unique: Z0a8k683OSycm3Jsm2exig-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 05, 2019 at 02:51:15PM +0800, Jason Wang wrote: >=20 > On 2019/12/5 =E4=B8=8A=E5=8D=883:52, Peter Xu wrote: > > On Wed, Dec 04, 2019 at 12:04:53PM +0100, Paolo Bonzini wrote: > > > On 04/12/19 11:38, Jason Wang wrote: > > > > > +=C2=A0=C2=A0=C2=A0 entry =3D &ring->dirty_gfns[ring->dirty_index= & (ring->size - 1)]; > > > > > +=C2=A0=C2=A0=C2=A0 entry->slot =3D slot; > > > > > +=C2=A0=C2=A0=C2=A0 entry->offset =3D offset; > > > >=20 > > > > Haven't gone through the whole series, sorry if it was a silly ques= tion > > > > but I wonder things like this will suffer from similar issue on > > > > virtually tagged archs as mentioned in [1]. > > > There is no new infrastructure to track the dirty pages---it's just a > > > different way to pass them to userspace. > > >=20 > > > > Is this better to allocate the ring from userspace and set to KVM > > > > instead? Then we can use copy_to/from_user() friends (a little bit = slow > > > > on recent CPUs). > > > Yeah, I don't think that would be better than mmap. > > Yeah I agree, because I didn't see how copy_to/from_user() helped to > > do icache/dcache flushings... >=20 >=20 > It looks to me one advantage is that exact the same VA is used by both > userspace and kernel so there will be no alias. Hmm.. but what if the page is mapped more than once in user? Thanks, --=20 Peter Xu