From nobody Mon Oct 6 17:06:51 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C43519E97C for ; Fri, 18 Jul 2025 06:25:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752819921; cv=none; b=GQqrGomxOu16C8YMlBTuTf+g71d0JRye+zCM8CO52Z9D7RywtGl2nICZ3ZQli0MbFAYw23ubVHO9EBx+657k2wwHzgxpd3v7iTbqhhhktOvDuEELuoWOcVfKI4zt57l4VX/XHDPbFimg5MZ1YR9nxLzRfvxzGaVbQyZc4M3Vinw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752819921; c=relaxed/simple; bh=Js+lVIECA+MlpwBwikv6Sh9BN+SgNuc+l3FHZUeQABg=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=kGneOvlMidUdxm5TfGuXu5APSIDbIe3bJVnFMsjS/eTHy4MnI/Lwgy7UODqIXXFpI6zUKH6nf5QmhQQgqoHsMEU1RagXG3ll0MSM9FsxTIT25yz3QWgEV7OhLMDFnxtlmurCTrSp3iJaFsj3e/piRQUQoyFRSujoe+iooR68PBY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=DscvzNLS; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="DscvzNLS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1752819914; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=a7673uBYPxlpUD9zTGRiH5JAVGUBZV+mL2ewwlCRHbA=; b=DscvzNLS0dGYfYnA/uRPB7aEqatRHRjdExEpId5fmEux8pT9Oinm6PHvkMMufX8xBjeyhq 2nxMGOW/hlO/0yjGk+or586I1y6Vb7QZVmS+Y0pk2ANUTiyEtDPaHTSDZuzqpXh/yt5PxV WKcFdg6ZV7aQ/sAgxYymMOfFchRMxU0= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-444-sUPP16efOQKmySaaf90OyQ-1; Fri, 18 Jul 2025 02:25:09 -0400 X-MC-Unique: sUPP16efOQKmySaaf90OyQ-1 X-Mimecast-MFC-AGG-ID: sUPP16efOQKmySaaf90OyQ_1752819907 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A71AB1800165; Fri, 18 Jul 2025 06:24:59 +0000 (UTC) Received: from server.redhat.com (unknown [10.72.112.34]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AB44E195608D; Fri, 18 Jul 2025 06:24:50 +0000 (UTC) From: Cindy Lu To: Paolo Bonzini , Vitaly Kuznetsov , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)), "H. Peter Anvin" , "Peter Zijlstra (Intel)" , "Kirill A. Shutemov" , "Xin Li (Intel)" , Rik van Riel , Jason Wang , "Ahmed S. Darwish" , kvm@vger.kernel.org (open list:KVM PARAVIRT (KVM/paravirt)), linux-kernel@vger.kernel.org (open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)), lulu@redhat.com Subject: [PATCH v1] kvm: x86: implement PV send_IPI method Date: Fri, 18 Jul 2025 14:24:00 +0800 Message-ID: <20250718062429.238723-1-lulu@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Content-Type: text/plain; charset="utf-8" From: Jason Wang We used to have PV version of send_IPI_mask and send_IPI_mask_allbutself. This patch implements PV send_IPI method to reduce the number of vmexits. Signed-off-by: Jason Wang Tested-by: Cindy Lu --- arch/x86/kernel/kvm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index 921c1c783bc1..b920cfd10441 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c @@ -557,6 +557,11 @@ static void __send_ipi_mask(const struct cpumask *mask= , int vector) local_irq_restore(flags); } =20 +static void kvm_send_ipi(int cpu, int vector) +{ + __send_ipi_mask(cpumask_of(cpu), vector); +} + static void kvm_send_ipi_mask(const struct cpumask *mask, int vector) { __send_ipi_mask(mask, vector); @@ -628,6 +633,7 @@ late_initcall(setup_efi_kvm_sev_migration); */ static __init void kvm_setup_pv_ipi(void) { + apic_update_callback(send_IPI, kvm_send_ipi); apic_update_callback(send_IPI_mask, kvm_send_ipi_mask); apic_update_callback(send_IPI_mask_allbutself, kvm_send_ipi_mask_allbutse= lf); pr_info("setup PV IPIs\n"); --=20 2.45.0