Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1717475pxj; Wed, 19 May 2021 12:13:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxaFHi/R3w9ibCfH4X/4hphnv1MoKIi3E9wdhhcai4WjdNH4Nmc04chW/d1jSD/D2Oqqqta X-Received: by 2002:a17:906:7e51:: with SMTP id z17mr719755ejr.2.1621451617668; Wed, 19 May 2021 12:13:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621451617; cv=none; d=google.com; s=arc-20160816; b=t1UelYjY/Sbt9ln9YKJsc6Rs5u69UYXgAn+iEt4vjp/OAX2jfaFmFhntb/NE9DgKNg jI9VB7FMmih26Ip4iQccTlLPZlmaNJ5w7X45sV1UNQoKh+gakIfJtYJo/CEGvuk935T7 hfKPamZR6Ea/R2EPXJpiMYsGr9Ct5EW4oY7k7FYYPCMX5QxOEj37geiI+/sFmUyX5ahj UXTdtpgfptv2r/nZPFH510KnyW3oXdphBN8CY1/YmfDaby5Yx+3easZtoAXZM5sa9uFH Igt/EaYV6Xs6qt7xDAc40pEOt93FM8MQSj5Z/EphwQ49KyDveyJ43zxsCuUbajx5zG0s 3ZgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=+Y3UOQMDJrIHJSBrGqM/NIVAlOdJSyvl9tA8WHC3cmA=; b=uJj7JU9l5MO0IkMtRe+4Pxb/2vLLBUn5akjMgC++fA/xBDQlXKGs3043jVN4GbwG01 osB8EWM/fp+mmDCxDj4JIh8P4dXoQ4BKs70rFCmE2Ai9jlPwL6tuNylFv4SLVsB7slek GhsA0t3+Jaw/ACVlSjbGIIX4t5n6VlPzc+o035wqI1j+rC2sifpaq3P39an3Yi9AyzJc HAR0N8g6fsRdKdUa+l/fQlQ+yEn8BnnnQciS9JCWNQ/LaR2gzWyiJW4B0YaYN9e/WJs3 ZVnTHv+xLi19ahHhBdPOqawKiRkz+F7oCwj0HWOlXd6Q1VkvVW/kZFj93JbOuBIJsVC4 KB+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=JynZLQlW; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ds10si469241ejc.415.2021.05.19.12.13.10; Wed, 19 May 2021 12:13:37 -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=@google.com header.s=20161025 header.b=JynZLQlW; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239680AbhESFhA (ORCPT + 99 others); Wed, 19 May 2021 01:37:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240854AbhESFe6 (ORCPT ); Wed, 19 May 2021 01:34:58 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CF8EC06175F for ; Tue, 18 May 2021 22:33:38 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id 22so8724099pfv.11 for ; Tue, 18 May 2021 22:33:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+Y3UOQMDJrIHJSBrGqM/NIVAlOdJSyvl9tA8WHC3cmA=; b=JynZLQlWZQBwwqP5hYqHmLnoiPN0RNcy6kEBdRtKlCnVUOus8b4BEbWLOq+haYfyBA HA/CYS7kpl/VZbidtBOdWm0Tdum8xxFHr6456BP1oZnMBf70tNZ1gQKYWz4w/bI4Ysaq WsBdNAF59UxKYmn6KAuA1au6/ZrAhEMNkwlTiWCYRop2uxJ6cWxjTPGfAP3zfIjHQl/w 8OhCQXf/7yx9Ww1t2oZjDwTPM15QsGF27qtzhAgzVY8JAdO3ysbtxWUZ5x0DL7GpDgHI gqp12w3X75qiJJoQqQ+9J7RGHJhFFxCTmSj4rFFoLWbvYWRS2ou0b8XXwzeKzPGxocEm VJvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+Y3UOQMDJrIHJSBrGqM/NIVAlOdJSyvl9tA8WHC3cmA=; b=F9O6xLkC/au5fXXi1kTzW0ZXkBXbtU2KmagvG434fIeMum3xQG6oJStfJQ/0iJPETV 3p33KZXri/FMURXd+ta6//Dn4gbbhIoZ8/oJEWXaO3hBnUyPuQnnd+an9XciC///Tf0D tRAIM1syTjO/R+VvwieDqlupm3eZXmYJZq0FBWbSIkWdl/6Cxm3oSDXrwZDMYUreBtZn 9lh6qTEg8w3g6dD9LjId/N0qgmBYLWCLjjIXxUseOmehXUnEHpQZtR5l4RdX1h1mA1ds Ey4a7ikbD1h3nkhci6hFIaljTGpBnB4Qoufk2yfNWiXGc14kxHxty5MiiyApMoz7g2re S5Yw== X-Gm-Message-State: AOAM530H7lS1lUQOUyrFwb0ixRLIukfdbr13vrwrfvEWVuynITwHcuEu DDCbSY6B8QhGZEdVJrwxJRwHyItsfYnZmCnUsq+FDQ== X-Received: by 2002:a65:61a8:: with SMTP id i8mr9092980pgv.271.1621402418048; Tue, 18 May 2021 22:33:38 -0700 (PDT) MIME-Version: 1.0 References: <20210424004645.3950558-1-seanjc@google.com> <20210424004645.3950558-11-seanjc@google.com> In-Reply-To: <20210424004645.3950558-11-seanjc@google.com> From: Reiji Watanabe Date: Tue, 18 May 2021 22:33:22 -0700 Message-ID: Subject: Re: [PATCH 10/43] KVM: VMX: Move init_vmcs() invocation to vmx_vcpu_reset() To: Sean Christopherson Cc: Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 23, 2021 at 5:48 PM Sean Christopherson wrote: > > Initialize constant VMCS state in vcpu_vcpu_reset() instead of in > vmx_vcpu_create(), which allows for the removal of the open coded "vCPU > load" sequence since ->vcpu_reset() is invoked while the vCPU is properly > loaded (which is the entire point of vCPU reset...). > > Deferring initialization is effectively a nop as it's impossible to > safely access the VMCS between the current call site and its new home, as > both the vCPU and the pCPU are put immediately after init_vmcs(), i.e. > the VMCS isn't guaranteed to be loaded. > > Note, task preemption is not a problem as vmx_sched_in() _can't_ touch > the VMCS as ->sched_in() is invoked before the vCPU, and thus VMCS, is > reloaded. I.e. the preemption path also can't consume VMCS state. > > Signed-off-by: Sean Christopherson Reviewed-by: Reiji Watanabe