use masking operation instead of test_bit for MCSF bits

Use a bit mask for testing of a set bit instead of test_bit in case no
atomic operation is needed, as this will lead to smaller and more
effective code.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
This commit is contained in:
Juergen Gross authored and Jan Beulich committed 2015-10-02 13:44:59 +02:00
1 parent 5ad97f333c
commit 90f2e2a307
3 files changed
+7 -7

No files matched your search

+4 -4
View File
@@ -1750,7 +1750,7 @@ void hypercall_cancel_continuation(void)
struct cpu_user_regs *regs = guest_cpu_user_regs();
struct mc_state *mcs = &current->mc_state;
if ( test_bit(_MCSF_in_multicall, &mcs->flags) )
if ( mcs->flags & MCSF_in_multicall )
{
__clear_bit(_MCSF_call_preempted, &mcs->flags);
}
@@ -1774,7 +1774,7 @@ unsigned long hypercall_create_continuation(
va_start(args, format);
if ( test_bit(_MCSF_in_multicall, &mcs->flags) )
if ( mcs->flags & MCSF_in_multicall )
{
__set_bit(_MCSF_call_preempted, &mcs->flags);
@@ -1852,9 +1852,9 @@ int hypercall_xlat_continuation(unsigned int *id, unsigned int nr,
va_start(args, mask);
if ( test_bit(_MCSF_in_multicall, &mcs->flags) )
if ( mcs->flags & MCSF_in_multicall )
{
if ( !test_bit(_MCSF_call_preempted, &mcs->flags) )
if ( !(mcs->flags & MCSF_call_preempted) )
{
va_end(args);
return 0;
+2 -2
View File
@@ -324,7 +324,7 @@ int compat_mmuext_op(XEN_GUEST_HANDLE_PARAM(mmuext_op_compat_t) cmp_uops,
{
struct cpu_user_regs *regs = guest_cpu_user_regs();
struct mc_state *mcs = &current->mc_state;
unsigned int arg1 = !test_bit(_MCSF_in_multicall, &mcs->flags)
unsigned int arg1 = !(mcs->flags & MCSF_in_multicall)
? regs->ecx
: mcs->call.args[1];
unsigned int left = arg1 & ~MMU_UPDATE_PREEMPTED;
@@ -338,7 +338,7 @@ int compat_mmuext_op(XEN_GUEST_HANDLE_PARAM(mmuext_op_compat_t) cmp_uops,
{
BUG_ON(!hypercall_xlat_continuation(&left, 4, 0x01, nat_ops,
cmp_uops));
if ( !test_bit(_MCSF_in_multicall, &mcs->flags) )
if ( !(mcs->flags & MCSF_in_multicall) )
regs->_ecx += count - i;
else
mcs->compat_call.args[1] += count - i;
+1 -1
View File
@@ -79,7 +79,7 @@ do_multicall(
if ( unlikely(__copy_field_to_guest(call_list, &mcs->call, result)) )
rc = -EFAULT;
else if ( test_bit(_MCSF_call_preempted, &mcs->flags) )
else if ( mcs->flags & MCSF_call_preempted )
{
/* Translate sub-call continuation to guest layout */
xlat_multicall_entry(mcs);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.