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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDFFFC433EF for ; Thu, 10 Feb 2022 09:53:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239190AbiBJJx0 (ORCPT ); Thu, 10 Feb 2022 04:53:26 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:40728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232590AbiBJJxY (ORCPT ); Thu, 10 Feb 2022 04:53:24 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 847F1128 for ; Thu, 10 Feb 2022 01:53:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644486805; 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=2ALXd4CkpYhz0PzrpWR8ccebfEXt2RH4smcsnpQnLsk=; b=UZDzIv9ZoI9s0CIq9GiXHT82B2QJo9BPqANMT9PhnXYCot0gCln8BhMSlR5Ra776aZ9u7h Hn/W7ggMhyEVS1TyEW8L6cwOngDgphaQoTDr6F8asqeKn5tz6Kso0LGvB5Q2iVM8Bfiwgw Bg+/s5Ejlcn3AP2Qu9dEE/SC7iCAbY4= Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-529-YAtIIdocNTeOdT3qo_VwNA-1; Thu, 10 Feb 2022 04:53:24 -0500 X-MC-Unique: YAtIIdocNTeOdT3qo_VwNA-1 Received: by mail-ej1-f72.google.com with SMTP id hr36-20020a1709073fa400b006cd2c703959so2456814ejc.14 for ; Thu, 10 Feb 2022 01:53:24 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=2ALXd4CkpYhz0PzrpWR8ccebfEXt2RH4smcsnpQnLsk=; b=CdMPLykLMV6gT5EIcBoQbtgDy5Iouwc3O3tdGEFwIV9n4SQDxmVDip2gmOmkmuD2GT D3Yk/nnINT2i5BKbgCFb05KeqCAtrhEV8Igns4XlZc3zfMeAOMWzXHbd5fKWMwl9tZHR J8/CmLJQjrtvS8pjsDeMBubHZYCZEDMMtTfnBoLOVKQOFEiUbZhTwKAmIHTUP/jr2RTR St6p2pbfuvmgVkQInILKNA9f1jY4SE0o7OqhgPBrNHeOA4XZrGUgmOeNA7wR71iSciVL Dr6AoW+BodUzM9Qc4CbUMn2qUtBnxBznvUYbS33ZqN3l95YFd4e119WhnSnUUisYgvIm D76w== X-Gm-Message-State: AOAM530wMhAuMhi2KyS9bwYexJYOj9viCaM3DyHPLhjQXtaC0H6gZrRE X4sOf5d1zE7outBva4EHDvThNRa1vPKsriyv4WLty9iEt0bSpe60r4i9GH2uqI7xrwDiG69hsLB 1weYt64a4dYHbmfkhre3MWNbO X-Received: by 2002:a05:6402:4c2:: with SMTP id n2mr7224990edw.247.1644486803370; Thu, 10 Feb 2022 01:53:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJxYsGzFAIAxGewz0MvOdM1WduQkHptGANoYIsynhjpXJkagAgM4JHO0ZXxslFEDVseEyx+sdg== X-Received: by 2002:a05:6402:4c2:: with SMTP id n2mr7224973edw.247.1644486803214; Thu, 10 Feb 2022 01:53:23 -0800 (PST) Received: from ?IPV6:2001:b07:6468:f312:63a7:c72e:ea0e:6045? ([2001:b07:6468:f312:63a7:c72e:ea0e:6045]) by smtp.googlemail.com with ESMTPSA id i5sm3866374ejh.13.2022.02.10.01.53.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Feb 2022 01:53:22 -0800 (PST) Message-ID: <7e2767c2-d772-a485-ce8c-ed5d4da06b3f@redhat.com> Date: Thu, 10 Feb 2022 10:53:21 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH 03/23] KVM: MMU: remove valid from extended role Content-Language: en-US To: Sean Christopherson Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, dmatlack@google.com, vkuznets@redhat.com References: <20220204115718.14934-1-pbonzini@redhat.com> <20220204115718.14934-4-pbonzini@redhat.com> From: Paolo Bonzini In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/9/22 23:54, Sean Christopherson wrote: > Nope, it's not guaranteed to be non-zero: > > static int role_regs_to_root_level(struct kvm_mmu_role_regs *regs) > { > if (!____is_cr0_pg(regs)) > return 0; <============================================= > else if (____is_efer_lma(regs)) > return ____is_cr4_la57(regs) ? PT64_ROOT_5LEVEL : > PT64_ROOT_4LEVEL; > else if (____is_cr4_pae(regs)) > return PT32E_ROOT_LEVEL; > else > return PT32_ROOT_LEVEL; > } > Yes, see my reply to David. At the end of the series the assumption is correct: - level is always nonzero in mmu_role - one of level or direct (which is !CR0.PG) is always nonzero in cpu_role So the patch can be kept but it has to be moved much later. Paolo