xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] xen/sched.h Whitespace and bool cleanup
@ 2017-02-15 17:39 Andrew Cooper
  2017-02-15 17:39 ` [PATCH 2/2] common/vcpu: Switch v->vcpu_info_mfn to mfn_t Andrew Cooper
  2017-02-16 10:23 ` [PATCH 1/2] xen/sched.h Whitespace and bool cleanup Jan Beulich
  0 siblings, 2 replies; 5+ messages in thread
From: Andrew Cooper @ 2017-02-15 17:39 UTC (permalink / raw)
  To: Xen-devel; +Cc: Andrew Cooper, Julien Grall, Stefano Stabellini, Jan Beulich

Extend the Maptrack comment to point at the Grant table subsystem.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien.grall@arm.com>
---
 xen/include/xen/sched.h | 48 ++++++++++++++++++++++++------------------------
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 063efe6..def097e 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -139,7 +139,7 @@ void evtchn_destroy_final(struct domain *d); /* from complete_domain_destroy */
 
 struct waitqueue_vcpu;
 
-struct vcpu 
+struct vcpu
 {
     int              vcpu_id;
 
@@ -176,20 +176,20 @@ struct vcpu
     uint64_t last_run_time;
 
     /* Has the FPU been initialised? */
-    bool_t           fpu_initialised;
+    bool             fpu_initialised;
     /* Has the FPU been used since it was last saved? */
-    bool_t           fpu_dirtied;
+    bool             fpu_dirtied;
     /* Initialization completed for this VCPU? */
-    bool_t           is_initialised;
+    bool             is_initialised;
     /* Currently running on a CPU? */
-    bool_t           is_running;
+    bool             is_running;
     /* VCPU should wake fast (do not deep sleep the CPU). */
-    bool_t           is_urgent;
+    bool             is_urgent;
 
 #ifdef VCPU_TRAP_LAST
 #define VCPU_TRAP_NONE    0
     struct {
-        bool_t           pending;
+        bool             pending;
         uint8_t          old_mask;
     }                async_exception_state[VCPU_TRAP_LAST];
 #define async_exception_state(t) async_exception_state[(t)-1]
@@ -197,11 +197,11 @@ struct vcpu
 #endif
 
     /* Require shutdown to be deferred for some asynchronous operation? */
-    bool_t           defer_shutdown;
+    bool             defer_shutdown;
     /* VCPU is paused following shutdown request (d->is_shutting_down)? */
-    bool_t           paused_for_shutdown;
+    bool             paused_for_shutdown;
     /* VCPU need affinity restored */
-    bool_t           affinity_broken;
+    bool             affinity_broken;
 
 
     /*
@@ -222,7 +222,7 @@ struct vcpu
     /* VCPU paused by system controller. */
     int              controller_pause_count;
 
-    /* Maptrack */
+    /* Grant table map tracking. */
     unsigned int     maptrack_head;
     unsigned int     maptrack_tail;
 
@@ -375,17 +375,17 @@ struct domain
     s8               need_iommu;
 #endif
     /* is node-affinity automatically computed? */
-    bool_t           auto_node_affinity;
+    bool             auto_node_affinity;
     /* Is this guest fully privileged (aka dom0)? */
-    bool_t           is_privileged;
+    bool             is_privileged;
     /* Is this a xenstore domain (not dom0)? */
-    bool_t           is_xenstore;
+    bool             is_xenstore;
     /* Domain's VCPUs are pinned 1:1 to physical CPUs? */
-    bool_t           is_pinned;
+    bool             is_pinned;
     /* Non-migratable and non-restoreable? */
-    bool_t           disable_migrate;
+    bool             disable_migrate;
     /* Is this guest being debugged by dom0? */
-    bool_t           debugger_attached;
+    bool             debugger_attached;
     /*
      * Set to true at the very end of domain creation, when the domain is
      * unpaused for the first time by the systemcontroller.
@@ -408,8 +408,8 @@ struct domain
 
     /* Guest has shut down (inc. reason code)? */
     spinlock_t       shutdown_lock;
-    bool_t           is_shutting_down; /* in process of shutting down? */
-    bool_t           is_shut_down;     /* fully shut down? */
+    bool             is_shutting_down; /* in process of shutting down? */
+    bool             is_shut_down;     /* fully shut down? */
 #define SHUTDOWN_CODE_INVALID ~0u
     unsigned int     shutdown_code;
 
@@ -558,7 +558,7 @@ struct domain *domain_create(domid_t domid, unsigned int domcr_flags,
 /*
  * rcu_lock_domain_by_id() is more efficient than get_domain_by_id().
  * This is the preferred function if the returned domain reference
- * is short lived,  but it cannot be used if the domain reference needs 
+ * is short lived,  but it cannot be used if the domain reference needs
  * to be kept beyond the current scope (e.g., across a softirq).
  * The returned domain reference must be discarded using rcu_unlock_domain().
  */
@@ -675,7 +675,7 @@ void sync_local_execstate(void);
  * sync_vcpu_execstate() will switch and commit @prev's state.
  */
 void context_switch(
-    struct vcpu *prev, 
+    struct vcpu *prev,
     struct vcpu *next);
 
 /*
@@ -853,7 +853,7 @@ uint64_t get_cpu_idle_time(unsigned int cpu);
 void watchdog_domain_init(struct domain *d);
 void watchdog_domain_destroy(struct domain *d);
 
-/* 
+/*
  * Use this check when the following are both true:
  *  - Using this feature or interface requires full access to the hardware
  *    (that is, this would not be suitable for a driver domain)
@@ -882,7 +882,7 @@ void watchdog_domain_destroy(struct domain *d);
 #define need_iommu(d)    (0)
 #endif
 
-static inline bool_t is_vcpu_online(const struct vcpu *v)
+static inline bool is_vcpu_online(const struct vcpu *v)
 {
     return !test_bit(_VPF_down, &v->pause_flags);
 }
@@ -890,7 +890,7 @@ static inline bool_t is_vcpu_online(const struct vcpu *v)
 void set_vcpu_migration_delay(unsigned int delay);
 unsigned int get_vcpu_migration_delay(void);
 
-extern bool_t sched_smt_power_savings;
+extern bool sched_smt_power_savings;
 
 extern enum cpufreq_controller {
     FREQCTL_none, FREQCTL_dom0_kernel, FREQCTL_xen
-- 
2.1.4


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

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

* [PATCH 2/2] common/vcpu: Switch v->vcpu_info_mfn to mfn_t
  2017-02-15 17:39 [PATCH 1/2] xen/sched.h Whitespace and bool cleanup Andrew Cooper
@ 2017-02-15 17:39 ` Andrew Cooper
  2017-02-16 10:24   ` Jan Beulich
  2017-02-17  8:47   ` Jan Beulich
  2017-02-16 10:23 ` [PATCH 1/2] xen/sched.h Whitespace and bool cleanup Jan Beulich
  1 sibling, 2 replies; 5+ messages in thread
From: Andrew Cooper @ 2017-02-15 17:39 UTC (permalink / raw)
  To: Xen-devel; +Cc: Andrew Cooper, Julien Grall, Stefano Stabellini, Jan Beulich

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Julien Grall <julien.grall@arm.com>
---
 xen/common/domain.c     | 15 ++++++---------
 xen/include/xen/sched.h |  2 +-
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 05130e2..5b069b9 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -117,7 +117,7 @@ static void vcpu_info_reset(struct vcpu *v)
     v->vcpu_info = ((v->vcpu_id < XEN_LEGACY_MAX_VCPUS)
                     ? (vcpu_info_t *)&shared_info(d, vcpu_info[v->vcpu_id])
                     : &dummy_vcpu_info);
-    v->vcpu_info_mfn = mfn_x(INVALID_MFN);
+    v->vcpu_info_mfn = INVALID_MFN;
 }
 
 struct vcpu *alloc_vcpu(
@@ -1150,7 +1150,7 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset)
     if ( offset > (PAGE_SIZE - sizeof(vcpu_info_t)) )
         return -EINVAL;
 
-    if ( v->vcpu_info_mfn != mfn_x(INVALID_MFN) )
+    if ( !mfn_eq(v->vcpu_info_mfn, INVALID_MFN) )
         return -EINVAL;
 
     /* Run this command on yourself or on other offline VCPUS. */
@@ -1189,7 +1189,7 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset)
     }
 
     v->vcpu_info = new_info;
