Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp765008pxj; Tue, 18 May 2021 13:40:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrlqbklSL6kXilJKBlmn7xiIBSi2n9JBl5mWm8JFT04e0VwnYYnUG0R5cM8tSW3kmd/D0T X-Received: by 2002:a50:ff0a:: with SMTP id a10mr9243870edu.273.1621370450027; Tue, 18 May 2021 13:40:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621370450; cv=none; d=google.com; s=arc-20160816; b=o8STxlRyM8lqUkZfZDFiRMaqxmNZgf3M1QhbJV0+hKyY6OPulEf2fO2JaONRuH32bh jVZlmcrDzg7oDqo6a1bDVvVUVk8/+3RsIPou1VadrJc4TG4d9ebpRWN/ep7nysedT2BL ZEHrySDniMCdhWBtAwNRtLeyZc1II8C2L10v19bgM2aldkVJ/hZeYItaH7Hqyd4L6cyB FWkTk9jlFGCx/9L0qGjkTiPxERZ3dfrkhy1YZvt86fqvBJ2mP4g9i/DWBx69f36N65DC saF6eWUEkNXXXVaNQh2wjGdaQdqnO3JruiYQZXfG7Tv/i9lesw3by2vs7J6PnWFKpYeX ywzg== 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=LnIhHy3o+INmhoR9lM+wDxWHFzbc4Yd/gOiGaQXOvgY=; b=Tvc3FJP1Pj8QNjUW3RhWeDWa34pLQfg6wRR5WiSM2zjo/s6m5d60GrB/jPUbgB5nyD T5h92VbuNN34ZaXQufZft0+/L5N2JGbrpwjbs66FTpu3L/II3hBR92WEHEU1KhKpE3jn B/MpCE6e/4OG2e9GkXyafWtln+g8f7KfY6kA5J4DhlfOIX9mHmtc5HhoEWjUapmfwdSG Z2bIty5lDHH+bFxI6EoEhO6eWc4cpl5ks3Pos37Ll+wYkjBfOwg1Znporz313mUPiQcR mPAfcwz6YiJ4bnTZU4Ta2BZE3hRIKT014MsrgVqZ+E14IQIdHx3lmItAioQ7cTw1V+CY M+/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=M2f2xxjL; 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 bi14si18802724ejb.441.2021.05.18.13.40.04; Tue, 18 May 2021 13:40:50 -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=M2f2xxjL; 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 S241248AbhEQQ7d (ORCPT + 99 others); Mon, 17 May 2021 12:59:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236000AbhEQQ7c (ORCPT ); Mon, 17 May 2021 12:59:32 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3918FC061760 for ; Mon, 17 May 2021 09:58:15 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id l70so5080107pga.1 for ; Mon, 17 May 2021 09:58:15 -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=LnIhHy3o+INmhoR9lM+wDxWHFzbc4Yd/gOiGaQXOvgY=; b=M2f2xxjLJ1/DKzKFaQc/xGGVWDDw5G368pcqcKyd3B6hIgx4eOPanb47sRPjPa/d/F LtXTJ2/qZKlWQxj5AL5qEXTF52flhpiW4gAnoZScT6yPXeZ69A0kqfPv+VNIbqNH0Fi6 SE9dAPthqfIbrSsugfLbwC/KyYSXrzHmqpoRbu10zUBQLQ9QMJQzWqHRzGO6FnfdFeCp 60fvWxL2NvtXxjbeYUE9EK4BHUUo5uysOc5gvaBrIkXvu/UKiR1gmUBkeNUcWRceuiFI yNgaosLDu7Fdp3TBiZJBOIIzrlOgEPSud9craPgu5L/exIh7HcxECtrkZkzvuyb0B+2n 4Eig== 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=LnIhHy3o+INmhoR9lM+wDxWHFzbc4Yd/gOiGaQXOvgY=; b=tGEShSxcKu5jbiYUQhmO7jaLqxP3BbCk3G2jsb9badmseCmMYoWLVuJa2K/cSaDeJ+ MPwGTUBlm56/Brm2BbgLOA9FurIY1DOi4+mNXKC0wwGA3O7TiQIjUnUzpJPtp6Vyu3dK qjhSvVFp9GYa/N6/psEYpVzENri3sOpOajIRy6gJnFo4R5cPQUFDAH6JpzTkTU6ulKPj ka+t27NnUrKEdk0gN9SwibmsO8Ov+foxd64zL1HIqpeOnFmOW4+316/ZaYDuWQmZPL7a UdOCuLfv6MAwdDyBIMDu8HEhxFPVFS1tpz77jyRBBpCb9zgqNOPrpOm2PQUijsanBj95 80HA== X-Gm-Message-State: AOAM531ytdegVhnohNoV4VT2jffok1vPIQ/uk7pfYlJdO1uI94h/AiNK zaZ8V9ZfxeW0QVzAXFZu64MxPSzz7T7XYHARJyYv6w== X-Received: by 2002:aa7:8c59:0:b029:28e:9093:cd4d with SMTP id e25-20020aa78c590000b029028e9093cd4dmr550064pfd.25.1621270694586; Mon, 17 May 2021 09:58:14 -0700 (PDT) MIME-Version: 1.0 References: <20210424004645.3950558-1-seanjc@google.com> <20210424004645.3950558-7-seanjc@google.com> In-Reply-To: <20210424004645.3950558-7-seanjc@google.com> From: Reiji Watanabe Date: Mon, 17 May 2021 09:57:58 -0700 Message-ID: Subject: Re: [PATCH 06/43] KVM: x86: Properly reset MMU context at vCPU RESET/INIT 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 > void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) > { > + unsigned long old_cr0 = kvm_read_cr0(vcpu); > + unsigned long old_cr4 = kvm_read_cr4(vcpu); > + > kvm_lapic_reset(vcpu, init_event); > > vcpu->arch.hflags = 0; > @@ -10483,6 +10485,10 @@ void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) > vcpu->arch.ia32_xss = 0; > > static_call(kvm_x86_vcpu_reset)(vcpu, init_event); > + > + if (kvm_cr0_mmu_role_changed(old_cr0, kvm_read_cr0(vcpu)) || > + kvm_cr4_mmu_role_changed(old_cr4, kvm_read_cr4(vcpu))) > + kvm_mmu_reset_context(vcpu); > } I'm wondering if kvm_vcpu_reset() should call kvm_mmu_reset_context() for a change in EFER.NX as well. Thanks, Reiji