Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3936792pxj; Mon, 21 Jun 2021 09:44:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygM5bi3YkSZ5NFNBd8eRFEo2Ezh2oKGiu/P5kCGab6f32MjpoLNQS9Ecvp9thBFWXhjiRm X-Received: by 2002:a05:6e02:12c9:: with SMTP id i9mr6056929ilm.113.1624293893683; Mon, 21 Jun 2021 09:44:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624293893; cv=none; d=google.com; s=arc-20160816; b=XNf9wXclsi/NL9no68FcVELU+VYe5DLSdNju+8ccFMMaHVydsFQFch+/Kn4W1NaU5a hQR15vPS8RIO4jyq58KUE7IE0nQw76z8EaX/ycd0nLwuS6KIllFdw86dvD0rS2ZkEuCQ pzJatj7zda1HARmxRvgaByiPpaQmmCyooFScVak7aQTfdFhlEGsU4P/WxllLccl3maYN OPmh9Fz8ZHhGrCN3yneswcFixPPoy2G7s5l2LXDJVfFfL+O0FH9thut/cZegduwup3X9 9dx09uP4Fnv/JgxGry8RjwkvZJgIXGsYxTCyH2V2siCutwYPv99h/2vHrpcI3s05lRCN ODgg== 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=sNrhWGaCEE6tlRQzMAC0qRSOkCc4lESqY0tViKqRaA4=; b=JwoROAAhLLYarh25UVAtRYdpuz0M3utNUPdCN/6MmMXhD6SPZCmgl/e+tAynhDPp/A 8RLJojbUvLf9FnmN/ADin3Z8RgLC1rDvi8cRp2VAyEZYaz3iBJjeD3kvM9fCminjiDKa ZQFjjsXAN/CzIWhgdhSP6O5uOmllmclMFsyzpQ7xFD9VD3IijfGWE8FJiUecCZW1f3ch 7Xz2mz2YuoE9X3AqccDos9q7Kbs0katOIy/D7scQDbNGwK3dgp8fdPzlLBx0s1RZ7YIq a0UVxQN3S45f21S+Odw/iBS/vmgcxhCWFrW2YA2ix/18wHtsj9ovapdJKI+h02hU/dZ2 3jyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=U8kgj9Cn; 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 x99si18716774jah.122.2021.06.21.09.44.39; Mon, 21 Jun 2021 09:44:53 -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=U8kgj9Cn; 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 S231718AbhFUQq2 (ORCPT + 99 others); Mon, 21 Jun 2021 12:46:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:29672 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232779AbhFUQlY (ORCPT ); Mon, 21 Jun 2021 12:41:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624293549; 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=sNrhWGaCEE6tlRQzMAC0qRSOkCc4lESqY0tViKqRaA4=; b=U8kgj9CngIlwHAjNzu0z8Yn+aTlDLVaL4XYepIRC2crWNXCbGUS3bebegNG5wiEtPTg1kJ vI1PuCHjGsJmSYbig28nm6fPl9qTjtMn8SOfN7ZQ4Ifg1NlBKsXfr7Acms9e9Qy5YXOR3H xvlm04SPMvGjoYK1cGBfOzATFl+UZOg= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-453-taKbhib6OI6B6lB8WI61KA-1; Mon, 21 Jun 2021 12:39:07 -0400 X-MC-Unique: taKbhib6OI6B6lB8WI61KA-1 Received: by mail-wr1-f69.google.com with SMTP id l13-20020adfe9cd0000b0290119a0645c8fso8638175wrn.8 for ; Mon, 21 Jun 2021 09:39:07 -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=sNrhWGaCEE6tlRQzMAC0qRSOkCc4lESqY0tViKqRaA4=; b=BrdyTXTkFQzsTA0pkaFjnTQ7Fdqd/Ku/5yBlmX91n/Go3JhXLj0jgZFEezU9/kzqCD /989tcDmlD5TJfNbXjC6S2x7cRyYpnfeoMdJLZDNDmOxIQ38Eqkj5vWt6ajQfc41Jx6F 5r3scZwg1NEP/KEkewB36C93lzU571Aeg9ikWu339vitBW1neLI8w7DeIOVOzr0/RGi4 FpmgorTuQY+HZVz1MOQtii6UMSZ1stZAulAfmQqc9NnEFQbCCyY55o/Qp2jYg3vyQcMR X7Gc1Y3uUUAukFoXUmS9V8FcRx1OFiguyKFEMAwC5I6y2rqetHZKRLPPmZ7pSr203KeO kxYA== X-Gm-Message-State: AOAM533pTv7lNistIuju78c2K9gQw4L7nRv+hIR9vPdV0cny1qo0cctv 7VvUX57mtRc5yZ5LyczTsz4TEFfR5xOshVFCjob7gm/2lLAlIPXfwlGCQ1qoEyMS9JzJMHQRN9T sYhMDvYz1xozKk00WtvN0NaT6eqDoRQ2HFxhICJXDAI+ZrL3Pgg2pqE9SHfKzsI5xH8g3gFCUV4 u3 X-Received: by 2002:adf:c3d4:: with SMTP id d20mr29479260wrg.183.1624293546396; Mon, 21 Jun 2021 09:39:06 -0700 (PDT) X-Received: by 2002:adf:c3d4:: with SMTP id d20mr29479237wrg.183.1624293546245; Mon, 21 Jun 2021 09:39:06 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id y14sm11979790wrq.66.2021.06.21.09.39.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 21 Jun 2021 09:39:05 -0700 (PDT) Subject: Re: [PATCH] KVM: nVMX: Dynamically compute max VMCS index for vmcs12 To: Sean Christopherson Cc: Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210618214658.2700765-1-seanjc@google.com> From: Paolo Bonzini Message-ID: Date: Mon, 21 Jun 2021 18:39:04 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210618214658.2700765-1-seanjc@google.com> 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/06/21 23:46, Sean Christopherson wrote: > Calculate the max VMCS index for vmcs12 by walking the array to find the > actual max index. Hardcoding the index is prone to bitrot, and the > calculation is only done on KVM bringup (albeit on every CPU, but there > aren't _that_ many null entries in the array). > > Fixes: 3c0f99366e34 ("KVM: nVMX: Add a TSC multiplier field in VMCS12") > Signed-off-by: Sean Christopherson > --- > > Note, the vmx test in kvm-unit-tests will still fail using stock QEMU, > as QEMU also hardcodes and overwrites the MSR. The test passes if I > hack KVM to ignore userspace (it was easier than rebuilding QEMU). Queued, thanks. Without having checked the kvm-unit-tests sources very thoroughly, this might be a configuration issue in kvm-unit-tests; in theory "-cpu host" (unlike "-cpu host,migratable=no") should not enable TSC scaling. Paolo