-    v->vcpu_info_mfn = page_to_mfn(page);
+    v->vcpu_info_mfn = _mfn(page_to_mfn(page));
 
     /* Set new vcpu_info pointer /before/ setting pending flags. */
     smp_wmb();
@@ -1208,22 +1208,19 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset)
 
 /*
  * Unmap the vcpu info page if the guest decided to place it somewhere
- * else. This is used from arch_domain_destroy and domain_soft_reset.
+ * else. This is used from domain_kill() and domain_soft_reset().
  */
 void unmap_vcpu_info(struct vcpu *v)
 {
-    unsigned long mfn;
-
-    if ( v->vcpu_info_mfn == mfn_x(INVALID_MFN) )
+    if ( mfn_eq(v->vcpu_info_mfn, INVALID_MFN) )
         return;
 
-    mfn = v->vcpu_info_mfn;
     unmap_domain_page_global((void *)
                              ((unsigned long)v->vcpu_info & PAGE_MASK));
 
     vcpu_info_reset(v);
 
-    put_page_and_type(mfn_to_page(mfn));
+    put_page_and_type(mfn_to_page(mfn_x(v->vcpu_info_mfn)));
 }
 
 int default_initialise_vcpu(struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg)
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index def097e..32893de 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -252,7 +252,7 @@ struct vcpu
     struct waitqueue_vcpu *waitqueue_vcpu;
 
     /* Guest-specified relocation of vcpu_info. */
