Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2701254pxb; Thu, 10 Feb 2022 03:44:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJzqgBeXHP2DQqJ090sP4ABWgEdmBtOGOQeRPSp3JjFSwRSRttMVtQm2x71rrdaxl2fb10A+ X-Received: by 2002:a63:f52:: with SMTP id 18mr5921098pgp.187.1644493465431; Thu, 10 Feb 2022 03:44:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644493465; cv=none; d=google.com; s=arc-20160816; b=Ppp2j2wAdhSMalik16Uy3BW3Tle4asP36obJl2Kx0NPHNlbSQXVR2c8PcUZIxzm35C TzNSBcjuqs5Tr3oBIbPRUQ1dfc6PXj+yOufGa6IO2y7VJLVQ+fQ9+8fWYOVKfI6JscnY e5sQvhBTmhP8w2H3nX4TYydW4M9NV8smqfnxHDyH8PobuXHWIm+mgP9Eo1N7mZf4aFsl N3aUWNl52HbM9pknwG+q3FylKXnGElNFrZFEw/rTxIqaSsaAkfF9ubKpGT2Jh+JA+Cw1 nsDfOTRncCu3iFvh5TVhlIChcQ079k0OB/FhodtyrZcryzspsnUBH3PMqKOlTT3uVvfS ByOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=2ALXd4CkpYhz0PzrpWR8ccebfEXt2RH4smcsnpQnLsk=; b=chjIV9GnkN8V9bZjRwItVOB9vhfPH1YdHoI7RZbY5R8RX46q7ZX4WrKb9ltOpWqbAN TDX7kNS8jJWQGDmGgp1W4E4jrlyJRL+2vU77y8PgyN59ESQANqAFt/c6ey1OXOy52g9f EN9HmOdv953pA7KSIqGdbDLy1CP+9iCyDAF6fqlGAaP8NzWJFoLqwaRwcOU2SVck3DBw WY9gFBzx+kFKvrI6CYqFu+Cm5LdWhk8AlHKPuZ2SCNtscREvdLtm9lbgCc5oc9GfQ1x6 VfG3PJLQ7aIOnlWOEcsluPzr82aofhFbS8l3/3KnhbXxD8gHo62ShRPPPm8tJiPBHJdA Kf/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UZDzIv9Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q15si21681541pfj.256.2022.02.10.03.44.13; Thu, 10 Feb 2022 03:44:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UZDzIv9Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S239188AbiBJJxZ (ORCPT + 99 others); Thu, 10 Feb 2022 04:53:25 -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-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 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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