Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp282186pxu; Fri, 4 Dec 2020 03:14:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJyPYHtU5v1QIVK7p41z9TwoQbLNlnE7M0eHh1J0RvtN2KDvz5BdvlCb/Xdi6XgHa49gIn8Q X-Received: by 2002:a17:906:2e55:: with SMTP id r21mr6693008eji.46.1607080471422; Fri, 04 Dec 2020 03:14:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607080471; cv=none; d=google.com; s=arc-20160816; b=cSNj+IfhgeBr0h9uXP7daWhr7LKDLJJZOLCQUUbAYc6+95g62YnBcmBUYi7adOMGEt UQ8J4Y8jw7yNwQKdpte1QJS9eE9pRc+Tu4iigpiDTEGCFHKX4qbeCt1AJPQ5FjjROWzv kv6Vjq4SW3EEB5YsuXMpc9qGq6do0CZhf2j7hH8ZUGJYKvehaKSV9KxKbtmrY1fRcuQ8 S/XMYW7c2o4yqRyTONK4B2Rj27wv0IYdFe5zlcIH03JgdDscxVERqxd9JCzJ0chSXUO4 iFFlXRt9XCET4Oqu0I9y+wTlk3QHpoRffiFbe3zTeg0tpx/Io/lxApdQp/SKslXS0I9X rCxw== 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:from:references :cc:to:subject:dkim-signature; bh=/j9o0aMtbK+iCXtL48XT9SzYeWgplswBUn1K4plIIJo=; b=TTYJIsmkeGUipMl5J+lpmYA5r8/oOGsy3uFdyBurKCwbmRHaz01sDqc+kYiTZKGYR9 1U5B63WpSN5101wI8ZD3onXLddl+TcailrXmc9wrQUx328Jn7aceK+p1PRPDsUOSoJTj /k3J/omZixNUVdXGY4krhVfhGnbbCxuyflv56TX9O6Gn5MdQhs6Af/zzjFy21x55DKMz UqMSABY60fuhAajD4b7BYLB7tnv15TxeWUBjaVvOMq+KjE8XtovwmiS2FhVEoXNyARPH T+DdHf9+ONh9V4aEDCaHw2vhRWgfKfwJvJefQnX/5B6x6KM5E8VMIQYKJCxLLEmC8KgS u5CQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fp289rx9; 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 n18si1084268ejk.69.2020.12.04.03.14.08; Fri, 04 Dec 2020 03:14:31 -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=fp289rx9; 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 S1726841AbgLDLMe (ORCPT + 99 others); Fri, 4 Dec 2020 06:12:34 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:30627 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725839AbgLDLMd (ORCPT ); Fri, 4 Dec 2020 06:12:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607080267; 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=/j9o0aMtbK+iCXtL48XT9SzYeWgplswBUn1K4plIIJo=; b=fp289rx9wlKJ0rZAg+MVlxjtYf4JaABm/MM/c6VkZ8jdC1ho8HUbmnkcoQGcrkgyNtnTHN IBSuuix/FM1TSX4KpO+xOOuZaE45vXBfeq7XB7SEmTMmfnWOruNCbRI9GAO+2daudPNISf O2yibLj6+73kr+3bID4HALFiJHLZSE4= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-281-ylqHlADAMzyMErBken8WHg-1; Fri, 04 Dec 2020 06:11:05 -0500 X-MC-Unique: ylqHlADAMzyMErBken8WHg-1 Received: by mail-wr1-f69.google.com with SMTP id m2so2429605wro.1 for ; Fri, 04 Dec 2020 03:11:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=/j9o0aMtbK+iCXtL48XT9SzYeWgplswBUn1K4plIIJo=; b=ovSo3W+TzS0rDYtZ3Xs0YInQiNEvOQNQ1eKdD3nNuj6lfFny5HGMsqhgbAB3gm+eWm yXC9pOWJnyUGR6y+uPZOZJyrszAiTmCfs4mP6YHD8FqXvbPmlQTDa1dk25UnlhwPtb16 0878CtyF7AO23npFKNMgnOL9kO9OCv0FF3spTQxmq01lCslFm2WtxjEkW0BSa48iTY3L 7DvxvCAkTNzQ8fsiX4I3yCut6p70LlSLgS6Cst+bV3jUE2scWPWXRRMondXSlDaWKZRr y3Mdl3jMYh7UNpTpOC5iS++wJtCap10RCBE73NYb4alun79z7VLzl2hZ8FmpVsMUkWdv oQOg== X-Gm-Message-State: AOAM530WkJahSz2eF8ikm7XXNSo9PkEaDnCuYN1WF9yrvmaTwW4H3+rj dJaDCCHOPcIiTssDJ4JNIblQYItqAnOqkjn7Pwy13rgg8OR3ruPClYv6ugerDLPkt8bJn2L3TnR tWe/gkKGSITUwm2fbtQ9F3/qS X-Received: by 2002:adf:e544:: with SMTP id z4mr4399589wrm.83.1607080264428; Fri, 04 Dec 2020 03:11:04 -0800 (PST) X-Received: by 2002:adf:e544:: with SMTP id z4mr4399554wrm.83.1607080264236; Fri, 04 Dec 2020 03:11:04 -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 y7sm3128192wrp.3.2020.12.04.03.11.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Dec 2020 03:11:03 -0800 (PST) Subject: Re: [PATCH v8 18/18] KVM: SVM: Enable SEV live migration feature implicitly on Incoming VM(s). To: Ashish Kalra Cc: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, joro@8bytes.org, bp@suse.de, Thomas.Lendacky@amd.com, x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, srutherford@google.com, rientjes@google.com, venu.busireddy@oracle.com, brijesh.singh@amd.com References: From: Paolo Bonzini Message-ID: <5af7ca40-69eb-0870-7bf2-9bc17685d03b@redhat.com> Date: Fri, 4 Dec 2020 12:11:02 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/05/20 23:22, Ashish Kalra wrote: > From: Ashish Kalra > > For source VM, live migration feature is enabled explicitly > when the guest is booting, for the incoming VM(s) it is implied. > This is required for handling A->B->C->... VM migrations case. > > Signed-off-by: Ashish Kalra > --- > arch/x86/kvm/svm/sev.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c > index 6f69c3a47583..ba7c0ebfa1f3 100644 > --- a/arch/x86/kvm/svm/sev.c > +++ b/arch/x86/kvm/svm/sev.c > @@ -1592,6 +1592,13 @@ int svm_set_page_enc_bitmap(struct kvm *kvm, > if (ret) > goto unlock; > > + /* > + * For source VM, live migration feature is enabled > + * explicitly when the guest is booting, for the > + * incoming VM(s) it is implied. > + */ > + sev_update_migration_flags(kvm, KVM_SEV_LIVE_MIGRATION_ENABLED); > + > bitmap_copy(sev->page_enc_bmap + BIT_WORD(gfn_start), bitmap, > (gfn_end - gfn_start)); Why? I'd prefer the host to do this manually using a KVM_ENABLE_CAP. The hook in patch 12 would also be enabled/disabled using KVM_ENABLE_CAP. Paolo