|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] 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>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Stefano Stabellini <sstabellini@xxxxxxxxxx>
CC: 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 fb1d8a5..39b6eb8 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -349,12 +349,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(
@@ -370,12 +365,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);
@@ -386,8 +381,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 b199c70..08c5813 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -2198,41 +2198,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 )
@@ -2293,7 +2286,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 524c9bf..02f57cb 100644
--- a/xen/common/multicall.c
+++ b/xen/common/multicall.c
@@ -79,7 +79,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);
@@ -87,6 +87,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 {
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |