From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97A88C433FE for ; Thu, 29 Sep 2022 16:01:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235803AbiI2QBN (ORCPT ); Thu, 29 Sep 2022 12:01:13 -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-Google-Smtp-Source: AMsMyM4dbNs/yaGi1fN0VvWkuDCL5173wC2ulxS1iDwO1YOCsCp6F8H6xxIA3tlmG2eFttiHIIrOkw== 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 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