All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] make do_sched_op_compat() x86-specific
@ 2015-06-08 13:28 Jan Beulich
  2015-06-08 13:36 ` Andrew Cooper
  2015-06-08 14:29 ` Ian Campbell
  0 siblings, 2 replies; 4+ messages in thread
From: Jan Beulich @ 2015-06-08 13:28 UTC (permalink / raw)
  To: xen-devel
  Cc: Ian Campbell, Andrew Cooper, Keir Fraser, Ian Jackson, Tim Deegan

[-- Attachment #1: Type: text/plain, Size: 4754 bytes --]

Being a pre-3.1 compatibility hypercall handler only, it's not needed
on ARM or any future architectures Xen may get ported to.

Also the function shouldn't really be used internally - its use should
be limited to its purpose (and hence there's also no need for a
prototype).

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/compat.c
+++ b/xen/arch/x86/compat.c
@@ -5,9 +5,10 @@
  * hypercall after doing necessary argument munging.
  */
 
-#include <xen/config.h>
 #include <xen/guest_access.h>
 #include <xen/hypercall.h>
+#include <xen/trace.h>
+#include <public/sched.h>
 
 #ifndef COMPAT
 typedef long ret_t;
@@ -26,6 +27,28 @@ ret_t do_physdev_op_compat(XEN_GUEST_HAN
 
 #ifndef COMPAT
 
+/* Legacy hypercall (as of 0x00030101). */
+long do_sched_op_compat(int cmd, unsigned long arg)
+{
+    switch ( cmd )
+    {
+    case SCHEDOP_yield:
+    case SCHEDOP_block:
+        return do_sched_op(cmd, guest_handle_from_ptr(NULL, void));
+
+    case SCHEDOP_shutdown:
+        TRACE_3D(TRC_SCHED_SHUTDOWN,
+                 current->domain->domain_id, current->vcpu_id, arg);
+        domain_shutdown(current->domain, (u8)arg);
+        break;
+
+    default:
+        return -ENOSYS;
+    }
+
+    return 0;
+}
+
 /* Legacy hypercall (as of 0x00030202). */
 long do_event_channel_op_compat(XEN_GUEST_HANDLE_PARAM(evtchn_op_t) uop)
 {
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -2705,7 +2705,7 @@ void hvm_hlt(unsigned long rflags)
     if ( unlikely(!(rflags & X86_EFLAGS_IF)) )
         return hvm_vcpu_down(curr);
 
-    do_sched_op_compat(SCHEDOP_block, 0);
+    do_sched_op(SCHEDOP_block, guest_handle_from_ptr(NULL, void));
 
     HVMTRACE_1D(HLT, /* pending = */ vcpu_runnable(curr));
 }
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -36,7 +36,7 @@
 #include <asm/cpufeature.h>
 #include <asm/processor.h>
 #include <asm/amd.h>
-#include <asm/types.h>
+#include <asm/guest_access.h>
 #include <asm/debugreg.h>
 #include <asm/msr.h>
 #include <asm/i387.h>
@@ -1988,7 +1988,7 @@ static void svm_vmexit_do_pause(struct c
      * Do something useful, like reschedule the guest
      */
     perfc_incr(pauseloop_exits);
-    do_sched_op_compat(SCHEDOP_yield, 0);
+    do_sched_op(SCHEDOP_yield, guest_handle_from_ptr(NULL, void));
 }
 
 static void
--- a/xen/arch/x86/hvm/viridian.c
+++ b/xen/arch/x86/hvm/viridian.c
@@ -9,6 +9,7 @@
 #include <xen/perfc.h>
 #include <xen/hypercall.h>
 #include <xen/domain_page.h>
+#include <asm/guest_access.h>
 #include <asm/paging.h>
 #include <asm/p2m.h>
 #include <asm/apic.h>
@@ -561,7 +562,7 @@ int viridian_hypercall(struct cpu_user_r
     {
     case HvNotifyLongSpinWait:
         perfc_incr(mshv_call_long_wait);
-        do_sched_op_compat(SCHEDOP_yield, 0);
+        do_sched_op(SCHEDOP_yield, guest_handle_from_ptr(NULL, void));
         status = HV_STATUS_SUCCESS;
         break;
     default:
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -32,7 +32,7 @@
 #include <asm/regs.h>
 #include <asm/cpufeature.h>
 #include <asm/processor.h>
-#include <asm/types.h>
+#include <asm/guest_access.h>
 #include <asm/debugreg.h>
 #include <asm/msr.h>
 #include <asm/paging.h>
@@ -3198,7 +3198,7 @@ void vmx_vmexit_handler(struct cpu_user_
 
     case EXIT_REASON_PAUSE_INSTRUCTION:
         perfc_incr(pauseloop_exits);
-        do_sched_op_compat(SCHEDOP_yield, 0);
+        do_sched_op(SCHEDOP_yield, guest_handle_from_ptr(NULL, void));
         break;
 
     case EXIT_REASON_XSETBV:
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -882,39 +882,6 @@ void watchdog_domain_destroy(struct doma
         kill_timer(&d->watchdog_timer[i]);
 }
 
-long do_sched_op_compat(int cmd, unsigned long arg)
-{
-    long ret = 0;
-
-    switch ( cmd )
-    {
-    case SCHEDOP_yield:
-    {
-        ret = vcpu_yield();
-        break;
-    }
-
-    case SCHEDOP_block:
-    {
-        vcpu_block_enable_events();
-        break;
-    }
-
-    case SCHEDOP_shutdown:
-    {
-        TRACE_3D(TRC_SCHED_SHUTDOWN,
-                 current->domain->domain_id, current->vcpu_id, arg);
-        domain_shutdown(current->domain, (u8)arg);
-        break;
-    }
-
-    default:
-        ret = -ENOSYS;
-    }
-
-    return ret;
-}
-
 typedef long ret_t;
 
 #endif /* !COMPAT */
--- a/xen/include/xen/hypercall.h
+++ b/xen/include/xen/hypercall.h
@@ -22,11 +22,6 @@ do_ni_hypercall(
     void);
 
 extern long
-do_sched_op_compat(
-    int cmd,
-    unsigned long arg);
-
-extern long
 do_sched_op(
     int cmd,
     XEN_GUEST_HANDLE_PARAM(void) arg);



[-- Attachment #2: sched-op-compat-x86-only.patch --]
[-- Type: text/plain, Size: 4792 bytes --]

make do_sched_op_compat() x86-specific

Being a pre-3.1 compatibility hypercall handler only, it's not needed
on ARM or any future architectures Xen may get ported to.

Also the function shouldn't really be used internally - its use should
be limited to its purpose (and hence there's also no need for a
prototype).

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/arch/x86/compat.c
+++ b/xen/arch/x86/compat.c
@@ -5,9 +5,10 @@
  * hypercall after doing necessary argument munging.
  */
 
-#include <xen/config.h>
 #include <xen/guest_access.h>
 #include <xen/hypercall.h>
+#include <xen/trace.h>
+#include <public/sched.h>
 
 #ifndef COMPAT
 typedef long ret_t;
@@ -26,6 +27,28 @@ ret_t do_physdev_op_compat(XEN_GUEST_HAN
 
 #ifndef COMPAT
 
+/* Legacy hypercall (as of 0x00030101). */
+long do_sched_op_compat(int cmd, unsigned long arg)
+{
+    switch ( cmd )
+    {
+    case SCHEDOP_yield:
+    case SCHEDOP_block:
+        return do_sched_op(cmd, guest_handle_from_ptr(NULL, void));
+
+    case SCHEDOP_shutdown:
+        TRACE_3D(TRC_SCHED_SHUTDOWN,
+                 current->domain->domain_id, current->vcpu_id, arg);
+        domain_shutdown(current->domain, (u8)arg);
+        break;
+
+    default:
+        return -ENOSYS;
+    }
+
+    return 0;
+}
+
 /* Legacy hypercall (as of 0x00030202). */
 long do_event_channel_op_compat(XEN_GUEST_HANDLE_PARAM(evtchn_op_t) uop)
 {
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -2705,7 +2705,7 @@ void hvm_hlt(unsigned long rflags)
     if ( unlikely(!(rflags & X86_EFLAGS_IF)) )
         return hvm_vcpu_down(curr);
 
-    do_sched_op_compat(SCHEDOP_block, 0);
+    do_sched_op(SCHEDOP_block, guest_handle_from_ptr(NULL, void));
 
     HVMTRACE_1D(HLT, /* pending = */ vcpu_runnable(curr));
 }
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -36,7 +36,7 @@
 #include <asm/cpufeature.h>
 #include <asm/processor.h>
 #include <asm/amd.h>
-#include <asm/types.h>
+#include <asm/guest_access.h>
 #include <asm/debugreg.h>
 #include <asm/msr.h>
 #include <asm/i387.h>
@@ -1988,7 +1988,7 @@ static void svm_vmexit_do_pause(struct c
      * Do something useful, like reschedule the guest
      */
     perfc_incr(pauseloop_exits);
-    do_sched_op_compat(SCHEDOP_yield, 0);
+    do_sched_op(SCHEDOP_yield, guest_handle_from_ptr(NULL, void));
 }
 
 static void
--- a/xen/arch/x86/hvm/viridian.c
+++ b/xen/arch/x86/hvm/viridian.c
@@ -9,6 +9,7 @@
 #include <xen/perfc.h>
 #include <xen/hypercall.h>
 #include <xen/domain_page.h>
+#include <asm/guest_access.h>
 #include <asm/paging.h>
 #include <asm/p2m.h>
 #include <asm/apic.h>
@@ -561,7 +562,7 @@ int viridian_hypercall(struct cpu_user_r
     {
     case HvNotifyLongSpinWait:
         perfc_incr(mshv_call_long_wait);
-        do_sched_op_compat(SCHEDOP_yield, 0);
+        do_sched_op(SCHEDOP_yield, guest_handle_from_ptr(NULL, void));
         status = HV_STATUS_SUCCESS;
         break;
     default:
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -32,7 +32,7 @@
 #include <asm/regs.h>
 #include <asm/cpufeature.h>
 #include <asm/processor.h>
-#include <asm/types.h>
+#include <asm/guest_access.h>
 #include <asm/debugreg.h>
 #include <asm/msr.h>
 #include <asm/paging.h>
@@ -3198,7 +3198,7 @@ void vmx_vmexit_handler(struct cpu_user_
 
     case EXIT_REASON_PAUSE_INSTRUCTION:
         perfc_incr(pauseloop_exits);
-        do_sched_op_compat(SCHEDOP_yield, 0);
+        do_sched_op(SCHEDOP_yield, guest_handle_from_ptr(NULL, void));
         break;
 
     case EXIT_REASON_XSETBV:
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -882,39 +882,6 @@ void watchdog_domain_destroy(struct doma
         kill_timer(&d->watchdog_timer[i]);
 }
 
-long do_sched_op_compat(int cmd, unsigned long arg)
-{
-    long ret = 0;
-
-    switch ( cmd )
-    {
-    case SCHEDOP_yield:
-    {
-        ret = vcpu_yield();
-        break;
-    }
-
-    case SCHEDOP_block:
-    {
-        vcpu_block_enable_events();
-        break;
-    }
-
-    case SCHEDOP_shutdown:
-    {
-        TRACE_3D(TRC_SCHED_SHUTDOWN,
-                 current->domain->domain_id, current->vcpu_id, arg);
-        domain_shutdown(current->domain, (u8)arg);
-        break;
-    }
-
-    default:
-        ret = -ENOSYS;
-    }
-
-    return ret;
-}
-
 typedef long ret_t;
 
 #endif /* !COMPAT */
--- a/xen/include/xen/hypercall.h
+++ b/xen/include/xen/hypercall.h
@@ -22,11 +22,6 @@ do_ni_hypercall(
     void);
 
 extern long
-do_sched_op_compat(
-    int cmd,
-    unsigned long arg);
-
-extern long
 do_sched_op(
     int cmd,
     XEN_GUEST_HANDLE_PARAM(void) arg);

[-- Attachment #3: Type: text/plain, Size: 126 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] make do_sched_op_compat() x86-specific
  2015-06-08 13:28 [PATCH] make do_sched_op_compat() x86-specific Jan Beulich
@ 2015-06-08 13:36 ` Andrew Cooper
  2015-06-08 14:29 ` Ian Campbell
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Cooper @ 2015-06-08 13:36 UTC (permalink / raw)
  To: Jan Beulich, xen-devel; +Cc: Ian Campbell, Keir Fraser, Ian Jackson, Tim Deegan

On 08/06/15 14:28, Jan Beulich wrote:
> Being a pre-3.1 compatibility hypercall handler only, it's not needed
> on ARM or any future architectures Xen may get ported to.
>
> Also the function shouldn't really be used internally - its use should
> be limited to its purpose (and hence there's also no need for a
> prototype).
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Andrew Cooper <andrew.cooper3@cirix.com>

>
> --- a/xen/arch/x86/compat.c
> +++ b/xen/arch/x86/compat.c
> @@ -5,9 +5,10 @@
>   * hypercall after doing necessary argument munging.
>   */
>  
> -#include <xen/config.h>
>  #include <xen/guest_access.h>
>  #include <xen/hypercall.h>
> +#include <xen/trace.h>
> +#include <public/sched.h>
>  
>  #ifndef COMPAT
>  typedef long ret_t;
> @@ -26,6 +27,28 @@ ret_t do_physdev_op_compat(XEN_GUEST_HAN
>  
>  #ifndef COMPAT
>  
> +/* Legacy hypercall (as of 0x00030101). */
> +long do_sched_op_compat(int cmd, unsigned long arg)
> +{
> +    switch ( cmd )
> +    {
> +    case SCHEDOP_yield:
> +    case SCHEDOP_block:
> +        return do_sched_op(cmd, guest_handle_from_ptr(NULL, void));
> +
> +    case SCHEDOP_shutdown:
> +        TRACE_3D(TRC_SCHED_SHUTDOWN,
> +                 current->domain->domain_id, current->vcpu_id, arg);
> +        domain_shutdown(current->domain, (u8)arg);
> +        break;
> +
> +    default:
> +        return -ENOSYS;
> +    }
> +
> +    return 0;
> +}
> +
>  /* Legacy hypercall (as of 0x00030202). */
>  long do_event_channel_op_compat(XEN_GUEST_HANDLE_PARAM(evtchn_op_t) uop)
>  {
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -2705,7 +2705,7 @@ void hvm_hlt(unsigned long rflags)
>      if ( unlikely(!(rflags & X86_EFLAGS_IF)) )
>          return hvm_vcpu_down(curr);
>  
> -    do_sched_op_compat(SCHEDOP_block, 0);
> +    do_sched_op(SCHEDOP_block, guest_handle_from_ptr(NULL, void));
>  
>      HVMTRACE_1D(HLT, /* pending = */ vcpu_runnable(curr));
>  }
> --- a/xen/arch/x86/hvm/svm/svm.c
> +++ b/xen/arch/x86/hvm/svm/svm.c
> @@ -36,7 +36,7 @@
>  #include <asm/cpufeature.h>
>  #include <asm/processor.h>
>  #include <asm/amd.h>
> -#include <asm/types.h>
> +#include <asm/guest_access.h>
>  #include <asm/debugreg.h>
>  #include <asm/msr.h>
>  #include <asm/i387.h>
> @@ -1988,7 +1988,7 @@ static void svm_vmexit_do_pause(struct c
>       * Do something useful, like reschedule the guest
>       */
>      perfc_incr(pauseloop_exits);
> -    do_sched_op_compat(SCHEDOP_yield, 0);
> +    do_sched_op(SCHEDOP_yield, guest_handle_from_ptr(NULL, void));
>  }
>  
>  static void
> --- a/xen/arch/x86/hvm/viridian.c
> +++ b/xen/arch/x86/hvm/viridian.c
> @@ -9,6 +9,7 @@
>  #include <xen/perfc.h>
>  #include <xen/hypercall.h>
>  #include <xen/domain_page.h>
> +#include <asm/guest_access.h>
>  #include <asm/paging.h>
>  #include <asm/p2m.h>
>  #include <asm/apic.h>
> @@ -561,7 +562,7 @@ int viridian_hypercall(struct cpu_user_r
>      {
>      case HvNotifyLongSpinWait:
>          perfc_incr(mshv_call_long_wait);
> -        do_sched_op_compat(SCHEDOP_yield, 0);
> +        do_sched_op(SCHEDOP_yield, guest_handle_from_ptr(NULL, void));
>          status = HV_STATUS_SUCCESS;
>          break;
>      default:
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -32,7 +32,7 @@
>  #include <asm/regs.h>
>  #include <asm/cpufeature.h>
>  #include <asm/processor.h>
> -#include <asm/types.h>
> +#include <asm/guest_access.h>
>  #include <asm/debugreg.h>
>  #include <asm/msr.h>
>  #include <asm/paging.h>
> @@ -3198,7 +3198,7 @@ void vmx_vmexit_handler(struct cpu_user_
>  
>      case EXIT_REASON_PAUSE_INSTRUCTION:
>          perfc_incr(pauseloop_exits);
> -        do_sched_op_compat(SCHEDOP_yield, 0);
> +        do_sched_op(SCHEDOP_yield, guest_handle_from_ptr(NULL, void));
>          break;
>  
>      case EXIT_REASON_XSETBV:
> --- a/xen/common/schedule.c
> +++ b/xen/common/schedule.c
> @@ -882,39 +882,6 @@ void watchdog_domain_destroy(struct doma
>          kill_timer(&d->watchdog_timer[i]);
>  }
>  
> -long do_sched_op_compat(int cmd, unsigned long arg)
> -{
> -    long ret = 0;
> -
> -    switch ( cmd )
> -    {
> -    case SCHEDOP_yield:
> -    {
> -        ret = vcpu_yield();
> -        break;
> -    }
> -
> -    case SCHEDOP_block:
> -    {
> -        vcpu_block_enable_events();
> -        break;
> -    }
> -
> -    case SCHEDOP_shutdown:
> -    {
> -        TRACE_3D(TRC_SCHED_SHUTDOWN,
> -                 current->domain->domain_id, current->vcpu_id, arg);
> -        domain_shutdown(current->domain, (u8)arg);
> -        break;
> -    }
> -
> -    default:
> -        ret = -ENOSYS;
> -    }
> -
> -    return ret;
> -}
> -
>  typedef long ret_t;
>  
>  #endif /* !COMPAT */
> --- a/xen/include/xen/hypercall.h
> +++ b/xen/include/xen/hypercall.h
> @@ -22,11 +22,6 @@ do_ni_hypercall(
>      void);
>  
>  extern long
> -do_sched_op_compat(
> -    int cmd,
> -    unsigned long arg);
> -
> -extern long
>  do_sched_op(
>      int cmd,
>      XEN_GUEST_HANDLE_PARAM(void) arg);
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] make do_sched_op_compat() x86-specific
  2015-06-08 13:28 [PATCH] make do_sched_op_compat() x86-specific Jan Beulich
  2015-06-08 13:36 ` Andrew Cooper
@ 2015-06-08 14:29 ` Ian Campbell
  2015-06-08 14:34   ` Jan Beulich
  1 sibling, 1 reply; 4+ messages in thread
From: Ian Campbell @ 2015-06-08 14:29 UTC (permalink / raw)
  To: Jan Beulich
  Cc: xen-devel, Tim Deegan, Keir Fraser, Ian Jackson, Andrew Cooper

On Mon, 2015-06-08 at 14:28 +0100, Jan Beulich wrote:
> Being a pre-3.1 compatibility hypercall handler only, it's not needed
> on ARM or any future architectures Xen may get ported to.
> 
> Also the function shouldn't really be used internally - its use should
> be limited to its purpose (and hence there's also no need for a
> prototype).
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Since it vaguely has something to do with arm:
Acked-by: Ian Campbell <ian.campbell@citrix.com>

Was this the only such hypercall you found?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] make do_sched_op_compat() x86-specific
  2015-06-08 14:29 ` Ian Campbell
@ 2015-06-08 14:34   ` Jan Beulich
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Beulich @ 2015-06-08 14:34 UTC (permalink / raw)
  To: Ian Campbell
  Cc: Andrew Cooper, Tim Deegan, KeirFraser, Ian Jackson, xen-devel

>>> On 08.06.15 at 16:29, <ian.campbell@citrix.com> wrote:
> On Mon, 2015-06-08 at 14:28 +0100, Jan Beulich wrote:
>> Being a pre-3.1 compatibility hypercall handler only, it's not needed
>> on ARM or any future architectures Xen may get ported to.
>> 
>> Also the function shouldn't really be used internally - its use should
>> be limited to its purpose (and hence there's also no need for a
>> prototype).
>> 
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
> 
> Since it vaguely has something to do with arm:
> Acked-by: Ian Campbell <ian.campbell@citrix.com>
> 
> Was this the only such hypercall you found?

The other two (evtchn and physdev) were already x86-specific for
whatever reason.

Jan

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-08 14:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-08 13:28 [PATCH] make do_sched_op_compat() x86-specific Jan Beulich
2015-06-08 13:36 ` Andrew Cooper
2015-06-08 14:29 ` Ian Campbell
2015-06-08 14:34   ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.