Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp511370pxf; Thu, 11 Mar 2021 08:31:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJzvVvGnK3LeOFrDrrr7oY1ZibHA1CHtAIc1h/kSmrBj+HmRN92EPU5nKowyAekFPU0aN53x X-Received: by 2002:aa7:dd97:: with SMTP id g23mr9301132edv.154.1615480290746; Thu, 11 Mar 2021 08:31:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615480290; cv=none; d=google.com; s=arc-20160816; b=hg2Qq02vwDqYHpHRPpvKJIlmPRyh45dJCcxm5DQUV6P/Sn0IbI7Y25O9jc+XkgFdF0 x3gqI2Ih0p95w930a/WAKjHdL3MzAySbzZv8RkCpnDhDEhHR4U0UNSLRfhGBer2BK/zz crbbfsv/W/fEIkLZj/JlW/9jk0lucd0pRKu7YWMyTZ1v4moeBLlK+e2FBLS48mgmOolB F3ydMqm28bozzNvHUjcEqA0aHRxXnYEfS6qc39RXHMm9srhD2QaX5RLX2pVg2DHUwEQ8 E9YJLTZrZxp8IrWk0ieHUv6Tsj2js0iLNpg+Img08HbYvm/Kj522YT4UHo45UCdmo6ku q15Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:subject:from :references:cc:to:dkim-signature; bh=kRJOqyfDaUlicETbZC6GzKoFoUyCtPY6jEDl336fEOc=; b=d0UsLc4ZYso18LC723nPEWuDZGu7h70U/wCxj9Ryf1JkHNtKSEwMyGCm8GsA8KOL/L 6b7stjXVjdIJH9C72Tsjlfqsf0Z8hbPtSH16IEe34t5gG/Nvc6HUbvlbWeI+fC/+6tTP p9LyA983twMgqquC+2lEIsvO0kCnie1mmd9jUuucJlnlCgWSAzqHioJLWQrpm3Pvt59w UZDw0lVQ5uZ1fS+qT2PZ5L51DUz4MCTt8qoqIGfHfIZoASyERdraN3SGXfm+mD9AmdFf J67u06QpheZfN80x7jOnppy4XTJywFRa87zhiaUzxgFBh9Vo314yPwLDwQuKb7skDHy1 lnwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ghhA4gy9; 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 r9si2219574edy.4.2021.03.11.08.31.06; Thu, 11 Mar 2021 08:31:30 -0800 (PST) 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=ghhA4gy9; 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 S229470AbhCKQaG (ORCPT + 99 others); Thu, 11 Mar 2021 11:30:06 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:53887 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233710AbhCKQ3m (ORCPT ); Thu, 11 Mar 2021 11:29:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1615480181; 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=kRJOqyfDaUlicETbZC6GzKoFoUyCtPY6jEDl336fEOc=; b=ghhA4gy94rDyBnhRWpGN9/puLp/kDc9W6OmKimw2w2dGuQP/G+JxPFjUF0GvsptDx1urzd I2FcpJqYIxb91H2L1e0qYDe0GygIDu1zO+JZPbokt8tjJ8GspuR3ktNuEDwFPJFBa3fKau f/hMPNbCROaOU2Y9gotQWAe7zWqo7Bk= 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-38-RFti_eNzP8i70OFniEU0SA-1; Thu, 11 Mar 2021 11:29:39 -0500 X-MC-Unique: RFti_eNzP8i70OFniEU0SA-1 Received: by mail-wr1-f72.google.com with SMTP id p12so7171998wrn.18 for ; Thu, 11 Mar 2021 08:29:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=kRJOqyfDaUlicETbZC6GzKoFoUyCtPY6jEDl336fEOc=; b=ZfwUZZHK+TyuHlLfwSTD7lwMXhDnvojr0OfZm0zdSaO4roh0bf7K84cE6H99Quw/4B nvTLd1wrwMhHvLoV5MFVSf0rH5ZdgkVWQH8Q7b3RB03mP1v2P6eoyyaEZDLhB7HMVW0j YPddmSUFRlgrNLFTzahyUETWgjIDQktVxYGTp/7hc0RwRop3gRHbsnuc08lIyyfVrMLr 10yspH8ClsHO6j4oZ7esELfbZdRk/hO2AHumtmIPceF1dQbW4VcqgR2niOdZdmjteWsS b/rnt36FbVpvM3si3f2Z3lyPP7bI4aNgzezldj20/Wz6yzQKdOXMPVvucs2lWnzBtVx6 rbVQ== X-Gm-Message-State: AOAM531vlqXjauPvXm4xqNVXzzrENtAh43zwbQ++QiBUrqfv5fdO0+lS ssy6YnXPi6eydjsYqv9NwbTQ87spTXDQuGtTqFbdCyutYt/RnnoDO45/BO5MELzn6wBD/k7MIRo pE64jPg0m6gI3g2ky9piLnS0M X-Received: by 2002:a1c:22c2:: with SMTP id i185mr9007783wmi.99.1615480178189; Thu, 11 Mar 2021 08:29:38 -0800 (PST) X-Received: by 2002:a1c:22c2:: with SMTP id i185mr9007767wmi.99.1615480178025; Thu, 11 Mar 2021 08:29:38 -0800 (PST) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id x13sm4522105wrt.75.2021.03.11.08.29.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 11 Mar 2021 08:29:37 -0800 (PST) To: Tobin Feldman-Fitzthum , natet@google.com Cc: Dov Murik , Tom Lendacky , x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, srutherford@google.com, seanjc@google.com, rientjes@google.com, Brijesh Singh , Ashish Kalra , Laszlo Ersek , James Bottomley , Hubertus Franke References: <20210224085915.28751-1-natet@google.com> <7829472d-741c-1057-c61f-321fcfb5bdcd@linux.ibm.com> From: Paolo Bonzini Subject: Re: [RFC] KVM: x86: Support KVM VMs sharing SEV context Message-ID: <35dde628-f1a8-c3bf-9c7d-7789166b0ee1@redhat.com> Date: Thu, 11 Mar 2021 17:29:35 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <7829472d-741c-1057-c61f-321fcfb5bdcd@linux.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/03/21 16:30, Tobin Feldman-Fitzthum wrote: > I am not sure how the mirror VM will be supported in QEMU. Usually there > is one QEMU process per-vm. Now we would need to run a second VM and > communicate with it during migration. Is there a way to do this without > adding significant complexity? I can answer this part. I think this will actually be simpler than with auxiliary vCPUs. There will be a separate pair of VM+vCPU file descriptors within the same QEMU process, and some code to set up the memory map using KVM_SET_USER_MEMORY_REGION. However, the code to run this VM will be very small as the VM does not have to do MMIO, interrupts, live migration (of itself), etc. It just starts up and communicates with QEMU using a mailbox at a predetermined address. I also think (but I'm not 100% sure) that the auxiliary VM does not have to watch changes in the primary VM's memory map (e.g. mapping and unmapping of BARs). In QEMU terms, the auxiliary VM's memory map tracks RAMBlocks, not MemoryRegions, which makes things much simpler. There are already many examples of mini VMMs running special purpose VMs in the kernel's tools/testing/selftests/kvm directory, and I don't think the QEMU code would be any more complex than that. Paolo