|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] xen/multicall: Use the common hcall_preempted boolean
commit b26c93fb1b14501fece01b213590896c2c069770
Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Tue Feb 14 18:06:59 2017 +0000
Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Thu Feb 16 14:15:25 2017 +0000
xen/multicall: Use the common hcall_preempted boolean
The now-common hcall_preempted boolean is perfectly usable for multicalls.
Remove the multicall-specific preemption mechanism.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Julien Grall <julien.grall@xxxxxxx>
---
xen/arch/arm/domain.c | 13 +++----------
xen/arch/x86/domain.c | 19 ++++++-------------
xen/common/multicall.c | 4 +++-
xen/include/xen/multicall.h | 2 --
4 files changed, 12 insertions(+), 26 deletions(-)
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index ee80334..bb327da 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -348,12 +348,7 @@ void sync_vcpu_execstate(struct vcpu *v)
void hypercall_cancel_continuation(void)
{
- struct mc_state *mcs = ¤t->mc_state;
-
- if ( mcs->flags & MCSF_in_multicall )
- __clear_bit(_MCSF_call_preempted, &mcs->flags);
- else
- current->hcall_preempted = false;
+ current->hcall_preempted = false;
}
unsigned long hypercall_create_continuation(
@@ -369,12 +364,12 @@ unsigned long hypercall_create_continuation(
/* All hypercalls take at least one argument */
BUG_ON( !p || *p == '\0' );
+ current->hcall_preempted = true;
+
va_start(args, format);
if ( mcs->flags & MCSF_in_multicall )
{
- __set_bit(_MCSF_call_preempted, &mcs->flags);
-
for ( i = 0; *p != '\0'; i++ )
mcs->call.args[i] = next_arg(p, args);
@@ -385,8 +380,6 @@ unsigned long hypercall_create_continuation(
{
regs = guest_cpu_user_regs();
- current->hcall_preempted = true;
-
#ifdef CONFIG_ARM_64
if ( !is_32bit_domain(current->domain) )
{
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 3fb1bdc..4ffd94b 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -2197,41 +2197,34 @@ void sync_vcpu_execstate(struct vcpu *v)
void hypercall_cancel_continuation(void)
{
- struct mc_state *mcs = ¤t->mc_state;
-
- if ( mcs->flags & MCSF_in_multicall )
- __clear_bit(_MCSF_call_preempted, &mcs->flags);
- else
- current->hcall_preempted = false;
+ current->hcall_preempted = false;
}
unsigned long hypercall_create_continuation(
unsigned int op, const char *format, ...)
{
- struct mc_state *mcs = ¤t->mc_state;
+ struct vcpu *curr = current;
+ struct mc_state *mcs = &curr->mc_state;
const char *p = format;
unsigned long arg;
unsigned int i;
va_list args;
+ curr->hcall_preempted = true;
+
va_start(args, format);
if ( mcs->flags & MCSF_in_multicall )
{
- __set_bit(_MCSF_call_preempted, &mcs->flags);
-
for ( i = 0; *p != '\0'; i++ )
mcs->call.args[i] = next_arg(p, args);
}
else
{
struct cpu_user_regs *regs = guest_cpu_user_regs();
- struct vcpu *curr = current;
regs->rax = op;
- curr->hcall_preempted = true;
-
if ( is_pv_vcpu(curr) ?
!is_pv_32bit_vcpu(curr) :
curr->arch.hvm_vcpu.hcall_64bit )
@@ -2292,7 +2285,7 @@ int hypercall_xlat_continuation(unsigned int *id,
unsigned int nr,
if ( mcs->flags & MCSF_in_multicall )
{
- if ( !(mcs->flags & MCSF_call_preempted) )
+ if ( !current->hcall_preempted )
{
va_end(args);
return 0;
diff --git a/xen/common/multicall.c b/xen/common/multicall.c
index f7880a8..cc8daf9 100644
--- a/xen/common/multicall.c
+++ b/xen/common/multicall.c
@@ -78,7 +78,7 @@ do_multicall(
if ( unlikely(__copy_field_to_guest(call_list, &mcs->call, result)) )
rc = -EFAULT;
- else if ( mcs->flags & MCSF_call_preempted )
+ else if ( current->hcall_preempted )
{
/* Translate sub-call continuation to guest layout */
xlat_multicall_entry(mcs);
@@ -86,6 +86,8 @@ do_multicall(
/* Copy the sub-call continuation. */
if ( likely(!__copy_to_guest(call_list, &mcs->call, 1)) )
goto preempted;
+ else
+ hypercall_cancel_continuation();
rc = -EFAULT;
}
else
diff --git a/xen/include/xen/multicall.h b/xen/include/xen/multicall.h
index fff15eb..e8d7905 100644
--- a/xen/include/xen/multicall.h
+++ b/xen/include/xen/multicall.h
@@ -11,9 +11,7 @@
#endif
#define _MCSF_in_multicall 0
-#define _MCSF_call_preempted 1
#define MCSF_in_multicall (1<<_MCSF_in_multicall)
-#define MCSF_call_preempted (1<<_MCSF_call_preempted)
struct mc_state {
unsigned long flags;
union {
--
generated by git-patchbot for /home/xen/git/xen.git#master
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |