From patchwork Sat Oct 22 15:48:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emanuele Giuseppe Esposito X-Patchwork-Id: 7902 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1259275wrr; Sat, 22 Oct 2022 08:51:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6PETwF2Hg6nuox4JLW9K9pTcLvsa+cVe7s9YL4MwfcM7NzBzYPuFKKKiW5IoFPWQalWyLd X-Received: by 2002:a17:907:320b:b0:780:280:7b72 with SMTP id xg11-20020a170907320b00b0078002807b72mr21031687ejb.146.1666453882060; Sat, 22 Oct 2022 08:51:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666453882; cv=none; d=google.com; s=arc-20160816; b=Lca2HGqdfb4JVqV4rz2obfkbg/RXoULyW9wM/hMIrf1854c7nLxLQyMqitVWrtDk3M z6IP9iSHnH0lAioyVUsOlL0AoMudhNzXO013oA/hvFMP/pXHUZ33WzkKt/OREY5Oa5ck TKP5Os/NbSQk715re4NimjmB39ho62NZ8xA07ih992U9hIX67FgqHD3WcnERMFUWSoCP y7Bf2af4ZUYhXRnsG7e5R9M9qG6+cPuatkrRt6532bI6MOlC9ALyFH1cyfcbf+mH3bbR n/RnYpIRyRblSbpko/qLL4ms+17jDCAlcR5qhXgGqp2S57b6D3ufbnMD6660QthEHcDS jAWA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z20-20020aa7d414000000b0045915116d33si20080371edq.535.2022.10.22.08.50.57; Sat, 22 Oct 2022 08:51:22 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747403545951451135?= X-GMAIL-MSGID: =?utf-8?q?1747403545951451135?= 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) {