Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp723424pxb; Thu, 19 Aug 2021 09:41:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwY4/SxdkOFfOq0FIYG1jiLI16v9J5WtloPs3UjAvY8OnBV2WZGzfNvekzD2Bvr4Ii3IGFb X-Received: by 2002:a92:6007:: with SMTP id u7mr3467488ilb.115.1629391275493; Thu, 19 Aug 2021 09:41:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629391275; cv=none; d=google.com; s=arc-20160816; b=cKp+qHENUU47HhVhErkRMJvN3hozLBc210LKQzBKzD01I6g2p2s8N4T/e7ki7EHVc6 3AN3Wi2SnxU5len5Xnn+T9n+LqqCa8k27BAZPs0M5eR0EEFkBWIiPRiyCXO2mnoXyg92 MuUp1YrCDbWHbFJnjCYlDQvetbdIfF1o036tipVKF9R83j72vGcwpKBhW2DS8n/WdqUE tOF2K9McOTVke/7KAO6okOuJDgpmAeFvlAnKfxbL4HAFgCTX0x0CGAGXUwCGeQR0Vyl1 YiNH76TpwIfqL/V1zbez2RyigLTVodjbfLk5po+i1YKkIEbMcOhkERLE5RhrAybx0yyg BklA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=3p2/vtk0jECaEq9Opdy1U0ndXxwF4zZ0NkReVHjVbJo=; b=faceoCrx98sefLNXIIxIL1KZ3b6bkATlCEX76uznbnFTintR5NySLqoPO/xLaGXo/h I7xr06ZtOPOXWrJuD+SFJXnH2aDSGd7MzWCz0Qyd0iWBV4BWHxr953AFi8C8soJQw8FC QrljNfonvJUANxN3/qU0GhjQPtZ0/qap4UtapQnIrqT5acywM4kkSHUTe25esgXSRoe/ x9OrHeKG5FLlnMPT5b4eHc1zucSM6u+DJ8o4HTX1epd9+CeDYgCynBJKdiJSFqXxpT2d tRUW7CFT/4MHmC7c6r6ttn5bskxvb30ww7W6BXScAtvjggUNYebzRl65hQUfMZrsOhA3 RCkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FXJMBj+f; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z9si3502343iow.13.2021.08.19.09.41.03; Thu, 19 Aug 2021 09:41:15 -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=@redhat.com header.s=mimecast20190719 header.b=FXJMBj+f; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233153AbhHSQkD (ORCPT + 99 others); Thu, 19 Aug 2021 12:40:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23449 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234786AbhHSQji (ORCPT ); Thu, 19 Aug 2021 12:39:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629391142; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3p2/vtk0jECaEq9Opdy1U0ndXxwF4zZ0NkReVHjVbJo=; b=FXJMBj+foCCU1nZivMeHH8RmPNc+FjWQlgmdRiU5OFVPVAzAai9mwu4qy2BjvC1XtiHocA ULnTPuFc9p1mm1OJLuw7+zwKq5EnMZ666r1gxVL0/aUOswa/lwp2cMdRNzDqNLFYuqnKdB YCExbgX5P1PWX2zCh0ONxgUHIMyqxJQ= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-297-_LXfTGG9Pgu1hT5sUaPQSQ-1; Thu, 19 Aug 2021 12:39:01 -0400 X-MC-Unique: _LXfTGG9Pgu1hT5sUaPQSQ-1 Received: by mail-ed1-f71.google.com with SMTP id b16-20020a0564022790b02903be6352006cso3089439ede.15 for ; Thu, 19 Aug 2021 09:39:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=3p2/vtk0jECaEq9Opdy1U0ndXxwF4zZ0NkReVHjVbJo=; b=O/xM8LP6nx1Qj64s8e35bXAa8OpEiT0OxQb05lVOLCxwC5WIl2HTkCzTtl0c5IjW3U eg8sY5cqgOCswzHPrB52plbhwZxVuT0qaoTf769rtENEhc0xM6SAW4oK3fRA+VNgBBaA PtnQfCSS5KrUAmj4LacaOPW4V1YA0b3W/1+fv/DuOgwJQ5/U3yM5m2dVR0AjGe41UJwz yhMH2rv762pRcYnD0/a8vXDh78tIAFPJyVBoxyHLhXt4YKxBJBpyKECmqsvepOVEt+0t S6pBJ2WV3NcnXRxD9u5du+EEq6cnX0m4JXPnVMvn55MVsyd604gjxwo1biZibOMAwwSi qGAA== X-Gm-Message-State: AOAM530wyP/ZznnUFjxLfiu/UFi7lkJ8KsC3WL29PDyYIcjyQES1J31o D903cc6j7t5ofMVlGAXTzlGGLrelxm78ipHVHmEWQ+yfhy7JO8szk2Pxjs3oUFjCYOrUaIGvtQ7 Y6nVzQG30F9gVG0BJZY21WNTI X-Received: by 2002:a17:906:a18b:: with SMTP id s11mr17076310ejy.8.1629391139969; Thu, 19 Aug 2021 09:38:59 -0700 (PDT) X-Received: by 2002:a17:906:a18b:: with SMTP id s11mr17076280ejy.8.1629391139764; Thu, 19 Aug 2021 09:38:59 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:63a7:c72e:ea0e:6045? ([2001:b07:6468:f312:63a7:c72e:ea0e:6045]) by smtp.gmail.com with ESMTPSA id da1sm2054086edb.26.2021.08.19.09.38.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 19 Aug 2021 09:38:59 -0700 (PDT) Subject: Re: [PATCH v3 3/3] KVM: SVM: Add 5-level page table support for SVM To: Sean Christopherson , Wei Huang Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com References: <20210818165549.3771014-1-wei.huang2@amd.com> <20210818165549.3771014-4-wei.huang2@amd.com> From: Paolo Bonzini Message-ID: Date: Thu, 19 Aug 2021 18:38:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18/08/21 19:32, Sean Christopherson wrote: > On Wed, Aug 18, 2021, Wei Huang wrote: >> When the 5-level page table is enabled on host OS, the nested page table >> for guest VMs must use 5-level as well. Update get_npt_level() function >> to reflect this requirement. In the meanwhile, remove the code that >> prevents kvm-amd driver from being loaded when 5-level page table is >> detected. >> >> Signed-off-by: Wei Huang >> Signed-off-by: Paolo Bonzini > > If this patch authored by Paolo, he needs to be attributed via From:. If Paolo > is a co-author, he needs a Co-developed-by:. If either of those is true, your > SOB needs to be last in the chain since you are the last handler of the patch. > If neither is true, Paolo's SOB should be removed. I didn't even remember writing this, but it's possible I pseudocoded in an email just like you did below. >> - return PT64_ROOT_4LEVEL; >> + bool la57 = (cr4_read_shadow() & X86_CR4_LA57) != 0; >> + >> + return la57 ? PT64_ROOT_5LEVEL : PT64_ROOT_4LEVEL; > > Why obfuscate this? KVM is completely hosed if pgtable_l5_enabled() doesn't > match host CR4. E.g. > > return pgtable_l5_enabled() ? PT64_ROOT_5LEVEL : PT64_ROOT_4LEVEL; That also suggests the above pseudocoding scenario, where I'd be too lazy to look up the correct spelling of pgtable_l5_enabled(). Paolo >> #else >> return PT32E_ROOT_LEVEL; >> #endif >> @@ -462,11 +464,6 @@ static int has_svm(void) >> return 0; >> } >> >> - if (pgtable_l5_enabled()) { >> - pr_info("KVM doesn't yet support 5-level paging on AMD SVM\n"); >> - return 0; >> - } >> - >> return 1; >> } >> >> -- >> 2.31.1 >> >