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 X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81C18C4338F for ; Mon, 16 Aug 2021 21:04:10 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EF49860F11 for ; Mon, 16 Aug 2021 21:04:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EF49860F11 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:47222 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mFjmD-0001cf-24 for qemu-devel@archiver.kernel.org; Mon, 16 Aug 2021 17:04:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42954) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mFjc4-0004FZ-9u for qemu-devel@nongnu.org; Mon, 16 Aug 2021 16:53:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:37060) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mFjbz-0004De-RI for qemu-devel@nongnu.org; Mon, 16 Aug 2021 16:53:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629147214; 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: in-reply-to:in-reply-to:references:references; bh=S7ggAkVyK8OzfatSstwFFubqJUsJUIBOezVZsDS6ZwU=; b=TACZmIYeCsb9xLPsBzjNy4Cgp4XI9NT0YyIqpWl9MhBS6L/IEYj7yT2lKsFBZDwBaiMTms BztK0kPM/wRdflET+R1jLKD75RP6EvkxvZ8XFglphykqn2HEyWLwbaoK53fSzJVvpAw3dp Om5ozTAkzngsfgSyLsWY0nsH8Hho1AU= Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-486-jabUQccVNmmrJoWZvhQZ4Q-1; Mon, 16 Aug 2021 16:53:33 -0400 X-MC-Unique: jabUQccVNmmrJoWZvhQZ4Q-1 Received: by mail-pj1-f69.google.com with SMTP id s9-20020a17090aa10900b001797c5272b4so321757pjp.7 for ; Mon, 16 Aug 2021 13:53:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=S7ggAkVyK8OzfatSstwFFubqJUsJUIBOezVZsDS6ZwU=; b=NDd9IpS6KaXC1LE1L8pZpDi/ZuoSoFemVcW6s4OkUdWDqrkRrKw7umz+XHLZEf2Acu COb4beIc73RhJHZXQovbEcEubzgNW4ZfvbVPDg/XO4vdja1+GqobXQs4/idovoBlId0m PltZFJ8okSNdEm2f78eY2qnHyt6lP5eNnqjj2GXDYKvIzJvGf0ZUxoP8AtaHA3+SeWgr 5lcvmTAHR063Rar9FygyeyuYLB3XTC3uQQX1SDnRcMBw7maKdA/d04yEiarUCBHNT3WV 30NmMevs/xej4YzLDeWiS6FCrLtz057wRjrS1EsYNJtkcx8Op9ZgY4FPWeVPt4q+HacV SVAw== X-Gm-Message-State: AOAM531ep9wuc/fnuGWmfImvO1MaVqsFeOvA9WUVqvaos+0xA2Ny5oKi rw5vaSWz6b36EWWPTIAzNVsOKDDQagH5r7Pq4gkHZcrb6GTzcTRQb5zsAMMrxDbQBhjOv/G3q89 iRSvyzqpaFvnIyqeVWUfY9UXwjsbqqWs= X-Received: by 2002:a62:5f07:0:b0:3e2:7556:95a0 with SMTP id t7-20020a625f07000000b003e2755695a0mr36329pfb.55.1629147211856; Mon, 16 Aug 2021 13:53:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/g1LUHkBuhdRpPxgc2CMZ+eOKCmhRL5kM4ssgHsyC97/1055z98s4as7fBScGxzZ6TUOyphGwaHv6K124YBU= X-Received: by 2002:a62:5f07:0:b0:3e2:7556:95a0 with SMTP id t7-20020a625f07000000b003e2755695a0mr36307pfb.55.1629147211545; Mon, 16 Aug 2021 13:53:31 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Paolo Bonzini Date: Mon, 16 Aug 2021 22:53:19 +0200 Message-ID: Subject: Re: [RFC PATCH 00/13] Add support for Mirror VM. To: "Dr. David Alan Gilbert" Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/alternative; boundary="000000000000d4dab105c9b364f6" Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.698, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Lendacky , Ashish Kalra , Brijesh Singh , "Habkost, Eduardo" , kvm , "S. Tsirkin, Michael" , Tobin Feldman-Fitzthum , "James E . J . Bottomley" , Richard Henderson , qemu-devel , Hubertus Franke , Dov Murik Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --000000000000d4dab105c9b364f6 Content-Type: text/plain; charset="UTF-8" Il lun 16 ago 2021, 19:23 Dr. David Alan Gilbert ha scritto: > > However, I am not sure if the in-guest migration helper vCPUs should use > the > > existing KVM support code. For example, they probably can just always > work > > with host CPUID (copied directly from KVM_GET_SUPPORTED_CPUID), > > Doesn't at least one form of SEV have some masking of CPUID that's > visible to the guest; so perhaps we have to match the main vCPUs idea of > CPUIDs? > I don't think we do. Whatever startup code the on the migration helper can look at CPUID for purposes such as enabling AES instructions. It's a separate VM and one that will never be migrated (it's started separately on the source and destination). > The migration helper can then also use its own address space, for example > > operating directly on ram_addr_t values with the helper running at very > high > > virtual addresses. Migration code can use a RAMBlockNotifier to invoke > > KVM_SET_USER_MEMORY_REGION on the mirror VM (and never enable dirty > memory > > logging on the mirror VM, too, which has better performance). > > How does the use of a very high virtual address help ? > Sorry, read that as physical addresses, i.e. the code and any dedicated migration helper RAM (including communication structures) would be out of the range used by ram_addr_ts. (The virtual addresses instead can be chosen by the helper, since QEMU knows nothing about them). Paolo > > With this implementation, the number of mirror vCPUs does not even have > to > > be indicated on the command line. The VM and its vCPUs can simply be > > created when migration starts. In the SEV-ES case, the guest can even > > provide the VMSA that starts the migration helper. > > > > The disadvantage is that, as you point out, in the future some of the > > infrastructure you introduce might be useful for VMPL0 operation on > SEV-SNP. > > My proposal above might require some code duplication. However, it might > > even be that VMPL0 operation works best with a model more similar to my > > sketch of the migration helper; it's really too early to say. > > > > Dave > > > Paolo > > > -- > Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK > > --000000000000d4dab105c9b364f6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


Il lun 16 ago 2021, 19:23 Dr. David Alan Gilbert <<= a href=3D"mailto:dgilbert@redhat.com">dgilbert@redhat.com> ha scritt= o:
> However, I am not sure if t= he in-guest migration helper vCPUs should use the
> existing KVM support code.=C2=A0 For example, they probably can just a= lways work
> with host CPUID (copied directly from KVM_GET_SUPPORTED_CPUID),

Doesn't at least one form of SEV have some masking of CPUID that's<= br> visible to the guest; so perhaps we have to match the main vCPUs idea of CPUIDs?

I don't think we do. Whatever startup code the on the migration = helper can look at CPUID for purposes such as enabling AES instructions. It= 's a separate VM and one that will never be migrated (it's started = separately on the source and destination).


Sorry, read that as p= hysical addresses, i.e. the code and any dedicated migration helper RAM (in= cluding communication structures) would be out of the range used by ram_add= r_ts. (The virtual addresses instead can be chosen by the helper, since QEM= U knows nothing about them).

Paolo


> With this implementation, the number of mirror vCPUs does not even hav= e to
> be indicated on the command line.=C2=A0 The VM and its vCPUs can simpl= y be
> created when migration starts.=C2=A0 In the SEV-ES case, the guest can= even
> provide the VMSA that starts the migration helper.
>
> The disadvantage is that, as you point out, in the future some of the<= br> > infrastructure you introduce might be useful for VMPL0 operation on SE= V-SNP.
> My proposal above might require some code duplication. However, it mig= ht
> even be that VMPL0 operation works best with a model more similar to m= y
> sketch of the migration helper; it's really too early to say.
>

Dave

> Paolo
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

--000000000000d4dab105c9b364f6--