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 X-Spam-Level: X-Spam-Status: No, score=-13.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CEEFC49EA7 for ; Thu, 24 Jun 2021 22:15:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 170706120D for ; Thu, 24 Jun 2021 22:15:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232767AbhFXWR6 (ORCPT ); Thu, 24 Jun 2021 18:17:58 -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-Google-Smtp-Source: ABdhPJxSSZ7/U4IhvsZ8gXg0gJ7h+yI5I3ed5etO6OcLN032AS5ikgSTh8qfz6g9wXIHVl7rVfnQXw== 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?