Message ID | 20240209222047.394389-3-seanjc@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-60098-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1164471dyd; Fri, 9 Feb 2024 14:23:25 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUnManp17J4IkT7ka3msDaeNlbjRQt5IH0prgS6NbPikRDhAK4YG4NGH9UFtQaPrYpF0setsGeZ8Np588GOXr1aEQto6A== X-Google-Smtp-Source: AGHT+IGKe87BkwnfW+HzymMolCq4SGcqq0Y+tiuJ6z68+wj4tbI1+BdQSUzdZwEcWVDODUlix7aA X-Received: by 2002:a05:6214:2422:b0:68c:a02f:607a with SMTP id gy2-20020a056214242200b0068ca02f607amr510574qvb.5.1707517405298; Fri, 09 Feb 2024 14:23:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707517405; cv=pass; d=google.com; s=arc-20160816; b=V6v/rC8yb+zvq/Y4W3INVKeb7Vf7lJdPhz6MY+zngOGehjznUh4679xVurcC9rknf/ Gb0GzJq/T/LXoZ1ChruOIqjCXVSDVJPfZ3/VuyPO+DtQFZfixCmAbg1HHAAw+CB1nilM Jem49kkAXnhhNgpuSG7r3M0SwM4BeRKmLAScO7ZVDpI9HfANJJEZ5mJ1hNvN0MlV+HqZ t8RuQdfgvcaC8QEK1fARQbeLxouCt1Ujmk1zuITpjbCJlm+dlT10S4A0KlvFEkb8HnQj OBtcMnf1U4PO5+c3XF+N5bpQnYldumA97wWskIJ4LTZf8LZhhIJnlg4bQ1tWv30vjz1L ff8w== 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 :reply-to:dkim-signature; bh=yi4hHgzRm66Wj0icAfm6O+EqUFwwNEbxzptOYQ9az9o=; fh=hAqdJWzBXKqoSwY++AJetGJuol7SZyCkP8SX74GrA48=; b=eUzLKnKYPXrnKRS30Pj8DPrtuwU10mtqPmbBPM0JogZkZTr4F0j3Wr6sa57E+9wx+O 2km48txzQrbSHXcQTe+KevK+yUZZ1gwm2zc6e+LWRpbuRSQwVzqLTDoYRqinnBXZ3HUa Y/y1py1fqE7N9dBuIDEQU8GLWRKyvk47HRbqk8Mne+4y501X0rLg3LZbrEHJnnh3OZch 3gXPyGsKygtG9sIp4ZFjP5fwpTPGdxmgnl2rBhCzzIEzkoOCg1jvYjXPaDr/xHugSPbq UDJqp0m8TYSUhxotjCQVRBrU1zR2t7KJa7/UHVjpYeXm29aR724j7icTcV8nwMlACvSt wjJA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=D+pL60lA; 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-60098-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60098-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=2; AJvYcCVMzFq6kGLxgs83rTAHXgqAa3KXJPL/KoRD1XZlP1xUp0tS7GX66tIcRNYu2yzatQQCXDEEXO9/8G5i0x2UPDM8GMFpIg== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id gm9-20020a056214268900b0068cb633507asi3128604qvb.575.2024.02.09.14.23.25 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 14:23:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60098-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=D+pL60lA; 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-60098-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60098-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 181FE1C2283A for <ouuuleilei@gmail.com>; Fri, 9 Feb 2024 22:23:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3C83F3A8E0; Fri, 9 Feb 2024 22:20:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="D+pL60lA" Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (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 14E1339FE7 for <linux-kernel@vger.kernel.org>; Fri, 9 Feb 2024 22:20:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707517255; cv=none; b=uWb8uyfHz3C/hBqv+x2ZJSRWVORNZmevn5LRI+DOmgwAwQsa1/yvd8o16z0x4BQABl8nh3oYTNOQh+k+OEK2tHtC0gXvUrPp8p3owuczN3dbUV/G5DLkb/CG5u034paqMN1xyNqDXATQHcipkoQBGv8stMeMCcwyOm89MyMTySc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707517255; c=relaxed/simple; bh=/+AACNUK3NWSn3jwhGJqpuGxVWUQ3Hc2IPGl9YwdYHM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=euwwCffSNNNCmqjTrmhjzXjCq7qD/y9WMMg1RPBDH7gN4cqSfzpdt82R42lB8p3sCRLY/y6IPniNtDWjDy58buspuYPUZZxX3j+OBtR1FmLoub+pZqRgfmT6TjK2Zx9C0EN0LTqeG5vtBYKfzR/I6T3DHpcgyECo2CYiqxbivl4= 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=D+pL60lA; arc=none smtp.client-ip=209.85.128.202 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-yw1-f202.google.com with SMTP id 00721157ae682-6047a047f4cso38330007b3.3 for <linux-kernel@vger.kernel.org>; Fri, 09 Feb 2024 14:20:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707517253; x=1708122053; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=yi4hHgzRm66Wj0icAfm6O+EqUFwwNEbxzptOYQ9az9o=; b=D+pL60lAu5xXZzNy+stnlcNJnCE6Zb3CCbUt0wwSpMRelviatTlIpMNEEHe1LHRzbG aITq67Fi6LG70I7szCTSxgMY6Qqj4niqXeG43t9HYWXmgBsKhTO8xpDZk95ORvQ0sfIz mDiYV0fo8EGjL0Ab6TRxhQbDzsCim9u6alLtcfvXgFVM0AiEqWsDhy8d+1XKhN/gVtV8 lr0+2ws91rw1QRy+HSBt7ACK2KSJhtGRGT05ldHFs5YQ1gTwgOIBcV7dURA2Estwq8vp ql4ZM8FXoAfSh9aKdfgA4CyydCaWcvRPENWoszCBGip+LRIP0vk+KHAr9H2GHOp+NRBC TskA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707517253; x=1708122053; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yi4hHgzRm66Wj0icAfm6O+EqUFwwNEbxzptOYQ9az9o=; b=QNqm8YW4787nbySAPYklEYgE+oaoxmNuK6C8svmDb88BvAUWYmzLtO36/83Bh/Xmco A4SIHHX4anV1ex39/KVKcGQiKtUKAnpKGBiuQJ/JQ0p7awl7SPOgv6Jrn1ln5VMZuYJ4 KpM0fye6Eg+x8k4KqHmHmgQqwxK082369Y/NviqQhe+8VFOsRKAL/NGVGAdo/0onZ4Ov xhF5r0qx/2RTZFKSsLePd+u2BtcT+Dx1vRbcsm+AnqpaluCUk8AiZ2OQl+ABzGXrRwu1 fbU2/ciRaD736K3tmCIM3oVJmXeebIpmjCvBvunqAB+FRLc8aW4Rx+XatJC47X0jKzPL ZLSQ== X-Forwarded-Encrypted: i=1; AJvYcCW5gTSNBOwts/zVqi3vBDKPk2xvoy04NzYbGeaSOcSO9chUqou3QgOMSIFeAlb3D3YO86g9G+Hkz+xv81KwdKate2jvZENTEWKbl/9Z X-Gm-Message-State: AOJu0Yxf/tMn5cWsG7/lKG75qcejpNFiIfYA1Q8vXfoysYuEk/p8gUNm fXI59b0X4khuY6f7JLOGUd25C4IjSH/xliJIVNkCwxRRc4L0MlBxiG4ivoJcAzd+XAsnq7X93Zc p/A== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a0d:d513:0:b0:604:103:567d with SMTP id x19-20020a0dd513000000b006040103567dmr152824ywd.0.1707517253085; Fri, 09 Feb 2024 14:20:53 -0800 (PST) Reply-To: Sean Christopherson <seanjc@google.com> Date: Fri, 9 Feb 2024 14:20:47 -0800 In-Reply-To: <20240209222047.394389-1-seanjc@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> Mime-Version: 1.0 References: <20240209222047.394389-1-seanjc@google.com> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog Message-ID: <20240209222047.394389-3-seanjc@google.com> Subject: [PATCH 2/2] KVM: x86: Sanity check that kvm_has_noapic_vcpu is zero at module_exit() From: Sean Christopherson <seanjc@google.com> To: Sean Christopherson <seanjc@google.com>, Paolo Bonzini <pbonzini@redhat.com> Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Li RongQing <lirongqing@baidu.com>, Maxim Levitsky <mlevitsk@redhat.com> Content-Type: text/plain; charset="UTF-8" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790461770774501546 X-GMAIL-MSGID: 1790461770774501546 |
Series |
KVM: x86: kvm_has_noapic_vcpu fix/cleanup
|
|
Commit Message
Sean Christopherson
Feb. 9, 2024, 10:20 p.m. UTC
WARN if kvm.ko is unloaded with an elevated kvm_has_noapic_vcpu to guard
against incorrect management of the key, e.g. to detect if KVM fails to
decrement the key in error paths. Because kvm_has_noapic_vcpu is purely
an optimization, in all likelihood KVM could completely botch handling of
kvm_has_noapic_vcpu and no one would notice (which is a good argument for
deleting the key entirely, but that's a problem for another day).
Note, ideally the sanity check would be performance when kvm_usage_count
goes to zero, but adding an arch callback just for this sanity check isn't
at all worth doing.
Signed-off-by: Sean Christopherson <seanjc@google.com>
---
arch/x86/kvm/x86.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 59119157bd20..779a5b32a5bf 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -13878,9 +13878,6 @@ module_init(kvm_x86_init); static void __exit kvm_x86_exit(void) { - /* - * If module_init() is implemented, module_exit() must also be - * implemented to allow module unload. - */ + WARN_ON_ONCE(static_branch_unlikely(&kvm_has_noapic_vcpu)); } module_exit(kvm_x86_exit);