Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp4773321pxb; Tue, 25 Jan 2022 19:12:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJx9vBhkWNAzrvie6o9DEZOhhaowynN/O3fx3QLqaTfQVi896/sIbOfHPlFFEJFMIBFM2psz X-Received: by 2002:a17:903:124c:b0:14a:83bf:52ec with SMTP id u12-20020a170903124c00b0014a83bf52ecmr21245402plh.124.1643166720422; Tue, 25 Jan 2022 19:12:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643166720; cv=none; d=google.com; s=arc-20160816; b=bIQKFjbrcyocRQIAmZfYnUTu69merXw2ESsGs8qye2+QzADSaKUIVtrZrFDUBav2my reUPJSUHunhMhHctLoRA8rjvR+V9X3VbZWV6FMidNb18G5thwkuy4vP7Zd1rgw8U+z7O i/NSMyiD1aVgV0VWPBZbvYjVacgJ6KeJE7dOLu/2tb+KXU8APlCtuZndk05eJ1K47HJI 5rlmK26jAf9GfxoU+MlZ51/4avF0AKzuI6s+fyVgr2/xifIKf2dRioZ99fOEtQWsSCYd w88OAoOHamGaXSaqWLDDy/YX/8BozfBFroy6Vwp4Lqy99aa9jn0jnTJvVrALXz8b2hTO Tj/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=lFjB3Wm/k6WQfraTITgg2GtwyUa0VJgZe+4Lv6O2Co4=; b=fb/4cwt8mPicsCX/5Ql9TutGJTGXcZyfmudMNlWM7rt2uKOiVfUnAGTI7GffBxYe2g szTARHzxpMhemblpHgcCnw7A74RNXswHIrCVuAhREnwT7nF++qJgWsMV9YQzaltPTmZu t+0YEOux2U2F7mK+xW58Nl+DFtfg2gDhFSrnoCAGMAkLuInkZzkYwLtjx1M5HuNvQD3Q uD7tH64cxKK1XMRw3TiS3m/kcaqJoKoWTsajXIUuSM3e+YcD+RCb/4ulvI49s/ceymMk XcC4syeVkGRT4uWZK9O9MRHoBuVF6/ETwmjJ2E13WDKCXfVh4h4odqcs76Bbwkdab/Qw 9h4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=XC5zj1Eb; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r11si6986576pgr.796.2022.01.25.19.11.49; Tue, 25 Jan 2022 19:12:00 -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=@google.com header.s=20210112 header.b=XC5zj1Eb; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378114AbiAYSCC (ORCPT + 99 others); Tue, 25 Jan 2022 13:02:02 -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-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