xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/EPT: adjust types in ept_split_super_page()
@ 2015-09-28 14:35 Jan Beulich
  2015-09-28 14:46 ` Andrew Cooper
  2015-09-29 10:40 ` George Dunlap
  0 siblings, 2 replies; 3+ messages in thread
From: Jan Beulich @ 2015-09-28 14:35 UTC (permalink / raw)
  To: xen-devel; +Cc: George Dunlap, Andrew Cooper, Kevin Tian, Jun Nakajima

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

The function returns a boolean and its current and target level inputs
are unsigned (which in turn allows simplifying the early-out check).
Also convert a non-standard loop variable to an ordinary function scope
one, at once making it unsigned too.

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

--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -266,16 +266,18 @@ static void ept_free_entry(struct p2m_do
     p2m_free_ptp(p2m, mfn_to_page(ept_entry->mfn));
 }
 
-static int ept_split_super_page(struct p2m_domain *p2m, ept_entry_t *ept_entry,
-                                int level, int target)
+static bool_t ept_split_super_page(struct p2m_domain *p2m,
+                                   ept_entry_t *ept_entry,
+                                   unsigned int level, unsigned int target)
 {
     ept_entry_t new_ept, *table;
     uint64_t trunk;
-    int rv = 1;
+    unsigned int i;
+    bool_t rv = 1;
 
     /* End if the entry is a leaf entry or reaches the target level. */
-    if ( level == 0 || level == target )
-        return rv;
+    if ( level <= target )
+        return 1;
 
     ASSERT(is_epte_superpage(ept_entry));
 
@@ -285,7 +287,7 @@ static int ept_split_super_page(struct p
     table = map_domain_page(_mfn(new_ept.mfn));
     trunk = 1UL << ((level - 1) * EPT_TABLE_ORDER);
 
-    for ( int i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
+    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
     {
         ept_entry_t *epte = table + i;
 




[-- Attachment #2: x86-p2m-ept-split-sp-types.patch --]
[-- Type: text/plain, Size: 1577 bytes --]

x86/EPT: adjust types in ept_split_super_page()

The function returns a boolean and its current and target level inputs
are unsigned (which in turn allows simplifying the early-out check).
Also convert a non-standard loop variable to an ordinary function scope
one, at once making it unsigned too.

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

--- a/xen/arch/x86/mm/p2m-ept.c
+++ b/xen/arch/x86/mm/p2m-ept.c
@@ -266,16 +266,18 @@ static void ept_free_entry(struct p2m_do
     p2m_free_ptp(p2m, mfn_to_page(ept_entry->mfn));
 }
 
-static int ept_split_super_page(struct p2m_domain *p2m, ept_entry_t *ept_entry,
-                                int level, int target)
+static bool_t ept_split_super_page(struct p2m_domain *p2m,
+                                   ept_entry_t *ept_entry,
+                                   unsigned int level, unsigned int target)
 {
     ept_entry_t new_ept, *table;
     uint64_t trunk;
-    int rv = 1;
+    unsigned int i;
+    bool_t rv = 1;
 
     /* End if the entry is a leaf entry or reaches the target level. */
-    if ( level == 0 || level == target )
-        return rv;
+    if ( level <= target )
+        return 1;
 
     ASSERT(is_epte_superpage(ept_entry));
 
@@ -285,7 +287,7 @@ static int ept_split_super_page(struct p
     table = map_domain_page(_mfn(new_ept.mfn));
     trunk = 1UL << ((level - 1) * EPT_TABLE_ORDER);
 
-    for ( int i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
+    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
     {
         ept_entry_t *epte = table + i;
 

[-- 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] 3+ messages in thread

* Re: [PATCH] x86/EPT: adjust types in ept_split_super_page()
  2015-09-28 14:35 [PATCH] x86/EPT: adjust types in ept_split_super_page() Jan Beulich
@ 2015-09-28 14:46 ` Andrew Cooper
  2015-09-29 10:40 ` George Dunlap
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Cooper @ 2015-09-28 14:46 UTC (permalink / raw)
  To: Jan Beulich, xen-devel; +Cc: George Dunlap, Kevin Tian, Jun Nakajima

On 28/09/15 15:35, Jan Beulich wrote:
> The function returns a boolean and its current and target level inputs
> are unsigned (which in turn allows simplifying the early-out check).
> Also convert a non-standard loop variable to an ordinary function scope
> one, at once making it unsigned too.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

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

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

* Re: [PATCH] x86/EPT: adjust types in ept_split_super_page()
  2015-09-28 14:35 [PATCH] x86/EPT: adjust types in ept_split_super_page() Jan Beulich
  2015-09-28 14:46 ` Andrew Cooper
@ 2015-09-29 10:40 ` George Dunlap
  1 sibling, 0 replies; 3+ messages in thread
From: George Dunlap @ 2015-09-29 10:40 UTC (permalink / raw)
  To: Jan Beulich, xen-devel
  Cc: George Dunlap, Andrew Cooper, Kevin Tian, Jun Nakajima

On 28/09/15 15:35, Jan Beulich wrote:
> The function returns a boolean and its current and target level inputs
> are unsigned (which in turn allows simplifying the early-out check).
> Also convert a non-standard loop variable to an ordinary function scope
> one, at once making it unsigned too.
> 
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: George Dunlap <george.dunlap@citrix.com>

> 
> --- a/xen/arch/x86/mm/p2m-ept.c
> +++ b/xen/arch/x86/mm/p2m-ept.c
> @@ -266,16 +266,18 @@ static void ept_free_entry(struct p2m_do
>      p2m_free_ptp(p2m, mfn_to_page(ept_entry->mfn));
>  }
>  
> -static int ept_split_super_page(struct p2m_domain *p2m, ept_entry_t *ept_entry,
> -                                int level, int target)
> +static bool_t ept_split_super_page(struct p2m_domain *p2m,
> +                                   ept_entry_t *ept_entry,
> +                                   unsigned int level, unsigned int target)
>  {
>      ept_entry_t new_ept, *table;
>      uint64_t trunk;
> -    int rv = 1;
> +    unsigned int i;
> +    bool_t rv = 1;
>  
>      /* End if the entry is a leaf entry or reaches the target level. */
> -    if ( level == 0 || level == target )
> -        return rv;
> +    if ( level <= target )
> +        return 1;
>  
>      ASSERT(is_epte_superpage(ept_entry));
>  
> @@ -285,7 +287,7 @@ static int ept_split_super_page(struct p
>      table = map_domain_page(_mfn(new_ept.mfn));
>      trunk = 1UL << ((level - 1) * EPT_TABLE_ORDER);
>  
> -    for ( int i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
> +    for ( i = 0; i < EPT_PAGETABLE_ENTRIES; i++ )
>      {
>          ept_entry_t *epte = table + i;
>  
> 
> 
> 

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

end of thread, other threads:[~2015-09-29 10:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-28 14:35 [PATCH] x86/EPT: adjust types in ept_split_super_page() Jan Beulich
2015-09-28 14:46 ` Andrew Cooper
2015-09-29 10:40 ` George Dunlap

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).