]>
git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blob - drivers/xen/preempt.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Preemptible hypercalls
5 * Copyright (C) 2014 Citrix Systems R&D ltd.
8 #include <linux/sched.h>
9 #include <xen/xen-ops.h>
11 #ifndef CONFIG_PREEMPTION
14 * Some hypercalls issued by the toolstack can take many 10s of
15 * seconds. Allow tasks running hypercalls via the privcmd driver to
16 * be voluntarily preempted even if full kernel preemption is
19 * Such preemptible hypercalls are bracketed by
20 * xen_preemptible_hcall_begin() and xen_preemptible_hcall_end()
24 DEFINE_PER_CPU(bool, xen_in_preemptible_hcall
);
25 EXPORT_SYMBOL_GPL(xen_in_preemptible_hcall
);
27 asmlinkage __visible
void xen_maybe_preempt_hcall(void)
29 if (unlikely(__this_cpu_read(xen_in_preemptible_hcall
)
32 * Clear flag as we may be rescheduled on a different
35 __this_cpu_write(xen_in_preemptible_hcall
, false);
39 __this_cpu_write(xen_in_preemptible_hcall
, true);
42 #endif /* CONFIG_PREEMPTION */