Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp676969ybt; Fri, 10 Jul 2020 09:33:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwc+bJToFeHkG5jVxig0pBrbvG/00xhdoIMCOX4YtnvRsj10BiDPaNznX7SRtKhZoz5k89W X-Received: by 2002:a17:906:c10f:: with SMTP id do15mr64806659ejc.249.1594398834709; Fri, 10 Jul 2020 09:33:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594398834; cv=none; d=google.com; s=arc-20160816; b=tiyk+8vBi6m/v7D6hpl/w2e4rRLj0q+wJzmwWeGJps9x84pwGB3emqFdzEnPAE1+ee Fqn6dlxa7SCUtQqghI2g9fXxT2ckzmvObv/9IsKkQ3+H2254RmCOEnfmnFzREaX3QrfU ixAPiKjY96bCcE0K6gTEMY7k7750qa1gQY3ojpYG81uvSbP/p9QsAXDrH5bAK6Gtfot7 iu+FnU7makGycEAFU/94EO7azjWZIkA8peEF4noFFL1JgqbLxDcVip6IG73di1cb6o5T lD1a22g2rtW/8T0JrXyfHhga3HPKaVElsBqucFJuW8XQXR8JdeXJxwaS4mPrWut14J2/ 23kA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=L5x+RXQcTKt3brgLCNXmzu/Q4sL3Ui6tQW0Y7yTVLkY=; b=WShQ6eTNQoOPZc3L4KIFXxiMqdi7u5LDuLjYo9GCtFWsy6evcdHGQW9Qrvqz0P5VTT ieGJSk/6lSbp3sHLrqJZojuOEjCWI2fpBUED97bFbQZxe4tkzRNy9Y9KjssBXZdsEF3C GCPjUlahGl9nCEIblxrxw11LXcZpQ6gUjdt5Qe1kMHzbadLLuh8A07DCIhoRj/BSqA/k cpKbgkmf3zInJqIKe559GEhtjGuQwC8seY90JjrQ6qCg4uGjN+jgojZ3/nWk6iVPbFlo XfUXiNNy6gXxHY78GiqLoM/GgCo1gHvODyfswHCOd+xoXrA52k5vc4AUZPIMRRtSUlm6 1CkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="B6/Y2AU3"; 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 s20si4382044edy.519.2020.07.10.09.33.31; Fri, 10 Jul 2020 09:33:54 -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="B6/Y2AU3"; 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 S1728245AbgGJQbJ (ORCPT + 99 others); Fri, 10 Jul 2020 12:31:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726920AbgGJQbH (ORCPT ); Fri, 10 Jul 2020 12:31:07 -0400 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24006C08C5CE for ; Fri, 10 Jul 2020 09:31:07 -0700 (PDT) Received: by mail-io1-xd41.google.com with SMTP id e64so6632879iof.12 for ; Fri, 10 Jul 2020 09:31:07 -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=L5x+RXQcTKt3brgLCNXmzu/Q4sL3Ui6tQW0Y7yTVLkY=; b=B6/Y2AU3K+d29kPJXoL4LW3xcHmtRXC6hGouqLD94eTzfrcaV3Fglva7FhbL4FBWcn 7CNit1lq96RQZfb339mk7OObuhLv9SvsOopZ5KKDqxtyUP5OkUl3So/xWJuSYxFPAnD0 M+cC9gw93b5yvVZkCiPNJBcka2dTkqqMjjpN1B8/fJ/d2uYNUOhQbv2l2wjmIHMZJiV7 JKgQOz8OPcH4mfjfFUrRPX+wgE/dFIBA7R+ynDnnOb99sDUc/8fY2mu0lZJMQGXNi5SM mdf35MSYI92URNmkPnr9bRMUTfCVa5SC6EUlRv+V61BsDiSWajXEiDX+k1gstuu/tsOB p2hA== 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=L5x+RXQcTKt3brgLCNXmzu/Q4sL3Ui6tQW0Y7yTVLkY=; b=QPwBIma8SuHGY/0Y/nU19x+U56gYBqg9gXOPCF7uZzxT1xwkDmFAKhCUYHjyxuKY+s CMQhajcOkGLMgmpVBdiv8CSi9OGVkRst2AA/+otUkWNfTsEy9iwbSdFMRMKmRyWoi91n HuJ6d4iD03GalScophooIBoMJLpvLE/BIu1cdJwzXB3L5Voeqq75+wQdAHPGOnhU+bNy wCu5XQHUY6hgZqT5CU3q72CN/u0785ArL9XwMaPA0VcNM11XNQqpcl7iu12qyIH5aQbg GJesM/Xfi61Yh0OXnbvjn5zUzhI4rysLtUTxYsZuRR0H8IbrGlvdOvddnrHQYaNhmrHv l2aw== X-Gm-Message-State: AOAM5324SZuJ36ABayv/FJ7grnZLxYqCNz/sNEcmnV8dd+9X4JC0OJfK FgE8vwsEtljDyqkmk2v6iGYQZwJmIe/XUrqRXsrc2KZs X-Received: by 2002:a5e:c311:: with SMTP id a17mr18924402iok.12.1594398666301; Fri, 10 Jul 2020 09:31:06 -0700 (PDT) MIME-Version: 1.0 References: <20200710154811.418214-1-mgamal@redhat.com> In-Reply-To: <20200710154811.418214-1-mgamal@redhat.com> From: Jim Mattson Date: Fri, 10 Jul 2020 09:30:55 -0700 Message-ID: Subject: Re: [PATCH v3 0/9] KVM: Support guest MAXPHYADDR < host MAXPHYADDR To: Mohammed Gamal Cc: kvm list , Paolo Bonzini , LKML , Vitaly Kuznetsov , Sean Christopherson , Wanpeng Li , Joerg Roedel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 10, 2020 at 8:48 AM Mohammed Gamal wrote: > > When EPT is enabled, KVM does not really look at guest physical > address size. Address bits above maximum physical memory size are reserved. > Because KVM does not look at these guest physical addresses, it currently > effectively supports guest physical address sizes equal to the host. > > This can be problem when having a mixed setup of machines with 5-level page > tables and machines with 4-level page tables, as live migration can change > MAXPHYADDR while the guest runs, which can theoretically introduce bugs. Huh? Changing MAXPHYADDR while the guest runs should be illegal. Or have I missed some peculiarity of LA57 that makes MAXPHYADDR a dynamic CPUID information field? > In this patch series we add checks on guest physical addresses in EPT > violation/misconfig and NPF vmexits and if needed inject the proper > page faults in the guest. > > A more subtle issue is when the host MAXPHYADDR is larger than that of the > guest. Page faults caused by reserved bits on the guest won't cause an EPT > violation/NPF and hence we also check guest MAXPHYADDR and add PFERR_RSVD_MASK > error code to the page fault if needed.