Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1585902pxb; Tue, 17 Aug 2021 15:53:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrjm81nt8KHOiBF/dpHgmUXtTwr1cTH8MinMh5UlXso0aOkUYigGx8RXBB/MK8e7aZWiXo X-Received: by 2002:aa7:dcc2:: with SMTP id w2mr6279036edu.192.1629240790223; Tue, 17 Aug 2021 15:53:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629240790; cv=none; d=google.com; s=arc-20160816; b=kiUaSB1IKJym41iO6pB5GNU87W6AQMRJNQhz/H3/m6brtVSE4SevKWJ6ZY+uRR/jGD rB8gWf1KQt9em6s7hp69jPDKQ8PC1uyw6pNy1qyTB2OOVbE0UxELyUAWXu9cPPcobzno LwZIxLDvLgABQ6+6FDTfHNOyN9nRH0dogncssH7bBku/ppCsHUrcN96GeRHO3/HX/fgq UjWecoguknuQTaU0p/NQ1vr1sc7YeyIXxZjjV4zAdJkPnDSnLGJ6VNuVSaixHkPXUeaf J1CKMn84kWcQ+/zhuypaJX3pYamcBKF23iYWq5cGWmp1j+C1U/XKFIz1HDCy24dkIsZ5 0INA== 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=kJF4ZjAfLVqVGakZdtq7slT5DgNeQPyF9be1SJwj1Hw=; b=VOI+Ny5v/bbKYnvKpiFFXseTCnAiz+xf4ZQPkxSe719FzkhoZU3SORsvh398TeHh8f njgI0ffxqy4pBhTPkpICPU3F2VnC2tUivebvmVXt37d4mhOIeajGPekdmQr+GSUuPDNz G08DixLZKfm2tDrlHIvwzYwWkXq6fd/n2bQB6Sf0J8ClDWVdy17J2eIJyGlCUfi6wLAo fGF5SG/EOj6EVE7XuOf8P04dR8iBUQe/IZLeQjUue+y4njdGewfk3fAvot//F10rf3y6 /wGztYLVaLbLvhqV37Pg1l8aOA+Fge0PHqQrlVh+TtUJQB6j+hgb6nrmi9l7ISXI0iZS IeCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=WO9c2QU3; 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 d12si3962663edz.79.2021.08.17.15.52.45; Tue, 17 Aug 2021 15:53:10 -0700 (PDT) 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=20161025 header.b=WO9c2QU3; 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 S234889AbhHQWvd (ORCPT + 99 others); Tue, 17 Aug 2021 18:51:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233171AbhHQWvd (ORCPT ); Tue, 17 Aug 2021 18:51:33 -0400 Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1822C0613C1 for ; Tue, 17 Aug 2021 15:50:59 -0700 (PDT) Received: by mail-il1-x134.google.com with SMTP id u7so190766ilk.7 for ; Tue, 17 Aug 2021 15:50:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kJF4ZjAfLVqVGakZdtq7slT5DgNeQPyF9be1SJwj1Hw=; b=WO9c2QU3Rm2pxOkmPo3AjUE8xD5dFp5H0PSGK5grzjQmciMODNSL22Zp4RSjoEY94H YfcPOe6WNeAWprC+6IYhHnqWMMYcefPncqKab6WFpoYh6SgO5pPaRz24RgIFR0BB7hZd hZwXrGGKflEsK54TiEY7x007y5705IjpZ3dVDtKptBdiZDJdqVlj7kl8BdNcEFZXj64a ggLzVwkDsJDp83zyN4n2mhpq99SvPffSjD3srWPL57EQRM0eKQIOLZwUhcUudv+BJ4k/ FyV3hprr5oHGe+X6b7/tWiRrsPSm1hLfRILzP/t1I3+7zx24CaU0IuE7aLyT/7sYMKVZ +LGg== 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=kJF4ZjAfLVqVGakZdtq7slT5DgNeQPyF9be1SJwj1Hw=; b=lFdxESqbiTAhjmecAH2lF/13ok30Vz+nr0UlhnEHTNT6z8vcOfBlQOdoo1pvDVVd7t kKV4zCdh1y3d5enA19j3Y8Zde7GHdR3imCeK/xlLHRu6LTcZEYIA5tz3Qsb7vplI0RFq iykqdUZv8JxvhtvMSaTb37s4Amk2e/5A8+YUegkO8c9AM3fBqpq7kPjBpzVH5OHHvo3F ku+S6581YVja5qpLTxghV2Ew1wSbvmnCOgiDDMz7N6rgQ8veA9jTrJC69wR4ukwE/AOP ZlnStzE0tqjs+1Jo73Dh3MdWa+ZYIxb5MhSTcAyWG3FEhzd7Q1ifli21wNxnRltgo5IH QWWg== X-Gm-Message-State: AOAM5304vfTPwUzP3LB1QAwvZD/Uqf81u/3O1UfEftPQGUOt+yZpglEq FO7589tGt7M9jJqfCIWi2zLap8Dv6DefnMQV1MTI5A== X-Received: by 2002:a92:c808:: with SMTP id v8mr3929501iln.110.1629240658875; Tue, 17 Aug 2021 15:50:58 -0700 (PDT) MIME-Version: 1.0 References: <8fce27b8477073b9c7750f7cfc0c68f7ebd3a97d.1624978790.git.ashish.kalra@amd.com> In-Reply-To: <8fce27b8477073b9c7750f7cfc0c68f7ebd3a97d.1624978790.git.ashish.kalra@amd.com> From: Steve Rutherford Date: Tue, 17 Aug 2021 15:50:22 -0700 Message-ID: Subject: Re: [PATCH v5 6/6] x86/kvm: Add kexec support for SEV Live Migration. To: Ashish Kalra Cc: pbonzini@redhat.com, seanjc@google.com, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, joro@8bytes.org, bp@alien8.de, thomas.lendacky@amd.com, x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, brijesh.singh@amd.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 29, 2021 at 8:14 AM Ashish Kalra wrote: > > From: Ashish Kalra > > Reset the host's shared pages list related to kernel > specific page encryption status settings before we load a > new kernel by kexec. We cannot reset the complete > shared pages list here as we need to retain the > UEFI/OVMF firmware specific settings. > > The host's shared pages list is maintained for the > guest to keep track of all unencrypted guest memory regions, > therefore we need to explicitly mark all shared pages as > encrypted again before rebooting into the new guest kernel. > > Signed-off-by: Ashish Kalra > --- > arch/x86/kernel/kvm.c | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c > index a014c9bb5066..a55712ee58a1 100644 > --- a/arch/x86/kernel/kvm.c > +++ b/arch/x86/kernel/kvm.c > @@ -869,10 +869,35 @@ static void __init kvm_init_platform(void) > if (sev_active() && > kvm_para_has_feature(KVM_FEATURE_MIGRATION_CONTROL)) { > unsigned long nr_pages; > + int i; > > pv_ops.mmu.notify_page_enc_status_changed = > kvm_sev_hc_page_enc_status; > > + /* > + * Reset the host's shared pages list related to kernel > + * specific page encryption status settings before we load a > + * new kernel by kexec. Reset the page encryption status > + * during early boot intead of just before kexec to avoid SMP > + * races during kvm_pv_guest_cpu_reboot(). > + * NOTE: We cannot reset the complete shared pages list > + * here as we need to retain the UEFI/OVMF firmware > + * specific settings. > + */ > + > + for (i = 0; i < e820_table->nr_entries; i++) { > + struct e820_entry *entry = &e820_table->entries[i]; > + > + if (entry->type != E820_TYPE_RAM) > + continue; > + > + nr_pages = DIV_ROUND_UP(entry->size, PAGE_SIZE); > + > + kvm_hypercall3(KVM_HC_MAP_GPA_RANGE, entry->addr, > + nr_pages, > + KVM_MAP_GPA_RANGE_ENCRYPTED | KVM_MAP_GPA_RANGE_PAGE_SZ_4K); > + } > + > /* > * Ensure that _bss_decrypted section is marked as decrypted in the > * shared pages list. > -- > 2.17.1 > I believe this entire series has been reviewed. Is there any appetite to queue these for 915? They may need to be resent, since I'm not sure there is a single patch series that contains all the patches. --Steve