Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2412394rwb; Thu, 29 Sep 2022 09:52:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM69DO3ECd6DiZgOZdUNGz5KtJJDYtzRGHDWklbcPfeDcp90+CJBD+kJ9ehK3iWzw1dSH9St X-Received: by 2002:a05:6a00:10cf:b0:528:48c3:79e0 with SMTP id d15-20020a056a0010cf00b0052848c379e0mr4366828pfu.18.1664470371794; Thu, 29 Sep 2022 09:52:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664470371; cv=none; d=google.com; s=arc-20160816; b=EsXXTzNbg/gXCVuXoucITE7arRXyFAE7jW7FvAUz06jvQZL/6mEgVNXMC+YC7Wa0PY CVy+jnlJafSHsDSlbyMfOzUEMIrM3MAu3xXo3OIAlIGYeFXkpdKnQoJxVGZabtk4Bg/J F52rbMZG7deadHQElm6BLARNsS8qdLBN+6xgyI5RUp/4j5rwYgg+mm7MCCyBnX7Ty0vR ID6dt2fgbswLoN7xQegTkoAd9VB3ICn6URz9mmfMxnQZrbmLnCQeuIBf8y1lD5BqPa73 0ALRfQ00L5HFKlRH0npVXWh8jJG77WB0Axr3HfeEnNoFzJlDOh4QJ6VmKw8TlQXaXJ69 BypQ== 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 :organization:from:references:cc:to:content-language:user-agent :mime-version:date:message-id:dkim-signature; bh=cBH/YMCh8jX5plN90vVsJmDCGb+vheY1ZW2kHBpdn5E=; b=IkxwTifeIpp17CjPf9JRyehNa1gqblW+Z+sqlOw9VG2lF63b+RqSUXVaQJid69T7rq EzRZu2C6QnPaXFXGLOKFqf8j2OyBG20p+zCU2VAjvJ4UXypXlwYsRZCQL3alfKvtzw4a i3YvwqMrLiy3gNpx5YEZsW2lwf1WBnw0ESuTCepvVXkHfeCmspBzHZMPx9/c0kaftLaf ccR77UPIiOnRFM8dUPaCySuKi6lqUwvTCMMMniB8ZK7M2lVEIBPFn9f5Tjuec5jepI0+ n+ecy/dgrdJUiMn+LyAf4k4ySf2ljz/iH7J+4jTbU7jj6cNKqWjNAS/D/Aj46Fi98oFJ Jceg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Xu+26igA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h18-20020a635312000000b0043941e55335si145160pgb.842.2022.09.29.09.52.38; Thu, 29 Sep 2022 09:52:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Xu+26igA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S235776AbiI2QBM (ORCPT + 99 others); Thu, 29 Sep 2022 12:01:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235669AbiI2QBJ (ORCPT ); Thu, 29 Sep 2022 12:01:09 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF686D12EC for ; Thu, 29 Sep 2022 09:01:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664467263; 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=cBH/YMCh8jX5plN90vVsJmDCGb+vheY1ZW2kHBpdn5E=; b=Xu+26igAWaaTQUt8Yui5QOhauHzYBE9RZS82dbJpAKEkeyrWLYGKhdP05+wwcyh2ciLQXv A0b384mJ8dl8CKUck3K0enNRfubMDwXthQfYtzbOEKic/Zu+K8DftVHCQ1vttdX3kcNhT3 L8jHdDt8TqofsqPTWz4PxWiLzbIpCuQ= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-558-2jgslHDaMOuPNA9QYWidXA-1; Thu, 29 Sep 2022 12:01:02 -0400 X-MC-Unique: 2jgslHDaMOuPNA9QYWidXA-1 Received: by mail-wm1-f69.google.com with SMTP id f25-20020a7bc8d9000000b003b4768dcd9cso589720wml.9 for ; Thu, 29 Sep 2022 09:01:01 -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:organization:from :references:cc:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date; bh=cBH/YMCh8jX5plN90vVsJmDCGb+vheY1ZW2kHBpdn5E=; b=cMjmEZp301+qe2TKmopoWc4hLX/4pe/j/7gwF6RqBROgmwJAv0k9N690Tg8H459Rm4 QN6USasmOfuO+N/KxWuInB9X0TSBuN+Q0M0ETq6uawdo62QrJM0Me6LWyAZAZOqX2nqx CU1mTX9QLn5UbSC6w8BO+2npCzpr7guvS3gG5hxI63ywPV1muz7IMwYLWDxJK0Hz2dm7 QNqu06+xtmHj1cJTrqCkAFMqNUDe9YWMYNHrSx8dI6iH6SeIWH1ozYGNETLEjNcruXQh U9N72BliMGZrs6+Q+gS1t3opghzc4GoWxksQs7GdhhATL6ic/eoEmmvy8o84bOn+LaUn Xrmg== X-Gm-Message-State: ACrzQf3yWV7pu7R89m3mX6N4Kid6Ycvh2YeaM/G5TQQmj4DAyzaE66OI UQvo55xiGjtf1mJ+ywoX0EYQpx6tQ0tE/pS6pJa7EYOiwt+8sEtRunuMW8GzR+1gtzyjitKeosL oayAjNHzvV0xDlDPzMMEGLTpO X-Received: by 2002:a05:6000:1565:b0:22c:8da7:3cf8 with SMTP id 5-20020a056000156500b0022c8da73cf8mr2821141wrz.688.1664467259518; Thu, 29 Sep 2022 09:00:59 -0700 (PDT) X-Received: by 2002:a05:6000:1565:b0:22c:8da7:3cf8 with SMTP id 5-20020a056000156500b0022c8da73cf8mr2821099wrz.688.1664467259167; Thu, 29 Sep 2022 09:00:59 -0700 (PDT) Received: from ?IPV6:2003:cb:c705:ce00:b5d:2b28:1eb5:9245? (p200300cbc705ce000b5d2b281eb59245.dip0.t-ipconnect.de. [2003:cb:c705:ce00:b5d:2b28:1eb5:9245]) by smtp.gmail.com with ESMTPSA id m21-20020a05600c4f5500b003a5f54e3bbbsm5461403wmq.38.2022.09.29.09.00.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 Sep 2022 09:00:58 -0700 (PDT) Message-ID: <75243b83-f85d-3d51-7df4-3e95abbb7ef4@redhat.com> Date: Thu, 29 Sep 2022 18:00:56 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Content-Language: en-US To: Paolo Bonzini , Sean Christopherson Cc: Emanuele Giuseppe Esposito , 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: <55d7f0bd-ace1-506b-ea5b-105a86290114@redhat.com> <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> From: David Hildenbrand Organization: Red Hat 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=-6.3 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_NONE,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 > The main cases are: > > - for the boot case, splitting and merging existing memslots. QEMU > likes to merge adjacent memory regions into a single memslot, so if > something goes from read-write to read-only it has to be split and vice > versa. I guess a "don't merge this memory region" flag would be the > less hideous way to solve it in userspace. > > - however, there is also the case of resizing an existing memslot which > is what David would like to have for virtio-mem. This is not really > fixable because part of the appeal of virtio-mem is to have a single > huge memslot instead of many smaller ones, in order to reduce the > granularity of add/remove (David, correct me if I'm wrong). Yes, the most important case I am working on in that regard is reducing the memslot size/overhead when only exposing comparatively little memory towards a VM using virtio-mem (say, a virtio-mem device that could grow to 1 TiB, but we initially only expose 1 GiB to the VM). One approach I prototyped in the past (where my RFC for atomic updates came into play because I ran into this issue) to achieve that was dynamically growing (and eventually shrinking) a single memslot on demand. An alternative [1] uses multiple individual memslots, and exposes them on demand. There, I have to make sure that QEMU won't merge adjacent memslots into a bigger one -- because otherwise, we'd again need atomic memslot updates again, which KVM, vhost-user, ... don't support. But in the future, I think we want to have that: if there is no fragmentation, we should only have a single large memslot and all memslot consumers should be able to cope with atomic updates. So in any case, I will have good use for atomic memslot updates. Just like other hypervisors that (will) implement virtio-mem or something comparable :) [1] https://lore.kernel.org/all/20211013103330.26869-1-david@redhat.com/T/#u -- Thanks, David / dhildenb