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 8C91DC433FE for ; Tue, 25 Jan 2022 18:02:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385827AbiAYSCH (ORCPT ); Tue, 25 Jan 2022 13:02:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1386967AbiAYR7x (ORCPT ); Tue, 25 Jan 2022 12:59:53 -0500 Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A34B4C061753 for ; Tue, 25 Jan 2022 09:59:52 -0800 (PST) Received: by mail-lj1-x231.google.com with SMTP id t9so6215666lji.12 for ; Tue, 25 Jan 2022 09:59:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=lFjB3Wm/k6WQfraTITgg2GtwyUa0VJgZe+4Lv6O2Co4=; b=XC5zj1EbYhH7i02SUszkuxdEq0CFUvpTJK9gm5UwhigE44rfmwdE6x6nljyc4wBmr8 +9gzi8AOlUFfPFKEFqIwj+klWB2qDZbQlAPOxGka+SkqcGN9CjTVC/vwS1V1i/oD0S3+ S8hPQ3oIKDhd1uMCbsp5GLhly7UnWipGCxHLSRRYGY8TEOKQGZgJPMj5E+YcrG3H7ut5 7mFlRRRHYV3rnD9QBRZtPiCyULiclVVv7bpi9AsacwAYK3p7HDPXTtboG07mH0LllT/Y nGLk5GMhdQNROjEBLCxP4tUiMaaqyA9Dy065MJcIDkpo5ihz6CFmqFHJiUd1/eegzCxE pVrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=lFjB3Wm/k6WQfraTITgg2GtwyUa0VJgZe+4Lv6O2Co4=; b=7GMlMER7TNkYZEFRyO2YR1AAJrBVw+rzbf2B3zTFRHOOgSMFH5IJ+s/eOZmVCBnKuX WTCWnBcyXORJH0/OaNpxSC0uJCdIV/bJEIBQmLDyWMp9nDOQhH6NI+C50d5zChzvTpZa JrmDEyySWDrO/c7Wj2I8+PJSfpsPyI/ri0QknyG4OePjTVBnyPVP8vRD9DQNLxFvosH0 25Y46QF76lkjYgEmOpyzGQ5z2Q7B59+fxpbZ5dO1OMV707CCgRlzQeDdy1SV+dJFo97h FUwGHXqV46RzoRXNIUGUeQsiRI/OeDIm+8mMvKxsmawtZgZDD+GyVjwe34ldQb1+8+2q 31vw== X-Gm-Message-State: AOAM532djfaQ+FNW+x7FBZjJa6oDVFs8FoMHr6I1QZ+ujp5nig5CfLBP YDuzJBlSp0AWsa4jMKVXza5fSufI/dKcxi+kTIDXDg== X-Google-Smtp-Source: ABdhPJxQ9nD4vwnn29xZGWj3D6iRwIXJNsR5YJoMUhf3PKdCUcgDUmQUmPwG7N4/S9I9QoC2u/Aky+rHtMS1l9BwtgY= X-Received: by 2002:a2e:8e73:: with SMTP id t19mr3579753ljk.132.1643133590805; Tue, 25 Jan 2022 09:59:50 -0800 (PST) MIME-Version: 1.0 References: <20220118110621.62462-1-nikunj@amd.com> <20220118110621.62462-4-nikunj@amd.com> <04698792-95b8-f5b6-5b2c-375806626de6@amd.com> In-Reply-To: <04698792-95b8-f5b6-5b2c-375806626de6@amd.com> From: Peter Gonda Date: Tue, 25 Jan 2022 10:59:39 -0700 Message-ID: Subject: Re: [RFC PATCH 3/6] KVM: SVM: Implement demand page pinning To: "Nikunj A. Dadhania" Cc: Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Brijesh Singh , Tom Lendacky , kvm list , LKML , Bharata B Rao Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 25, 2022 at 10:49 AM Nikunj A. Dadhania wrote: > > Hi Peter > > On 1/25/2022 10:17 PM, Peter Gonda wrote: > >> @@ -1637,8 +1627,6 @@ static void sev_migrate_from(struct kvm_sev_info *dst, > >> src->handle = 0; > >> src->pages_locked = 0; > >> src->enc_context_owner = NULL; > >> - > >> - list_cut_before(&dst->regions_list, &src->regions_list, &src->regions_list); > > I think we need to move the pinned SPTE entries into the target, and > > repin the pages in the target here. Otherwise the pages will be > > unpinned when the source is cleaned up. Have you thought about how > > this could be done? > > > I am testing migration with pinned_list, I see that all the guest pages are > transferred/pinned on the other side during migration. I think that there is > assumption that all private pages needs to be moved. > > QEMU: target/i386/sev.c:bool sev_is_gfn_in_unshared_region(unsigned long gfn) > > Will dig more on this. The code you linked appears to be for a remote migration. This function is for an "intra-host" migration meaning we are just moving the VMs memory and state to a new userspace VMM on the same not an entirely new host. > > Regards > Nikunj