-    unsigned long vcpu_info_mfn;
+    mfn_t            vcpu_info_mfn;
 
     struct evtchn_fifo_vcpu *evtchn_fifo;
 
-- 
2.1.4


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

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

* Re: [PATCH 1/2] xen/sched.h Whitespace and bool cleanup
  2017-02-15 17:39 [PATCH 1/2] xen/sched.h Whitespace and bool cleanup Andrew Cooper
  2017-02-15 17:39 ` [PATCH 2/2] common/vcpu: Switch v->vcpu_info_mfn to mfn_t Andrew Cooper
@ 2017-02-16 10:23 ` Jan Beulich
  1 sibling, 0 replies; 5+ messages in thread
From: Jan Beulich @ 2017-02-16 10:23 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: JulienGrall, Stefano Stabellini, Xen-devel

>>> On 15.02.17 at 18:39, <andrew.cooper3@citrix.com> wrote:
> Extend the Maptrack comment to point at the Grant table subsystem.
> 
> No functional change.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

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



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

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

* Re: [PATCH 2/2] common/vcpu: Switch v->vcpu_info_mfn to mfn_t
  2017-02-15 17:39 ` [PATCH 2/2] common/vcpu: Switch v->vcpu_info_mfn to mfn_t Andrew Cooper
@ 2017-02-16 10:24   ` Jan Beulich
  2017-02-17  8:47   ` Jan Beulich
  1 sibling, 0 replies; 5+ messages in thread
From: Jan Beulich @ 2017-02-16 10:24 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: JulienGrall, Stefano Stabellini, Xen-devel

>>> On 15.02.17 at 18:39, <andrew.cooper3@citrix.com> wrote:
> No functional change.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

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



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

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

* Re: [PATCH 2/2] common/vcpu: Switch v->vcpu_info_mfn to mfn_t
  2017-02-15 17:39 ` [PATCH 2/2] common/vcpu: Switch v->vcpu_info_mfn to mfn_t Andrew Cooper
  2017-02-16 10:24   ` Jan Beulich
@ 2017-02-17  8:47   ` Jan Beulich
  1 sibling, 0 replies; 5+ messages in thread
From: Jan Beulich @ 2017-02-17  8:47 UTC (permalink / raw)
  To: Andrew Cooper; +Cc: JulienGrall, Stefano Stabellini, Xen-devel

>>> On 15.02.17 at 18:39, <andrew.cooper3@citrix.com> wrote:
> @@ -1208,22 +1208,19 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset)
>  
>  /*
>   * Unmap the vcpu info page if the guest decided to place it somewhere
> - * else. This is used from arch_domain_destroy and domain_soft_reset.
> + * else. This is used from domain_kill() and domain_soft_reset().
>   */
>  void unmap_vcpu_info(struct vcpu *v)
>  {
> -    unsigned long mfn;
> -
> -    if ( v->vcpu_info_mfn == mfn_x(INVALID_MFN) )
> +    if ( mfn_eq(v->vcpu_info_mfn, INVALID_MFN) )
>          return;
>  
> -    mfn = v->vcpu_info_mfn;
>      unmap_domain_page_global((void *)
>                               ((unsigned long)v->vcpu_info & PAGE_MASK));
>  
>      vcpu_info_reset(v);
>  
> -    put_page_and_type(mfn_to_page(mfn));
> +    put_page_and_type(mfn_to_page(mfn_x(v->vcpu_info_mfn)));
>  }

The elimination of the local variable here is wrong, as the failing smoke
tests show: vcpu_info_reset() sets v->vcpu_info_mfn to INVALID_MFN.

Jan


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

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

end of thread, other threads:[~2017-02-17  8:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-15 17:39 [PATCH 1/2] xen/sched.h Whitespace and bool cleanup Andrew Cooper
2017-02-15 17:39 ` [PATCH 2/2] common/vcpu: Switch v->vcpu_info_mfn to mfn_t Andrew Cooper
2017-02-16 10:24   ` Jan Beulich
2017-02-17  8:47   ` Jan Beulich
2017-02-16 10:23 ` [PATCH 1/2] xen/sched.h Whitespace and bool cleanup Jan Beulich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).