[6/6] x86/smt: Don't use -EBUSY for smt_up_down_helper() continuations
diff mbox series

Message ID 20191205223008.8623-7-andrew.cooper3@citrix.com
State New
Headers show
Series
  • xen: Support continuations from tasklets
Related show

Commit Message

Andrew Cooper Dec. 5, 2019, 10:30 p.m. UTC
Tasklet context is now capable of using handling continuations.  Use this
rather than -EBUSY as it is a more efficient way to restart the hypercall.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Wei Liu <wl@xen.org>
CC: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/sysctl.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Jan Beulich Dec. 10, 2019, 10:29 a.m. UTC | #1
On 05.12.2019 23:30, Andrew Cooper wrote:
> --- a/xen/arch/x86/sysctl.c
> +++ b/xen/arch/x86/sysctl.c
> @@ -85,6 +85,9 @@ long cpu_up_helper(void *data)
>          /* On EBUSY, flush RCU work and have one more go. */
>          rcu_barrier();
>          ret = cpu_up(cpu);
> +
> +        if ( ret == -EBUSY )
> +            ret = -ERESTART;
>      }
>  
>      if ( !ret && !opt_smt &&
> @@ -110,6 +113,9 @@ long cpu_down_helper(void *data)
>          /* On EBUSY, flush RCU work and have one more go. */
>          rcu_barrier();
>          ret = cpu_down(cpu);
> +
> +        if ( ret == -EBUSY )
> +            ret = -ERESTART;
>      }
>      return ret;
>  }

For both of these - if two successive attempts didn't work, is
there really much point not reporting the fact back to the
caller? You're liable to request continuations indefinitely then.

> @@ -143,8 +149,7 @@ static long smt_up_down_helper(void *data)
>           */
>          if ( ret != -EEXIST && general_preempt_check() )
>          {
> -            /* In tasklet context - can't create a contination. */
> -            ret = -EBUSY;
> +            ret = -ERESTART;
>              break;
>          }
>  

I agree with this change.

Jan

Patch
diff mbox series

diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c
index 4a76f0f47f..06955fdc3e 100644
--- a/xen/arch/x86/sysctl.c
+++ b/xen/arch/x86/sysctl.c
@@ -85,6 +85,9 @@  long cpu_up_helper(void *data)
         /* On EBUSY, flush RCU work and have one more go. */
         rcu_barrier();
         ret = cpu_up(cpu);
+
+        if ( ret == -EBUSY )
+            ret = -ERESTART;
     }
 
     if ( !ret && !opt_smt &&
@@ -110,6 +113,9 @@  long cpu_down_helper(void *data)
         /* On EBUSY, flush RCU work and have one more go. */
         rcu_barrier();
         ret = cpu_down(cpu);
+
+        if ( ret == -EBUSY )
+            ret = -ERESTART;
     }
     return ret;
 }
@@ -143,8 +149,7 @@  static long smt_up_down_helper(void *data)
          */
         if ( ret != -EEXIST && general_preempt_check() )
         {
-            /* In tasklet context - can't create a contination. */
-            ret = -EBUSY;
+            ret = -ERESTART;
             break;
         }