Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp533347ybl; Thu, 12 Dec 2019 00:12:56 -0800 (PST) X-Google-Smtp-Source: APXvYqxMunPrYV+6YT2RdKX0rcZkpl0FFyISR2/nhiHuzEeUVW7UG/ihTmqGMIyaTk2/mIpXHM3y X-Received: by 2002:a9d:4c08:: with SMTP id l8mr6739292otf.360.1576138376262; Thu, 12 Dec 2019 00:12:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576138376; cv=none; d=google.com; s=arc-20160816; b=N4SA9ewykXeXmLhj8S22XM0wSxwshHK+c4agbfusk1PkHFtvEpgpZO6Q05oxU7OkjG YvH6yqIOwZcYEfvhBEgj7qjknzg+f3GBtZDCmEh9w0vD6GcbPDeGt6anmb0XApxVxAp8 wYrP8nXkv1Ieus0X6psy7GrrcV0LEjqgvdwcKBGMucZDnGy5Ze5XVFQwubcm3fQ7s30P HnPCuoP1SvDxoYoHUvjYx4oalDou7dQ4yrpKNRCLgShyXsiyFMnpAWEmp/4wzbLbehJN LnUeln69JUmxQr/8SFWb2lbfJk15yBSDEOXTKRK4R1uQ2P/PTyZfAzGxKVX5LseEE5q0 VlrA== 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=3vbKumHRhYv4hi2VaZ7lUNT3xifUzCtPM0UHF+6l3NA=; b=kepwfCagrShqKyLWvLVMHA7p/75kewXGXAYXGpr/uWmrZoRvWdHaL3I8tdhEsJqc7Q kPmTwXLiNadUfJiwROA7VGeJ27JLtvTKKVjiyUIrUUiuHR4T2DZGI3LchwpU+bndmiRJ sk1r7eddktGW+F+46BopG+YagiyI0Zk1K95kWvQgB+7icKELZjovZhNtqC2cj/6p82LS ZT5QUYdBidp5jpRbRijmYXvoenard2q5T4Mz/IkNLSxsDcUV6GoSr3p9ZfSZ2wbHq/x6 BHjhp0Mjvz03X/v/C8WJ6p+eNK5bGzBmq/p3k3wT/OzLKvzlFzJUz0BGvveAf6uyMOPF K8fA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RKc0Wyrg; 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 g200si2761656oib.273.2019.12.12.00.12.41; Thu, 12 Dec 2019 00:12:56 -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=RKc0Wyrg; 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 S1728192AbfLLIML (ORCPT + 99 others); Thu, 12 Dec 2019 03:12:11 -0500 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:20545 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728160AbfLLIMK (ORCPT ); Thu, 12 Dec 2019 03:12:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576138329; 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=3vbKumHRhYv4hi2VaZ7lUNT3xifUzCtPM0UHF+6l3NA=; b=RKc0WyrgCu87JJ6B2k6WKHdDUJtltniPy+8EuVvBgTbjq6DSG0OGzD9Sc+/AC9meLkWa/4 9//MUBhSAvhIdzudevdODc2av492nKnzSxQCP3D46nG9/2OZ6m0YQQ4+oL1fMw1HC6Bjm0 KyqmNRReKrCfEq8hVpTU3S5tca+BCYw= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-76-KpY90oDPP9W1BkH8xwpGdg-1; Thu, 12 Dec 2019 03:12:08 -0500 X-MC-Unique: KpY90oDPP9W1BkH8xwpGdg-1 Received: by mail-wr1-f72.google.com with SMTP id z14so731031wrs.4 for ; Thu, 12 Dec 2019 00:12:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=3vbKumHRhYv4hi2VaZ7lUNT3xifUzCtPM0UHF+6l3NA=; b=lkY2NDLOTEVZT6EsZozehOcyww8jz4L+E42oKTKPwHB3XK4DlHK5AEOzttEFO7Ljb5 Ysh8lEiniK2jm4ZJRVrmCi1D5P7mlUL+jDOK8fyq3lgZqt0UR94Yutuyuk/x6T5ywg7d oe8KMH5Mjr9/gyF164H70WJswtk7Aus4F5SD5YbC4+zImxVtHhVXErE+wdrJH0pGpP2w OCCC/pY4DGdnZhqGVVGF/lHv/wxxI2pKs013xeEI37LMKuJU3jmOWjq0oGc0L0QK9MCv kwNapmcyDNyEoUS+0AtRHW+zuvzKKxgNtaN8PJ0ggExsVcW6qV5/6RzAKG3SX/Y0H8xL T9bQ== X-Gm-Message-State: APjAAAWN/PRD58RtxCEq3J8Er8NBOiAnP7I4gAzpq5Y4nDX4QFGq0RiJ 75OVuLf0q5P6NEaCpIHnzobItzCuPlhlisH4a6Z7z3hTxv7ZeELgq6ABGvkMkWwfQzq6ANKHXr0 d7FVqTMSZjEJYYCB3kIhCxtx9 X-Received: by 2002:adf:fbc9:: with SMTP id d9mr4916142wrs.20.1576138326656; Thu, 12 Dec 2019 00:12:06 -0800 (PST) X-Received: by 2002:adf:fbc9:: with SMTP id d9mr4916109wrs.20.1576138326388; Thu, 12 Dec 2019 00:12:06 -0800 (PST) Received: from ?IPv6:2001:b07:6468:f312:e9bb:92e9:fcc3:7ba9? ([2001:b07:6468:f312:e9bb:92e9:fcc3:7ba9]) by smtp.gmail.com with ESMTPSA id g9sm5198355wro.67.2019.12.12.00.12.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Dec 2019 00:12:05 -0800 (PST) Subject: Re: [PATCH RFC 04/15] KVM: Implement ring-based dirty memory tracking To: "Michael S. Tsirkin" Cc: Peter Xu , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Sean Christopherson , "Dr . David Alan Gilbert" , Vitaly Kuznetsov References: <20191129213505.18472-1-peterx@redhat.com> <20191129213505.18472-5-peterx@redhat.com> <20191211063830-mutt-send-email-mst@kernel.org> <20191211205952.GA5091@xz-x1> <20191211172713-mutt-send-email-mst@kernel.org> <46ceb88c-0ddd-0d9a-7128-3aa5a7d9d233@redhat.com> <20191212023154-mutt-send-email-mst@kernel.org> From: Paolo Bonzini Message-ID: <74edef57-c1c7-53cb-4b93-291d9f816688@redhat.com> Date: Thu, 12 Dec 2019 09:12:04 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <20191212023154-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/12/19 08:36, Michael S. Tsirkin wrote: > On Thu, Dec 12, 2019 at 01:08:14AM +0100, Paolo Bonzini wrote: >>>> I'd say it won't be a big issue on locking 1/2M of host mem for a >>>> vm... >>>> Also note that if dirty ring is enabled, I plan to evaporate the >>>> dirty_bitmap in the next post. The old kvm->dirty_bitmap takes >>>> $GUEST_MEM/32K*2 mem. E.g., for 64G guest it's 64G/32K*2=4M. If with >>>> dirty ring of 8 vcpus, that could be 64K*8=0.5M, which could be even >>>> less memory used. >>> >>> Right - I think Avi described the bitmap in kernel memory as one of >>> design mistakes. Why repeat that with the new design? >> >> Do you have a source for that? > > Nope, it was a private talk. > >> At least the dirty bitmap has to be >> accessed from atomic context so it seems unlikely that it can be moved >> to user memory. > > Why is that? We could surely do it from VCPU context? Spinlock is taken. >> The dirty ring could use user memory indeed, but it would be much harder >> to set up (multiple ioctls for each ring? what to do if userspace >> forgets one? etc.). > > Why multiple ioctls? If you do like virtio packed ring you just need the > base and the size. You have multiple rings, so multiple invocations of one ioctl. Paolo