From nobody Wed Apr 8 06:39:49 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45E14C433FE for ; Sat, 22 Oct 2022 15:48:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229954AbiJVPsn (ORCPT ); Sat, 22 Oct 2022 11:48:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229890AbiJVPsc (ORCPT ); Sat, 22 Oct 2022 11:48:32 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20A9967455 for ; Sat, 22 Oct 2022 08:48:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666453707; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EDSXo8hsV8NzzkWo+KouABAzM9HOiQi26MuXJl4LsjA=; b=JK5ku7k1GI8ofebQoJNflX8ULdtgJbQvQSQKkLHnqpTLwXKC4Hmr03paaBhOAxgRshuAUD 6V1hnViORtnf/4lAcPopqI5qfKpMpA1CJctDhI3QvXrrujCOX7iGmlpLGOj44Ed/NDHUSL xxl3hia3Y81H4ntv/sJU5UontazszCA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-612-6wXycPoUPqGmjo96iTbJBQ-1; Sat, 22 Oct 2022 11:48:23 -0400 X-MC-Unique: 6wXycPoUPqGmjo96iTbJBQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BD53585A583; Sat, 22 Oct 2022 15:48:22 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F96D4A9268; Sat, 22 Oct 2022 15:48:22 +0000 (UTC) From: Emanuele Giuseppe Esposito To: kvm@vger.kernel.org Cc: Paolo Bonzini , Jonathan Corbet , Maxim Levitsky , Sean Christopherson , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , David Hildenbrand , x86@kernel.org, "H. Peter Anvin" , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Emanuele Giuseppe Esposito Subject: [PATCH 2/4] KVM: introduce kvm_clear_all_cpus_request Date: Sat, 22 Oct 2022 11:48:17 -0400 Message-Id: <20221022154819.1823133-3-eesposit@redhat.com> In-Reply-To: <20221022154819.1823133-1-eesposit@redhat.com> References: <20221022154819.1823133-1-eesposit@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Clear the given request in all vcpus of the VM with struct kvm. Signed-off-by: Emanuele Giuseppe Esposito --- Documentation/virt/kvm/vcpu-requests.rst | 3 +++ virt/kvm/kvm_main.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/Documentation/virt/kvm/vcpu-requests.rst b/Documentation/virt/= kvm/vcpu-requests.rst index 31f62b64e07b..468410dfe84d 100644 --- a/Documentation/virt/kvm/vcpu-requests.rst +++ b/Documentation/virt/kvm/vcpu-requests.rst @@ -36,6 +36,9 @@ its TLB with a VCPU request. The API consists of the fol= lowing functions:: /* Make request @req of all VCPUs of the VM with struct kvm @kvm. */ bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned int req); =20 + /* Clear request @req of all VCPUs of the VM with struct kvm @kvm. */ + void kvm_clear_all_cpus_request(struct kvm *kvm, unsigned int req); + Typically a requester wants the VCPU to perform the activity as soon as possible after making the request. This means most requests (kvm_make_request() calls) are followed by a call to kvm_vcpu_kick(), diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 584a5bab3af3..c080b93edc0d 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -355,6 +355,16 @@ bool kvm_make_all_cpus_request(struct kvm *kvm, unsign= ed int req) } EXPORT_SYMBOL_GPL(kvm_make_all_cpus_request); =20 +void kvm_clear_all_cpus_request(struct kvm *kvm, unsigned int req) +{ + unsigned long i; + struct kvm_vcpu *vcpu; + + kvm_for_each_vcpu(i, vcpu, kvm) + kvm_clear_request(req, vcpu); +} +EXPORT_SYMBOL_GPL(kvm_clear_all_cpus_request); + #ifndef CONFIG_HAVE_KVM_ARCH_TLB_FLUSH_ALL void kvm_flush_remote_tlbs(struct kvm *kvm) { --=20 2.31.1