Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp4375121rwi; Sat, 22 Oct 2022 09:06:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4TTuIEHhGH4nEi4/oiyjuB81MHvJdrUYI0d5A7kPUKIPn/ZObLNl7EO6EvL0wpkEjBk7L2 X-Received: by 2002:a17:90b:1644:b0:20b:aa58:125c with SMTP id il4-20020a17090b164400b0020baa58125cmr29526831pjb.110.1666454781509; Sat, 22 Oct 2022 09:06:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666454781; cv=none; d=google.com; s=arc-20160816; b=JMwrne9XP9ZL8gBdXLWlOPx+iAcwc9S27Y1BCLBIHC634664SeuxMbYSuMBfekxt5s SNxOqRpBgGPX3AaM93VgbxuMtx8U27RA/WII6MuKSKLqo9fB2Gmvoq0HIokZzM/GBAmR Kt6zXhF4zL1PR/5NV8SjNPken/gHmx081jlw6TyjbIQlUD5RqgnJrFwW96gCQ8lRJ9En PE7voRI6IOD6WnC3+h3f/xLIVg+AbMsXv2IDqq0Mxvdt+UmFNMyRa0Prd/kbqsm2tEij 9FfUFjoa6Yg2VRen3CGbMOtUKDVmMuJUlVN66DJUDbP9ve6UKKmF/v1vG5g1Wj4BBuhe KbYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EDSXo8hsV8NzzkWo+KouABAzM9HOiQi26MuXJl4LsjA=; b=t+SqJHZ/aMoaaa2iXdkUAM7vjt22spa9XTLwk5YHYoozefcpHBD3PFbfgsX9UgaKw4 EKgspH1spP+a4+5x5gxZTeZi4JzHIP1Yhxi4r2Raoi2ib58DgMYUK3DKzmp8sQgWjONU t6RDtgBvRyKT/AJSxnGqbmA9ILF8iToNMkDsB67vYWBPRL1sCm9Whzn9zzkqzwQy6Vxs T1q3PUeKys+zfxWToId0Pqb8BlljqxUGM2eHeNn3DX0x4JCh2wlk3snZuM1jHkjc6znV +oSdpJL2QIHybNtEdGLDpqwT8ks9K8u6mesadrDHRpqryKHqSWAjpFvwIUyl6nYqLQET jlLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JK5ku7k1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g20-20020a056a000b9400b00541505b05dbsi31039685pfj.31.2022.10.22.09.05.49; Sat, 22 Oct 2022 09:06:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JK5ku7k1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229920AbiJVPsl (ORCPT + 99 others); Sat, 22 Oct 2022 11:48:41 -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: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 following 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); + /* 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, unsigned int req) } EXPORT_SYMBOL_GPL(kvm_make_all_cpus_request); +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) { -- 2.31.1