Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp170508lqb; Tue, 28 May 2024 11:57:10 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVUZsOuDkOYzWlRS/O7Gf8VqFdy9s9xek/xADxKSmdiYmlRAHMJlNtyfbpzmoLnFYUF7LhexsmLTDC5/I8ZG/wv45b3DvwrVVDp46sZ0g== X-Google-Smtp-Source: AGHT+IEXAnyKOjCLDGYgb++9O5vNlzqmzyMavAVAnKlXIiT/YNlBvaA2f304GHbCfYm6OYu4IsH6 X-Received: by 2002:a17:902:e551:b0:1f4:a3a1:a7e5 with SMTP id d9443c01a7336-1f4a3a1ab11mr63773355ad.13.1716922629591; Tue, 28 May 2024 11:57:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716922629; cv=pass; d=google.com; s=arc-20160816; b=i4gPSN6bvF8Z1q6P4Qcxhve5K1p00WFiGYD5vZ84QgJXN5eShwjMk82UEAtIA41WuL nvUZ5S50TNRJHmHveqCyHFCVYqisU1Vm+OAZaWbYmZaAM7oBKFT7IHw/j4QtSu1rLkT2 YHX20N58pwZ0KkD3QgyrX/1cd1vU48HUExcVMPhg4JGknYcAurOVsWDQqMR2LrhOP8HV B+Qg1vrkiLriVp2dVAc2m33s3e1rhA5FwCTnjD1A1m2BrkS1WjhN0BGu4GeiYocBzMyM +4X2uTBjK19irJ5pcwkq9WP5AwjwJboR9eY+H5U7sZmcwKpqfxtXYVvBCA82BCM6Tj2W j0kQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=S4Hp5OPdGF5QAC5ejV2ec7ZNjyRf7XQzcBDRWuz3U2Q=; fh=hXVGufuy0Uz91jovw0ZkRvFgYLTjn1iVpgRgpJFEm10=; b=VXveD5blK9JyeKkz4RyYxTZNlMEs4FgO9XQIF2mKda9d+gvcdeHivuLSdGodhyj6DJ xLqUkHt9SnojNacfSShR8m50uPsO6teSM3SfBv/70YfFQt02TRWt49XcHchy+RIdsnBL zuZtmnGn2htKuB6SCPrmuiEN+JW8NC6bPXQC/kUNuV84zYsY3JGKVawl7gHRpGtTcU3R BVVUFJYtPWCrUZu4bpWJoTcoRyXzgsVWWaEAcnnNsC1zXTgZ8V3LPreYw1KP46IURJIM f7/JpCQhP74bbXV9qQDGhT4UXu93Ne0FyXX/BnxeQCWurRn8TeJvhm1NHzvSulJnYl8c y3Nw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=BvKLadwi; 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-192890-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192890-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f44c9af77csi83879795ad.430.2024.05.28.11.57.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 11:57:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-192890-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=BvKLadwi; 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-192890-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192890-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 7A5242857C8 for ; Tue, 28 May 2024 18:57:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7F1CD174ED4; Tue, 28 May 2024 18:56:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="BvKLadwi" 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 E9FB516F8F0 for ; Tue, 28 May 2024 18:56:45 +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=1716922607; cv=none; b=s0b91mSkQuepBf1RbjiPQ47y0cWtLAbx2+ESTKwAVSP0GVpNVCb13suKiakapqVsEQd7G/UMw0Af49cPNvGCebpzx1xIBBfcwySOJuPdd35F7kRMcnt3ZPncG6BfgXFBt8JT0BxptR/4OY+DdYpuG63gQ3xRhb4MiRhKnqUWq3M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716922607; c=relaxed/simple; bh=7VzGZDtBSooFkxUd9OAZGtectfy+uwG4/bUmSmiL7y4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=hqIWXWJQfI1HjOGrlzIc2AAKx6+A0cX9WuwLChiBTvE1cuaH9GHMv7D2aNaEM1+KKVkknB+Coy4FqAYWcGEjy5Xa/U9fREgFByT85xrAq0vhhNd7hrnf4XXQjuBRKXBoyonFev6PT4ykG2TKSVvV5K8wAlbxMTELFSxyLrzyWwQ= 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=BvKLadwi; 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-2bdf44bdb46so1087979a91.3 for ; Tue, 28 May 2024 11:56:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1716922605; x=1717527405; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=S4Hp5OPdGF5QAC5ejV2ec7ZNjyRf7XQzcBDRWuz3U2Q=; b=BvKLadwiu1EUp6B/W7QzDf0vC1qmVA4xA9GlGAhJTIYmUKR4aXx37KdHJfazVVcYXD LLY9oCg8xuQPAia6vvNwmi1CCDxqQJSO1yTVcISCtOoGx9SDFcCC/IP48sK3kwIWB5d2 DgdKyyPXggomEr1PFGIzaciu026AyQHfCJvMeigaEaxyk3QadlQnJD4B32EX5d+6Otxx tzwLKy0NSNrGJ+3tkXscX7t3VocrA/StXLCGgiqbAerBwXMNqGREOfD/GX+pGSr4jRQm 5z8kyuogd933XlZzGOAeuaAf7Y76xitBVzPHskHuqoJ8rksyBLfnOwwVb23u7//VuZbo 4Aew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716922605; x=1717527405; h=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=S4Hp5OPdGF5QAC5ejV2ec7ZNjyRf7XQzcBDRWuz3U2Q=; b=KvfwMjNVXx8plq6qiO71u930OS/GnPtIZD0MkqNXo3L7CGUSmCceMxUkdhRColYD1l sJy+pQckY2lN8tXZxh3X+G++aBvN5VvrRSvn6/A9jVfnsCA98jzrgj263baX1aYoEJDM WBzv24l/gSAmqtQqbPovQpKMDpd26OYs+ESsHpCRgqZYKTpKPk8pi238rf9jeIs11CjR V227aBjInlSnrdO3IfMaa2DnF90n08TY+8IVaP2gkQgJHBgIbFjYJ2yJ5fAcT5R/kqXl GhL63AgNRGdKCHl1oL8MzDRsOORWw5PwhCO+MG63+eiu3KmngrjWr8GsURfKt2QyU01A T2Hg== X-Forwarded-Encrypted: i=1; AJvYcCXGUJTN3a+FaKNRAbAfRYPXfIdK6B667nTaCCxa42lWGG9DOFML0pF8uUzFmsnUGN2Uvt4Z5GlsC3hMfsX67rJY3EmRJHxmPZCPa15u X-Gm-Message-State: AOJu0YzMX2Z+HGbT1Ga6418jC1KalOoZ+vpQ9MIVnbLoldmycJAbXYlg DHgrPCYHilJ/59qZsvZUf2OqlL07aDkcxeBPyzAkasqGJZO3iU7xPeCGIlKoFRJNpizrpSpaCPS Baw== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:90b:19ce:b0:2bd:6abb:e9f7 with SMTP id 98e67ed59e1d1-2bf5e09d490mr35783a91.0.1716922605104; Tue, 28 May 2024 11:56:45 -0700 (PDT) Date: Tue, 28 May 2024 11:56:43 -0700 In-Reply-To: <18f52be4-6449-4761-a178-1ca87124c28d@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240517173926.965351-1-seanjc@google.com> <20240517173926.965351-13-seanjc@google.com> <18f52be4-6449-4761-a178-1ca87124c28d@linux.intel.com> Message-ID: Subject: Re: [PATCH v2 12/49] KVM: x86: Reject disabling of MWAIT/HLT interception when not allowed From: Sean Christopherson To: Binbin Wu Cc: Paolo Bonzini , Vitaly Kuznetsov , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Hou Wenlong , Kechen Lu , Oliver Upton , Maxim Levitsky , Yang Weijiang , Robert Hoo Content-Type: text/plain; charset="us-ascii" On Wed, May 22, 2024, Binbin Wu wrote: > On 5/18/2024 1:38 AM, Sean Christopherson wrote: > > @@ -4726,15 +4740,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) > > r = KVM_CLOCK_VALID_FLAGS; > > break; > > case KVM_CAP_X86_DISABLE_EXITS: > > - r = KVM_X86_DISABLE_EXITS_PAUSE; > > - > > - if (!mitigate_smt_rsb) { > > - r |= KVM_X86_DISABLE_EXITS_HLT | > > - KVM_X86_DISABLE_EXITS_CSTATE; > > - > > - if (kvm_can_mwait_in_guest()) > > - r |= KVM_X86_DISABLE_EXITS_MWAIT; > > - } > > + r |= kvm_get_allowed_disable_exits(); > > Nit: Just use "=". Yowsers, that's more than a nit, that's downright bad code, it just happens to be functionally ok. Thanks again for the reviews!