* [PATCH] kvm: preemption must be disabled when calling smp_call_function_many
@ 2025-06-07 10:39 Salah Triki
2025-06-09 3:22 ` Mi, Dapeng
2025-06-09 6:39 ` Manali Shukla
0 siblings, 2 replies; 3+ messages in thread
From: Salah Triki @ 2025-06-07 10:39 UTC (permalink / raw)
To: Paolo Bonzini, kvm, linux-kernel; +Cc: salah.triki
{Disable, Enable} preemption {before, after} calling
smp_call_function_many().
Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
virt/kvm/kvm_main.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index eec82775c5bf..ab9593943846 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -209,7 +209,10 @@ static inline bool kvm_kick_many_cpus(struct cpumask *cpus, bool wait)
if (cpumask_empty(cpus))
return false;
+ preempt_disable();
smp_call_function_many(cpus, ack_kick, NULL, wait);
+ preempt_enable();
+
return true;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] kvm: preemption must be disabled when calling smp_call_function_many
2025-06-07 10:39 [PATCH] kvm: preemption must be disabled when calling smp_call_function_many Salah Triki
@ 2025-06-09 3:22 ` Mi, Dapeng
2025-06-09 6:39 ` Manali Shukla
1 sibling, 0 replies; 3+ messages in thread
From: Mi, Dapeng @ 2025-06-09 3:22 UTC (permalink / raw)
To: Salah Triki, Paolo Bonzini, kvm, linux-kernel
On 6/7/2025 6:39 PM, Salah Triki wrote:
> {Disable, Enable} preemption {before, after} calling
> smp_call_function_many().
>
> Signed-off-by: Salah Triki <salah.triki@gmail.com>
> ---
> virt/kvm/kvm_main.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index eec82775c5bf..ab9593943846 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -209,7 +209,10 @@ static inline bool kvm_kick_many_cpus(struct cpumask *cpus, bool wait)
> if (cpumask_empty(cpus))
> return false;
>
> + preempt_disable();
> smp_call_function_many(cpus, ack_kick, NULL, wait);
> + preempt_enable();
> +
> return true;
> }
>
Reviewed-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] kvm: preemption must be disabled when calling smp_call_function_many
2025-06-07 10:39 [PATCH] kvm: preemption must be disabled when calling smp_call_function_many Salah Triki
2025-06-09 3:22 ` Mi, Dapeng
@ 2025-06-09 6:39 ` Manali Shukla
1 sibling, 0 replies; 3+ messages in thread
From: Manali Shukla @ 2025-06-09 6:39 UTC (permalink / raw)
To: Salah Triki, Paolo Bonzini, kvm, linux-kernel
On 6/7/2025 4:09 PM, Salah Triki wrote:
> {Disable, Enable} preemption {before, after} calling
> smp_call_function_many().
>
> Signed-off-by: Salah Triki <salah.triki@gmail.com>
> ---
> virt/kvm/kvm_main.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index eec82775c5bf..ab9593943846 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -209,7 +209,10 @@ static inline bool kvm_kick_many_cpus(struct cpumask *cpus, bool wait)
> if (cpumask_empty(cpus))
> return false;
>
> + preempt_disable();
> smp_call_function_many(cpus, ack_kick, NULL, wait);
> + preempt_enable();
> +
> return true;
> }
>
Hi Salah,
I noticed that kvm_kick_many_cpus() is only invoked from two locations (from
kvm_make_vcpus_request_mask() and kvm_make_all_cpus_request(), and in both cases, get_cpu() is
called prior to kvm_kick_many_cpus(), with a corresponding put_cpu() afterward. Since get_cpu()
disables preemption and put_cpu() re-enables it, preemption is already disabled during the
execution of kvm_kick_many_cpus().
Given that, could you clarify the motivation behind explicitly adding preempt_disable() and
preempt_enable() within kvm_kick_many_cpus()?
-Manali
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-06-09 6:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-07 10:39 [PATCH] kvm: preemption must be disabled when calling smp_call_function_many Salah Triki
2025-06-09 3:22 ` Mi, Dapeng
2025-06-09 6:39 ` Manali Shukla
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.