Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp173722lqt; Thu, 18 Apr 2024 11:28:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVvA6AS/2Q8Lu+Us+OUiKdEncssXhUdPzVq9NJR1JuIfmVAYjS9CB8brlJ1Esx5iuiRfuN9xU/vt8SGHnmwYXXSVYyqGvL6wdxXuHHjbQ== X-Google-Smtp-Source: AGHT+IEHgIFVV9V9glejlvVo9Q1VoJNFigFyk51cltS4jnmW593wDDkSl5oK1L3kduMjQZXlssnm X-Received: by 2002:a2e:be10:0:b0:2d5:9703:263f with SMTP id z16-20020a2ebe10000000b002d59703263fmr2441876ljq.44.1713464901283; Thu, 18 Apr 2024 11:28:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713464901; cv=pass; d=google.com; s=arc-20160816; b=TfxJRVkjbc8Gsh6lBFetEqhMXH83rifaFPgkTQ4TngS84Zc6nHxyWXP7BI9a6qG9ha HhOG9ck67Mf6L5F6xtjjPbglOq3OqnZSWfOXW38SfyCVZ93Ppoq3Lc8W/gRbCkI0OD+6 3yaDak539D3X/kWwpRVepHenXW1ikaHBh5++GP08dIpfVTiVk41EVsOKHEVM3DA6YQz6 KGoITPAswNKymjkZC+IEzKjTx7AcQifTlqlY0TMxDzwxNNDrNf2HY0FgHUleIZ9Z4j/F r1BV86sI8hSTh1lNNZx0NB8McWOIkVtWhU0vbTXDgFf8e0v+n/E1k/0cZxpYkbceusLo ktyQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :in-reply-to:date:dkim-signature; bh=R1lVfxWdHMgZEl/GJ+t31bj2vLOAc95uyRSzDMDSSs8=; fh=MKCnz0s0FdGrPT012HTegr6u+J9jWDXUN0dx85bKm4c=; b=coK8aQ0TyOCarng7adNDGkM+Ra7q3dXGu9eju/4B9RA9dlVMcWeBynqEB0+SuNCoT6 qpFjoBjXkKmRs18ou/ysU/P2TZwB5gKJnPqpFLMzPLZAty/MxZVSLV9vlJHpdQAffWRH kuGh8tlW18yGHTeaxZ/VXz8zIrDlFxq7bBqriPYOmb2BisGdXDs2I4MuucBpexcbGFOM 63Jz7I74geZL3KftViODSxhlayxVHiLarIuW3OTihLSn8zUeGyjkO5tk/7J5z3t3Fdaz VIpK9F3XtWlg+qGiq6cPMr028OYhQaeO13IKM49oVZhG3FkMHVjNqrzF55tRWueRIYVA bqzQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=gcUJK8Rx; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-150628-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150628-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id y14-20020a50e60e000000b00570241322a7si1131771edm.676.2024.04.18.11.28.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 11:28:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-150628-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=gcUJK8Rx; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-150628-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150628-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 02D6A1F2182D for ; Thu, 18 Apr 2024 18:28:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F085A17AD6D; Thu, 18 Apr 2024 18:28:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="gcUJK8Rx" Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EA1E8178CD9 for ; Thu, 18 Apr 2024 18:28:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713464890; cv=none; b=KcJOwoS6YlVFOYLwMnGWRc6PLdKCL1lHFwLh1C1h58p3nbTlfZMg0QATS/33VrCEojStyk6KEOSSLVK9k+tPcl8VyFHdnRxVwWCoOWCVttrBnXYtyKtZS0h7zCOrrkrYlZTYbDt10ZXzWs693H+XSu13TjsRuAWuuVS86W+ZVtU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713464890; c=relaxed/simple; bh=R1lVfxWdHMgZEl/GJ+t31bj2vLOAc95uyRSzDMDSSs8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=TN72hT39+65p+iYvMzuHC/RsmomfUFDHMT/MyCGG2WgCpYFfBXW5VQuzM8WbdOblEGhFkvbhslWZatGD0ozFpqhwHz356Y+1sk+Qe1hYDQqKap2X3UBqSSbFwFIGa6RK1fAnWzxPrOlSKc1IWQ2dVmvD6hwj1vt4xTEhHa+g8dg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=gcUJK8Rx; arc=none smtp.client-ip=209.85.216.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-2a4b48d7a19so1122865a91.1 for ; Thu, 18 Apr 2024 11:28:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1713464888; x=1714069688; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=R1lVfxWdHMgZEl/GJ+t31bj2vLOAc95uyRSzDMDSSs8=; b=gcUJK8RxBPlQJ0oThEWu8gLi+vHuozTXWlVR/zfZeYB4blvYyqswvocX+jeT/dX9x4 cKyqLC3+ID++vFeyhWudOUYu596MNcSuzv8hyShp9CCvf2zFo+FrZgO23wXlUSKqfC6h 5jYZ69bNl6KBrJNaqPqKQsf4mh4KzUwTG+VxYNFSZ3KyW1Z0LbeSnFtuvLDUxVYzmV9q x9wbV9xJmTc8UHX9PJEOCUGOV2VzwBLBHFBfd+KRzMo43EenNO6IBaneXLvcjMWrwBEi nZDC9M6txIdOZ0etM/nGXqajLPjgEO7jN5EBF2vMkeWXWy3EadfD/TAIwnu1cuFW2FdH Qjsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713464888; x=1714069688; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=R1lVfxWdHMgZEl/GJ+t31bj2vLOAc95uyRSzDMDSSs8=; b=L1E1UETxqndzi0+HplrK2ApZge9Lq6CkkPcWIySr1xI/rTFgd6EGczBHgTrkDWdYFs T4LsQ8eJX0h9PLh0j/MK09wTctfWqUVcO2W21w2svRlaGFQtUiqQBc3707YERWpNNtXH AC7aw/C/N5hjB2CM/xnvBMB2SyqODwEsEt+S0viWw16VG3hKNZnC2EHrTV+oea+KSD4z COFvbztbQXwW4WvKgRMY+Zj+kQzQfr3MuAponclws6k7JMXC8zkmTVfPrsC5+0GyjOSB FVggdU0/Ul7n0ROf3TJYhc1Ofwx5NHIhLbnR3rOh/7TdZTceI+F3Vsex4kRULpNFmpGU 3nuQ== X-Forwarded-Encrypted: i=1; AJvYcCX4NBRmJZj36AQzo7rzj31r6h/Phpsa+Sds3V1Myyf1PWQTxHA295iy/c0KzYCMPWiBCWNOXKDd7iwIQNX1CODfMsvNRbegndFdJ8SK X-Gm-Message-State: AOJu0Yx/Skqv7YAuDxBjvJhs/HmtGzwIyUIyaSo7uEEJso+SJa02cWLP Lz9+lNG6yVHWcsHkPGgNZNZ7hqOOf0sE8ybWgfpOenxJb6DpI/psWt+AOuRjGJmhygoMBWWG0nq DMw== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:90b:1914:b0:2a2:8888:807b with SMTP id mp20-20020a17090b191400b002a28888807bmr15304pjb.4.1713464888075; Thu, 18 Apr 2024 11:28:08 -0700 (PDT) Date: Thu, 18 Apr 2024 11:28:06 -0700 In-Reply-To: <61f14bc6415d5d8407fc3ae6f6c3348caa2a97e9.camel@cyberus-technology.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240416123558.212040-1-julian.stecklina@cyberus-technology.de> <61f14bc6415d5d8407fc3ae6f6c3348caa2a97e9.camel@cyberus-technology.de> Message-ID: Subject: Re: [PATCH 1/2] KVM: nVMX: fix CR4_READ_SHADOW when L0 updates CR4 during a signal From: Sean Christopherson To: Thomas Prescher Cc: "mingo@redhat.com" , "x86@kernel.org" , "dave.hansen@linux.intel.com" , "hpa@zytor.com" , Julian Stecklina , "tglx@linutronix.de" , "bp@alien8.de" , "pbonzini@redhat.com" , "kvm@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Thu, Apr 18, 2024, Thomas Prescher wrote: > On Wed, 2024-04-17 at 09:28 -0700, Sean Christopherson wrote: > > On Wed, Apr 17, 2024, Sean Christopherson wrote: > > > On Wed, Apr 17, 2024, Thomas Prescher wrote: > > > > On Tue, 2024-04-16 at 11:07 -0700, Sean Christopherson wrote: > > > > > Hur dur, I forgot that KVM provides a "guest_mode" stat.=C2=A0 > > > > > Userspace can do > > > > > KVM_GET_STATS_FD on the vCPU FD to get a file handle to the > > > > > binary stats, > > > > > and then you wouldn't need to call back into KVM just to query > > > > > guest_mode. > > > > >=20 > > > > > Ah, and I also forgot that we have kvm_run.flags, so adding > > > > > KVM_RUN_X86_GUEST_MODE would also be trivial (I almost > > > > > suggested it > > > > > earlier, but didn't want to add a new field to kvm_run without > > > > > a very good > > > > > reason). > > > >=20 > > > > Thanks for the pointers. This is really helpful. > > > >=20 > > > > I tried the "guest_mode" stat as you suggested and it solves the > > > > immediate issue we have with VirtualBox/KVM. > > >=20 > > > Note,=20 > >=20 > > Gah, got distracted.=C2=A0 I was going to say that we should add > > KVM_RUN_X86_GUEST_MODE, > > because stats aren't guaranteed ABI[*], i.e. relying on guest_mode > > could prove > > problematic in the long run (though that's unlikely). > >=20 > > [*] > > https://lore.kernel.org/all/CABgObfZ4kqaXLaOAOj4aGB5GAe9GxOmJmOP+7kdke6= OqA35HzA@mail.gmail.com >=20 > Allright. I will propose a patch that sets the KVM_RUN_X86_GUEST_MODE > flag in the next couple of days. Do we also need a new capability for > this flag so userland can query whether this field is actually updated > by KVM? Hmm, yeah, I don't see any way around that.