Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2362805rwb; Thu, 29 Sep 2022 09:14:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4LWyHmxsUSZyNENtzVATv8O80w4G/nqrFr6jleNF5YSbg9UYyyaOo7+N9HkLddk2HhLl5z X-Received: by 2002:a63:4965:0:b0:439:7a97:383c with SMTP id y37-20020a634965000000b004397a97383cmr3460299pgk.462.1664468082538; Thu, 29 Sep 2022 09:14:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664468082; cv=none; d=google.com; s=arc-20160816; b=EJCi6OhqJmrTsnKfUyE4kGq6m88Orio06d3Hg+3AmwpGwXazeAqvN6qkEaiIHCZ43m PT/SbrKqkTOcwnOkR2dajkdpK2Ua6v/VzrzdSF7Wf321fy1nTy4ArDeHMHSTAlbXhwM9 JcIxdBnUa9kIxFhypuUS/6OttrQY1YANn5h+4/ow5fKOZ2Bssh+TlV1OS8PAYbqiTTIj ZZWZW+6vNlLxuvvmCaWT1H0c3zfD3Ua40wHK9Vh3Kb8Ulg8YytwcsYGMN+hzXON5I63K CLby3UNmzQhCWy3n+/DmVezdF6K4x8zHGJ103DZnoxiB5jcDUH8/ks0pL22hF1wi2Yh2 7f7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature; bh=AOs9j6EKBWVbeXkdg2VQcpSwEuz7CVtI8gZySG/+hp4=; b=pi95Bb2na3NnZHWQjVdOCj4be45lttfbBDS+ooyUMIY+UlsXah1nKdgL5XzZf14hL3 dGj8RnxuqkayPXCIM7i6GS45Y4IQF+fzxJIM8sfcV1g+S90w+BA/LYI0z8y7Msp8qInz baAxBj1z7U46XVDTBjnMvev1dgAcQr6GUYFQ3iQwEbK1tCt067V8kVxMQfrm0sq5vJJQ V0nZCwScNkjYPN/qWFX+gN4AIZyNANeobEWEXAFkU3bdlLWv/CBAvXm/YYnOn9ttWyL4 TJU7ZcOpthHe94yYAby8hBqQ9k5rQILOz7YDwzH/FJzKiUFT9PO9U7QQAealQznikJb9 WNVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=M+Fw2qRG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id k11-20020a170902d58b00b00176d21b5bfasi114361plh.242.2022.09.29.09.14.28; Thu, 29 Sep 2022 09:14:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=M+Fw2qRG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S234740AbiI2Pnx (ORCPT + 99 others); Thu, 29 Sep 2022 11:43:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235962AbiI2PnC (ORCPT ); Thu, 29 Sep 2022 11:43:02 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA0F5128A29 for ; Thu, 29 Sep 2022 08:42:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664466124; 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=AOs9j6EKBWVbeXkdg2VQcpSwEuz7CVtI8gZySG/+hp4=; b=M+Fw2qRG4cZC8Ov+dNvz12/Iyzr+cMDVdIqLumsgKFa8oqTd+7OTweFVEHgyQukPIlTFkc sjEkN+IgN4h3TgZ0edCfuriRLhCcGxiClLtQaA1J/1+HCTyNWjGO1xU36APWMHZPb8WK2y zS2NSgGbn57VmljgnzoRInAGHKyDr+w= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-271-tmJme51MPg6BNx_6JDpG9g-1; Thu, 29 Sep 2022 11:42:03 -0400 X-MC-Unique: tmJme51MPg6BNx_6JDpG9g-1 Received: by mail-ej1-f70.google.com with SMTP id xc12-20020a170907074c00b007416699ea14so897182ejb.19 for ; Thu, 29 Sep 2022 08:42:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=AOs9j6EKBWVbeXkdg2VQcpSwEuz7CVtI8gZySG/+hp4=; b=5cRcv8dHLNoxF/3iC061i7Ptfk8EKqF6zHQYPhr7o88MyqdNPvjgpWkicOnRz69+6y CRkihUEklc1T4I+GYWYlYuaLLoeGqmYw1Gds4z8E33SJsYHzUJ7IYhxjmOoL7HbRqul9 kSxH/z3zOXouAD6dzrpw4aLEWBcN8Qhsr87WG6u+7ApsQJ7II5Nminym2tpn1ygRci9t iqOkJIBH6Yxsuvfop6dEK8/Let3Ez3IgWxfZxS7AjT3dKlYdQ1Llk0Mgy0AKBsmxHYro Q+k0flYrN7FtU2zC/07+wzZf35huu+feyl8iQnB3PmL/qFzONOZh06QfUSuA5wkihE9z Svgg== X-Gm-Message-State: ACrzQf1oLOv8XMlp1+x9PE/OpDm3Ucri4aKdyYzqii2Xb8pFx+gpzTYK HKQrSVYTt5edICdCpEaydTUxNyr3UdCZ1+6mj/TV3ZXCfoQ4PYDCoxilmb3QNCGjByTbqJv7/zw OSkZ23HpP/dCSwxoL2DDfKNhT X-Received: by 2002:a17:906:ee86:b0:741:89bc:27a1 with SMTP id wt6-20020a170906ee8600b0074189bc27a1mr3298325ejb.725.1664466122055; Thu, 29 Sep 2022 08:42:02 -0700 (PDT) X-Received: by 2002:a17:906:ee86:b0:741:89bc:27a1 with SMTP id wt6-20020a170906ee8600b0074189bc27a1mr3298314ejb.725.1664466121822; Thu, 29 Sep 2022 08:42:01 -0700 (PDT) Received: from ?IPV6:2001:b07:6468:f312:1c09:f536:3de6:228c? ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.googlemail.com with ESMTPSA id x2-20020a1709060ee200b0073dde62713asm4159050eji.89.2022.09.29.08.41.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 Sep 2022 08:42:00 -0700 (PDT) Message-ID: <5a352ff5-5d37-e92d-3d4b-c70a5d11c41b@redhat.com> Date: Thu, 29 Sep 2022 17:41:59 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Content-Language: en-US To: Sean Christopherson , Emanuele Giuseppe Esposito Cc: David Hildenbrand , Maxim Levitsky , kvm@vger.kernel.org, Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , linux-kernel@vger.kernel.org, Like Xu References: <111a46c1-7082-62e3-4f3a-860a95cd560a@redhat.com> <14d5b8f2-7cb6-ce24-c7a7-32aa9117c953@redhat.com> <3b04db9d-0177-7e6e-a54c-a28ada8b1d36@redhat.com> <8534dfe4-bc71-2c14-b268-e610a3111d14@redhat.com> <637e7ef3-e204-52fc-a4ff-1f0df5227a3e@redhat.com> From: Paolo Bonzini Subject: Re: [RFC PATCH 0/9] kvm: implement atomic memslot updates In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/29/22 17:18, Sean Christopherson wrote: > IMO, KVM_MEM_DISABLED or similar is the way to go. I.e. formalize the "restart > page faults" semantics without taking on the complexity of batched updates. If userspace has to collaborate, KVM_MEM_DISABLED (or KVM_MEM_USER_EXIT would be a better name) is not needed either except as an optimization; you can just kick all CPUs unconditionally. And in fact KVM_MEM_DISABLED is not particularly easy to implement either; in order to allow split/merge it should be possible for a new memslot to replace multiple disabled memslots, in order to allow merging, and to be only partially overlap the first/last disabled memslot it replaces. None of this is allowed for other memslots, so exactly the same metadata complications exist as for other options such as wholesale replacement or batched updates. The only semantics with a sane implementation would be to destroy the dirty bitmap of disabled memslots when they are replaced. At least it would be possible for userspace to set KVM_MEM_DISABLED, issue KVM_GET_DIRTY_LOG and then finally create the new memslot. That would be _correct_, but still not very appealing. I don't exclude suffering from tunnel vision, but batched updates to me still seem to be the least bad option. Paolo