From nobody Tue Dec 2 02:49:48 2025 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 13BBC306D3D; Tue, 18 Nov 2025 08:07:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763453233; cv=none; b=GSt7GW3G11nXrlLtXu8LLyhlNC/5bZ47VeThhtiacqvhRZsy5d9o6szZoCVPRnYhu0WBGjNWRYNyUtVmQn43Ha8S+XXDRZqw2z4yPwK3R9NwTa63o0KBErHe1vt84nOb+641GsbJhO6kNghcLuy7e8eHDaHAqFB+oCCml96Qq8A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763453233; c=relaxed/simple; bh=ib7FKH9NdEy+A99XTbmlI/xTvKgGUUOH0Pew0YjcIpY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bA4nShJd8BygrA+qSsZ5FB5o8Qr932+uPvsNw+o0z7cFd5H0ajiEMnqklgWliW2kTb6AyLCDfrA3WhZn5BV/R0+cHCEuNqMvpWdiizTEst1aFWYzG7bvl3ORMMznlXMKiPZwLelYiuZ1QtERtg0xPd3d7rziPh3pS88FsrAn7Zs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.client-ip=114.242.206.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [10.2.5.213]) by gateway (Coremail) with SMTP id _____8Cx5tAoKRxp89gkAA--.14111S3; Tue, 18 Nov 2025 16:07:04 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.213]) by front1 (Coremail) with SMTP id qMiowJBxjcEhKRxpUhc3AQ--.33984S3; Tue, 18 Nov 2025 16:07:02 +0800 (CST) From: Bibo Mao To: Paolo Bonzini , Huacai Chen , Tianrui Zhao , WANG Xuerui Cc: kvm@vger.kernel.org, loongarch@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] LoongArch: KVM: Add preempt hint feature in hypervisor side Date: Tue, 18 Nov 2025 16:06:54 +0800 Message-Id: <20251118080656.2012805-2-maobibo@loongson.cn> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20251118080656.2012805-1-maobibo@loongson.cn> References: <20251118080656.2012805-1-maobibo@loongson.cn> 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-CM-TRANSID: qMiowJBxjcEhKRxpUhc3AQ--.33984S3 X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== Content-Type: text/plain; charset="utf-8" Feature KVM_FEATURE_PREEMPT_HINT is added to show whether vCPU is preempted or not. It is to help guest OS scheduling or lock checking etc. Here add KVM_FEATURE_PREEMPT_HINT feature and use one byte as preempted flag in steal time structure. Signed-off-by: Bibo Mao --- arch/loongarch/include/asm/kvm_host.h | 2 + arch/loongarch/include/asm/kvm_para.h | 5 +- arch/loongarch/include/uapi/asm/kvm.h | 1 + arch/loongarch/include/uapi/asm/kvm_para.h | 1 + arch/loongarch/kvm/vcpu.c | 54 +++++++++++++++++++++- arch/loongarch/kvm/vm.c | 5 +- 6 files changed, 65 insertions(+), 3 deletions(-) diff --git a/arch/loongarch/include/asm/kvm_host.h b/arch/loongarch/include= /asm/kvm_host.h index 0cecbd038bb3..04c6dd171877 100644 --- a/arch/loongarch/include/asm/kvm_host.h +++ b/arch/loongarch/include/asm/kvm_host.h @@ -163,6 +163,7 @@ enum emulation_result { #define LOONGARCH_PV_FEAT_UPDATED BIT_ULL(63) #define LOONGARCH_PV_FEAT_MASK (BIT(KVM_FEATURE_IPI) | \ BIT(KVM_FEATURE_STEAL_TIME) | \ + BIT(KVM_FEATURE_PREEMPT_HINT) |\ BIT(KVM_FEATURE_USER_HCALL) | \ BIT(KVM_FEATURE_VIRT_EXTIOI)) =20 @@ -250,6 +251,7 @@ struct kvm_vcpu_arch { u64 guest_addr; u64 last_steal; struct gfn_to_hva_cache cache; + u8 preempted; } st; }; =20 diff --git a/arch/loongarch/include/asm/kvm_para.h b/arch/loongarch/include= /asm/kvm_para.h index 3e4b397f423f..d8592a7f5922 100644 --- a/arch/loongarch/include/asm/kvm_para.h +++ b/arch/loongarch/include/asm/kvm_para.h @@ -37,8 +37,11 @@ struct kvm_steal_time { __u64 steal; __u32 version; __u32 flags; - __u32 pad[12]; + __u8 preempted; + __u8 u8_pad[3]; + __u32 pad[11]; }; +#define KVM_VCPU_PREEMPTED (1 << 0) =20 /* * Hypercall interface for KVM hypervisor diff --git a/arch/loongarch/include/uapi/asm/kvm.h b/arch/loongarch/include= /uapi/asm/kvm.h index 57ba1a563bb1..bca7154aa651 100644 --- a/arch/loongarch/include/uapi/asm/kvm.h +++ b/arch/loongarch/include/uapi/asm/kvm.h @@ -104,6 +104,7 @@ struct kvm_fpu { #define KVM_LOONGARCH_VM_FEAT_PV_IPI 6 #define KVM_LOONGARCH_VM_FEAT_PV_STEALTIME 7 #define KVM_LOONGARCH_VM_FEAT_PTW 8 +#define KVM_LOONGARCH_VM_FEAT_PV_PREEMPT_HINT 10 =20 /* Device Control API on vcpu fd */ #define KVM_LOONGARCH_VCPU_CPUCFG 0 diff --git a/arch/loongarch/include/uapi/asm/kvm_para.h b/arch/loongarch/in= clude/uapi/asm/kvm_para.h index 76d802ef01ce..fe4107869ce6 100644 --- a/arch/loongarch/include/uapi/asm/kvm_para.h +++ b/arch/loongarch/include/uapi/asm/kvm_para.h @@ -15,6 +15,7 @@ #define CPUCFG_KVM_FEATURE (CPUCFG_KVM_BASE + 4) #define KVM_FEATURE_IPI 1 #define KVM_FEATURE_STEAL_TIME 2 +#define KVM_FEATURE_PREEMPT_HINT 3 /* BIT 24 - 31 are features configurable by user space vmm */ #define KVM_FEATURE_VIRT_EXTIOI 24 #define KVM_FEATURE_USER_HCALL 25 diff --git a/arch/loongarch/kvm/vcpu.c b/arch/loongarch/kvm/vcpu.c index 1245a6b35896..33a94b191b5d 100644 --- a/arch/loongarch/kvm/vcpu.c +++ b/arch/loongarch/kvm/vcpu.c @@ -180,6 +180,11 @@ static void kvm_update_stolen_time(struct kvm_vcpu *vc= pu) } =20 st =3D (struct kvm_steal_time __user *)ghc->hva; + if (kvm_guest_has_pv_feature(vcpu, KVM_FEATURE_PREEMPT_HINT)) { + unsafe_put_user(0, &st->preempted, out); + vcpu->arch.st.preempted =3D 0; + } + unsafe_get_user(version, &st->version, out); if (version & 1) version +=3D 1; /* first time write, random junk */ @@ -1757,11 +1762,58 @@ static int _kvm_vcpu_put(struct kvm_vcpu *vcpu, int= cpu) return 0; } =20 +static void _kvm_set_vcpu_preempted(struct kvm_vcpu *vcpu) +{ + struct gfn_to_hva_cache *ghc; + struct kvm_steal_time __user *st; + struct kvm_memslots *slots; + static const u8 preempted =3D KVM_VCPU_PREEMPTED; + gpa_t gpa; + + gpa =3D vcpu->arch.st.guest_addr; + if (!(gpa & KVM_STEAL_PHYS_VALID)) + return; + + /* vCPU may be preempted for many times */ + if (vcpu->arch.st.preempted) + return; + + /* This happens on process exit */ + if (unlikely(current->mm !=3D vcpu->kvm->mm)) + return; + + gpa &=3D KVM_STEAL_PHYS_MASK; + ghc =3D &vcpu->arch.st.cache; + slots =3D kvm_memslots(vcpu->kvm); + if (slots->generation !=3D ghc->generation || gpa !=3D ghc->gpa) { + if (kvm_gfn_to_hva_cache_init(vcpu->kvm, ghc, gpa, sizeof(*st))) { + ghc->gpa =3D INVALID_GPA; + return; + } + } + + st =3D (struct kvm_steal_time __user *)ghc->hva; + unsafe_put_user(preempted, &st->preempted, out); + vcpu->arch.st.preempted =3D KVM_VCPU_PREEMPTED; +out: + mark_page_dirty_in_slot(vcpu->kvm, ghc->memslot, gpa_to_gfn(ghc->gpa)); +} + void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) { - int cpu; + int cpu, idx; unsigned long flags; =20 + if (vcpu->preempted && kvm_guest_has_pv_feature(vcpu, KVM_FEATURE_PREEMPT= _HINT)) { + /* + * Take the srcu lock as memslots will be accessed to check the gfn + * cache generation against the memslots generation. + */ + idx =3D srcu_read_lock(&vcpu->kvm->srcu); + _kvm_set_vcpu_preempted(vcpu); + srcu_read_unlock(&vcpu->kvm->srcu, idx); + } + local_irq_save(flags); cpu =3D smp_processor_id(); vcpu->arch.last_sched_cpu =3D cpu; diff --git a/arch/loongarch/kvm/vm.c b/arch/loongarch/kvm/vm.c index a49b1c1a3dd1..b8879110a0a1 100644 --- a/arch/loongarch/kvm/vm.c +++ b/arch/loongarch/kvm/vm.c @@ -45,8 +45,10 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) =20 /* Enable all PV features by default */ kvm->arch.pv_features =3D BIT(KVM_FEATURE_IPI); - if (kvm_pvtime_supported()) + if (kvm_pvtime_supported()) { kvm->arch.pv_features |=3D BIT(KVM_FEATURE_STEAL_TIME); + kvm->arch.pv_features |=3D BIT(KVM_FEATURE_PREEMPT_HINT); + } =20 /* * cpu_vabits means user address space only (a half of total). @@ -143,6 +145,7 @@ static int kvm_vm_feature_has_attr(struct kvm *kvm, str= uct kvm_device_attr *attr case KVM_LOONGARCH_VM_FEAT_PV_IPI: return 0; case KVM_LOONGARCH_VM_FEAT_PV_STEALTIME: + case KVM_LOONGARCH_VM_FEAT_PV_PREEMPT_HINT: if (kvm_pvtime_supported()) return 0; return -ENXIO; --=20 2.39.3 From nobody Tue Dec 2 02:49:48 2025 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ECF67307AE4; Tue, 18 Nov 2025 08:07:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763453234; cv=none; b=sAoVImXtdguL9VEhmVgqiVrAvR97bxc+OxDfbIVnR9c1Cc8Q6U07MCLUDDxckXFNR3Pa6zcuX9yJ7UqF4BRrda3AKZSJKwm8Z1OZh6O2EDzaR8GM4co4VJFVgNqFDl//WSskEwmjgmyOQyQohuWEq1uQzslRw0zW/kcHOFi/LBs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763453234; c=relaxed/simple; bh=NrRX9it4MnWayj4eZuSINZrMRfhV19Whgr9Ms4aUU7I=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ERT4Ojb0ooKUYi+2AM7+Cz+jQo1BXZ8hZZiVgQ/dAz2zBjMhEq6IftQdVj7K5sZP/QcLeUgH00GLGI4kuHezxyuQAS8qHTUdBsETtmjAdd14HG8vOJPfAXMpaaliV0fzbF7cVlsCCL9dcJV98Jz0oRs9sr8W/XWAPd5uSGMIj3E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.client-ip=114.242.206.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [10.2.5.213]) by gateway (Coremail) with SMTP id _____8Cx778qKRxp+9gkAA--.11769S3; Tue, 18 Nov 2025 16:07:06 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.213]) by front1 (Coremail) with SMTP id qMiowJBxjcEhKRxpUhc3AQ--.33984S4; Tue, 18 Nov 2025 16:07:04 +0800 (CST) From: Bibo Mao To: Paolo Bonzini , Huacai Chen , WANG Xuerui , Peter Zijlstra , Ingo Molnar , Will Deacon , Boqun Feng , Waiman Long , Juergen Gross , Ajay Kaher , Alexey Makhalov , Broadcom internal kernel review list Cc: kvm@vger.kernel.org, loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, virtualization@lists.linux.dev, x86@kernel.org Subject: [PATCH 2/3] LoongArch: Add paravirt support with vcpu_is_preempted() Date: Tue, 18 Nov 2025 16:06:55 +0800 Message-Id: <20251118080656.2012805-3-maobibo@loongson.cn> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20251118080656.2012805-1-maobibo@loongson.cn> References: <20251118080656.2012805-1-maobibo@loongson.cn> 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-CM-TRANSID: qMiowJBxjcEhKRxpUhc3AQ--.33984S4 X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== Content-Type: text/plain; charset="utf-8" Function vcpu_is_preempted() is used to check whether vCPU is preempted or not. Here add implementation with vcpu_is_preempted() when option CONFIG_PARAVIRT is enabled. Signed-off-by: Bibo Mao --- arch/loongarch/include/asm/smp.h | 1 + arch/loongarch/include/asm/spinlock.h | 5 +++++ arch/loongarch/kernel/paravirt.c | 16 ++++++++++++++++ arch/loongarch/kernel/smp.c | 6 ++++++ 4 files changed, 28 insertions(+) diff --git a/arch/loongarch/include/asm/smp.h b/arch/loongarch/include/asm/= smp.h index 3a47f52959a8..5b37f7bf2060 100644 --- a/arch/loongarch/include/asm/smp.h +++ b/arch/loongarch/include/asm/smp.h @@ -18,6 +18,7 @@ struct smp_ops { void (*init_ipi)(void); void (*send_ipi_single)(int cpu, unsigned int action); void (*send_ipi_mask)(const struct cpumask *mask, unsigned int action); + bool (*vcpu_is_preempted)(int cpu); }; extern struct smp_ops mp_ops; =20 diff --git a/arch/loongarch/include/asm/spinlock.h b/arch/loongarch/include= /asm/spinlock.h index 7cb3476999be..c001cef893aa 100644 --- a/arch/loongarch/include/asm/spinlock.h +++ b/arch/loongarch/include/asm/spinlock.h @@ -5,6 +5,11 @@ #ifndef _ASM_SPINLOCK_H #define _ASM_SPINLOCK_H =20 +#ifdef CONFIG_PARAVIRT +#define vcpu_is_preempted vcpu_is_preempted +bool vcpu_is_preempted(int cpu); +#endif + #include #include #include diff --git a/arch/loongarch/kernel/paravirt.c b/arch/loongarch/kernel/parav= irt.c index b1b51f920b23..b99404b6b13f 100644 --- a/arch/loongarch/kernel/paravirt.c +++ b/arch/loongarch/kernel/paravirt.c @@ -52,6 +52,13 @@ static u64 paravt_steal_clock(int cpu) #ifdef CONFIG_SMP static struct smp_ops native_ops; =20 +static bool pv_vcpu_is_preempted(int cpu) +{ + struct kvm_steal_time *src =3D &per_cpu(steal_time, cpu); + + return !!(src->preempted & KVM_VCPU_PREEMPTED); +} + static void pv_send_ipi_single(int cpu, unsigned int action) { int min, old; @@ -308,6 +315,9 @@ int __init pv_time_init(void) pr_err("Failed to install cpu hotplug callbacks\n"); return r; } + + if (kvm_para_has_feature(KVM_FEATURE_PREEMPT_HINT)) + mp_ops.vcpu_is_preempted =3D pv_vcpu_is_preempted; #endif =20 static_call_update(pv_steal_clock, paravt_steal_clock); @@ -332,3 +342,9 @@ int __init pv_spinlock_init(void) =20 return 0; } + +bool notrace vcpu_is_preempted(int cpu) +{ + return mp_ops.vcpu_is_preempted(cpu); +} +EXPORT_SYMBOL(vcpu_is_preempted); diff --git a/arch/loongarch/kernel/smp.c b/arch/loongarch/kernel/smp.c index 46036d98da75..f04192fedf8d 100644 --- a/arch/loongarch/kernel/smp.c +++ b/arch/loongarch/kernel/smp.c @@ -307,10 +307,16 @@ static void loongson_init_ipi(void) panic("IPI IRQ request failed\n"); } =20 +static bool loongson_vcpu_is_preempted(int cpu) +{ + return false; +} + struct smp_ops mp_ops =3D { .init_ipi =3D loongson_init_ipi, .send_ipi_single =3D loongson_send_ipi_single, .send_ipi_mask =3D loongson_send_ipi_mask, + .vcpu_is_preempted =3D loongson_vcpu_is_preempted, }; =20 static void __init fdt_smp_setup(void) --=20 2.39.3 From nobody Tue Dec 2 02:49:48 2025 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3668B3074BB; Tue, 18 Nov 2025 08:07:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763453241; cv=none; b=urZM7yoyfhFCtCL/1GfYzXTJ/fhsKrdh6McqC34OzgIA6DW+2Ihy07wECwqwK3Ar9lnmocbakL5K8QF/OTUiMGPjomiAnPjR8eFwHNT2jrEyiEDUMWZf2bYAG58crJwyD1Fiq42vCMQzI6vqZXCM3zRlrhhW+LJOGMHDN5stEog= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763453241; c=relaxed/simple; bh=FHBYnYx9E71kz6F0WzQVGiFMwXRhZuGue7tKqX4UKcc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=AZzMy+7JE9P7CcB0ToSuCliq5hjcWybaMUNZhVYw0SJfk1M+6OcSoUse8S12ZDCzfL5ccv3brARvrtiPbGWRrdW4nqYtWWmzVIACIRvbSU32qq85DEtBRxMMvtbKcM4U4SsAJfK9GkbaseNCPK7+AJHze11iDC2jxmV1bhXxrgQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.client-ip=114.242.206.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [10.2.5.213]) by gateway (Coremail) with SMTP id _____8Cxbb8yKRxpCtkkAA--.12932S3; Tue, 18 Nov 2025 16:07:14 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.213]) by front1 (Coremail) with SMTP id qMiowJBxC8EsKRxpbBc3AQ--.49231S2; Tue, 18 Nov 2025 16:07:13 +0800 (CST) From: Bibo Mao To: Paolo Bonzini , Huacai Chen , Juergen Gross , Ajay Kaher , Alexey Makhalov , Broadcom internal kernel review list , WANG Xuerui Cc: kvm@vger.kernel.org, loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, virtualization@lists.linux.dev, x86@kernel.org Subject: [PATCH 3/3] LoongArch: Add paravirt preempt hint print prompt Date: Tue, 18 Nov 2025 16:06:56 +0800 Message-Id: <20251118080656.2012805-4-maobibo@loongson.cn> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20251118080656.2012805-1-maobibo@loongson.cn> References: <20251118080656.2012805-1-maobibo@loongson.cn> 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-CM-TRANSID: qMiowJBxC8EsKRxpbBc3AQ--.49231S2 X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== Content-Type: text/plain; charset="utf-8" Add paravirt preempt hint print prompt together with steal timer information, so that it is easy to check whether paravirt preempt hint feature is enabled or not. Signed-off-by: Bibo Mao --- arch/loongarch/kernel/paravirt.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/loongarch/kernel/paravirt.c b/arch/loongarch/kernel/parav= irt.c index b99404b6b13f..b7ea511c288b 100644 --- a/arch/loongarch/kernel/paravirt.c +++ b/arch/loongarch/kernel/paravirt.c @@ -294,6 +294,7 @@ static struct notifier_block pv_reboot_nb =3D { int __init pv_time_init(void) { int r; + bool pv_preempted =3D false; =20 if (!kvm_para_has_feature(KVM_FEATURE_STEAL_TIME)) return 0; @@ -316,8 +317,10 @@ int __init pv_time_init(void) return r; } =20 - if (kvm_para_has_feature(KVM_FEATURE_PREEMPT_HINT)) + if (kvm_para_has_feature(KVM_FEATURE_PREEMPT_HINT)) { mp_ops.vcpu_is_preempted =3D pv_vcpu_is_preempted; + pv_preempted =3D true; + } #endif =20 static_call_update(pv_steal_clock, paravt_steal_clock); @@ -328,7 +331,10 @@ int __init pv_time_init(void) static_key_slow_inc(¶virt_steal_rq_enabled); #endif =20 - pr_info("Using paravirt steal-time\n"); + if (pv_preempted) + pr_info("Using paravirt steal-time with preempt hint enabled\n"); + else + pr_info("Using paravirt steal-time with preempt hint disabled\n"); =20 return 0; } --=20 2.39.3