mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
common: make hypercall preemption checks consistent
- never preempt on the first iteration (ensure forward progress) - do cheap checks first Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Tim Deegan <tim@xen.org> Acked-by: Keir Fraser <keir@xen.org>
This commit is contained in:
1 parent
bea8ee1a5f
commit
8c0eed2cc8
3 files changed
+8
-7
No files matched your search
+5
-4
@@ -63,7 +63,7 @@ static void increase_reservation(struct memop_args *a)
|
||||
|
||||
for ( i = a->nr_done; i < a->nr_extents; i++ )
|
||||
{
|
||||
if ( hypercall_preempt_check() )
|
||||
if ( i != a->nr_done && hypercall_preempt_check() )
|
||||
{
|
||||
a->preempted = 1;
|
||||
goto out;
|
||||
@@ -109,7 +109,7 @@ static void populate_physmap(struct memop_args *a)
|
||||
|
||||
for ( i = a->nr_done; i < a->nr_extents; i++ )
|
||||
{
|
||||
if ( hypercall_preempt_check() )
|
||||
if ( i != a->nr_done && hypercall_preempt_check() )
|
||||
{
|
||||
a->preempted = 1;
|
||||
goto out;
|
||||
@@ -268,7 +268,7 @@ static void decrease_reservation(struct memop_args *a)
|
||||
|
||||
for ( i = a->nr_done; i < a->nr_extents; i++ )
|
||||
{
|
||||
if ( hypercall_preempt_check() && i != a->nr_done )
|
||||
if ( i != a->nr_done && hypercall_preempt_check() )
|
||||
{
|
||||
a->preempted = 1;
|
||||
goto out;
|
||||
@@ -398,7 +398,8 @@ static long memory_exchange(XEN_GUEST_HANDLE_PARAM(xen_memory_exchange_t) arg)
|
||||
i < (exch.in.nr_extents >> in_chunk_order);
|
||||
i++ )
|
||||
{
|
||||
if ( hypercall_preempt_check() )
|
||||
if ( i != (exch.nr_exchanged >> in_chunk_order) &&
|
||||
hypercall_preempt_check() )
|
||||
{
|
||||
exch.nr_exchanged = i << in_chunk_order;
|
||||
rcu_unlock_domain(d);
|
||||
|
||||
@@ -52,7 +52,7 @@ do_multicall(
|
||||
|
||||
for ( i = 0; !rc && i < nr_calls; i++ )
|
||||
{
|
||||
if ( hypercall_preempt_check() )
|
||||
if ( i && hypercall_preempt_check() )
|
||||
goto preempted;
|
||||
|
||||
if ( unlikely(__copy_from_guest(&mcs->call, call_list, 1)) )
|
||||
|
||||
@@ -375,12 +375,12 @@ static DECLARE_SOFTIRQ_TASKLET(notify_dom0_con_ring_tasklet,
|
||||
static long guest_console_write(XEN_GUEST_HANDLE_PARAM(char) buffer, int count)
|
||||
{
|
||||
char kbuf[128];
|
||||
int kcount;
|
||||
int kcount = 0;
|
||||
struct domain *cd = current->domain;
|
||||
|
||||
while ( count > 0 )
|
||||
{
|
||||
if ( hypercall_preempt_check() )
|
||||
if ( kcount && hypercall_preempt_check() )
|
||||
return hypercall_create_continuation(
|
||||
__HYPERVISOR_console_io, "iih",
|
||||
CONSOLEIO_write, count, buffer);
|
||||
|
||||