Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp596750pxv; Thu, 24 Jun 2021 15:17:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMiKNnmduPqIc/o5QKu9zw+2mxHa0bWo1iv1CpLf8AQByDRs/lKjotIe2HWI26qaR8KlGW X-Received: by 2002:a05:6402:849:: with SMTP id b9mr2059036edz.270.1624573047667; Thu, 24 Jun 2021 15:17:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624573047; cv=none; d=google.com; s=arc-20160816; b=em7t42VjDDRSdLxZ6UIz21XqU+3EsIVRwJRYCUUA28jm/TE3jf4jgtj8cZC55G0iOY hH72H75kbJb9vtUVnZQnnO3ZIpEiHZwMzZnxLoMy9VmEssZm0AVE7f3JvfFmf+ps/ZJz XHp6tK7LXAIO5Jcs/5r0PCTbt42r67L7qGJJ5jbt1yquXF99dPLfQlTsGwAO/lo9r5vH ew4RgP0QqBXGq+KqFUpcv9PelypRHxLXB44LGGS0g2N9LvMsGfaAgYNb4H5YCcAs+O7k tg02CbCgd7Cx0bM9mvvvxUVYGnHU6C18DzJevsFmFTGdgXfZUl5nfgMUv/nRNX95rNkA uQ8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zxKl5AmsjYlU8+TdXh4TOCPJIpdukNyRW1Uvd1U5pDA=; b=UUBcP4lYfNa1hDCVi4b1UDnt7BHMwWsMwyeQv+6gqTL0xCEOylZGkD2qgfjVUkCEGU Kzw1b4lTa1GiX//oEgVJkXdYPP4zttxXwvS2kScHZC61u52NvtChmlSkh8KLzR3649+F NRbf21A8N+2dh5DxPyaIfsUFsc5fm+Pa9xZe4M4Dab+SP8EtbniJ67zkGbpa3oRgPAPz IDguxhQmBYthuhtVOoJOFy/YhItwgCw+sbwGYJbb4IFmy9ig8bK+P0I7IvcTjNOujXBD E0+2AdvjehXRljZ6gIyLhNo5ybhSe0M1p6sJavyQzGol9JEmBzX82393M0pTRxgPVEjv 8ATQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="uzydDj/t"; 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 j3si4133274ejj.516.2021.06.24.15.17.01; Thu, 24 Jun 2021 15:17:27 -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="uzydDj/t"; 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 S232695AbhFXWR4 (ORCPT + 99 others); Thu, 24 Jun 2021 18:17:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229712AbhFXWRz (ORCPT ); Thu, 24 Jun 2021 18:17:55 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CF58C061574 for ; Thu, 24 Jun 2021 15:15:36 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id z3-20020a17090a3983b029016bc232e40bso4342273pjb.4 for ; Thu, 24 Jun 2021 15:15:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=zxKl5AmsjYlU8+TdXh4TOCPJIpdukNyRW1Uvd1U5pDA=; b=uzydDj/tej3y0yn6TYRFKZ5+InKZgeTxqG6h/4Tzh0bSga/i6GHkUhP0/mPm3AeHmA hKyYfeLOwruGWrDm/Iw8FkdAOwaChQa9apLoJ9pgWNL/hejORJnXMrxdksWDEWDuLKF8 Mx7oEFiJXicHTENA8FDaLuT+iajUTH2e/8tJKMnk/vyn/sUllLNop15W19no6HkOxR3h XxZoahbV2seq94VngB8ijDcfBK8CktNN0+BF5GLTy/4KeuWDgh7eYGv2M9nLP6+oMR/P Ajc59NqF4LMaj40KHZEibyKdvji4l9WPfy2eM4K66DyD7JxDAFbv6y04U52jwOs7TdUR wqGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=zxKl5AmsjYlU8+TdXh4TOCPJIpdukNyRW1Uvd1U5pDA=; b=CA6rh5xwhxYlMY1DwKFmI1ZxYDC8RMO0ySKaOOxpyV7RO49ZTSdG3iZyjKEd317gZ1 g64Ib4yd9wrkICw/9JtbXGJ7jzXn0Ye1opiVxDLUonPMIOlNtQqtgNJUwYwLXqDC/4lw 1Y8WHDBxVtUD04JFXxIJ5zmkm9hZ+BfgIoYpb+DH4wo8VUu1DpChxbfgEG4VZjwbXs+C PR78XO5dX/fIQU/GTPSfAVRyz2MBmRaX/UgrP/30DW7YNSOl0S4rkY/J/+cgVNg9Nty+ Gz0wN60HzEPiXieh8EqdMhCMjNrkKvWZoVK+dLpPJj4sZTH+YtamfIz1QC46nSifNh2Q vbxw== X-Gm-Message-State: AOAM531sccQBwiIKqJm8GBvsIoXZQ4uI+KXG9outdMa1e8jrIjcQ+nxS v4AQed2poX/hR9g8SJCo9vI8ig== X-Received: by 2002:a17:90b:3543:: with SMTP id lt3mr7479849pjb.115.1624572935329; Thu, 24 Jun 2021 15:15:35 -0700 (PDT) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id c18sm3246073pgf.66.2021.06.24.15.15.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Jun 2021 15:15:34 -0700 (PDT) Date: Thu, 24 Jun 2021 22:15:31 +0000 From: Sean Christopherson To: Tom Lendacky Cc: Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Gonda , Brijesh Singh Subject: Re: [PATCH 0/7] KVM: x86: guest MAXPHYADDR and C-bit fixes Message-ID: References: <20210623230552.4027702-1-seanjc@google.com> <324a95ee-b962-acdf-9bd7-b8b23b9fb991@amd.com> <2b79e962-b7de-4617-000d-f85890b7ea2c@amd.com> <7e3a90c0-75a1-b8fe-dbcf-bda16502ace9@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7e3a90c0-75a1-b8fe-dbcf-bda16502ace9@amd.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 24, 2021, Tom Lendacky wrote: > On 6/24/21 12:39 PM, Tom Lendacky wrote: > > > > > > On 6/24/21 12:31 PM, Sean Christopherson wrote: > >> On Thu, Jun 24, 2021, Tom Lendacky wrote: > >>>> > >>>> Here's an explanation of the physical address reduction for bare-metal and > >>>> guest. > >>>> > >>>> With MSR 0xC001_0010[SMEE] = 0: > >>>> No reduction in host or guest max physical address. > >>>> > >>>> With MSR 0xC001_0010[SMEE] = 1: > >>>> - Reduction in the host is enumerated by CPUID 0x8000_001F_EBX[11:6], > >>>> regardless of whether SME is enabled in the host or not. So, for example > >>>> on EPYC generation 2 (Rome) you would see a reduction from 48 to 43. > >>>> - There is no reduction in physical address in a legacy guest (non-SEV > >>>> guest), so the guest can use a 48-bit physical address > >> > >> So the behavior I'm seeing is either a CPU bug or user error. Can you verify > >> the unexpected #PF behavior to make sure I'm not doing something stupid? > > > > Yeah, I saw that in patch #3. Let me see what I can find out. I could just > > be wrong on that myself - it wouldn't be the first time. > > From patch #3: > SVM: KVM: CPU #PF @ rip = 0x409ca4, cr2 = 0xc0000000, pfec = 0xb > KVM: guest PTE = 0x181023 @ GPA = 0x180000, level = 4 > KVM: guest PTE = 0x186023 @ GPA = 0x181000, level = 3 > KVM: guest PTE = 0x187023 @ GPA = 0x186000, level = 2 > KVM: guest PTE = 0xffffbffff003 @ GPA = 0x187000, level = 1 > SVM: KVM: GPA = 0x7fffbffff000 > > I think you may be hitting a special HT region that is at the top 12GB of > the 48-bit memory range and is reserved, even for GPAs. Can you somehow > get the test to use an address below 0xfffd_0000_0000? That would show > that bit 47 is valid for the legacy guest while staying out of the HT region. I can make that happen. I assume "HT" is HyperTransport?