Skip to contentSkip to conversation

xen/gnttab: reduce size of struct active_grant_entry

RFC PATCH Superseded Juergen Gross 3 participants 14 messages Sep 12, 2022

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover xen/gnttab: reduce size of struct active_grant_entry

While looking at the grant table code I thought it should be possible to have a smaller struct active_grant_entry. This approach should only hit transitive grants with some negative performance effect, "normal" grants should be not affected.

I'm not sure that the domid_to_domain() helper is something we really want, though, so I'm sending out the series as RFC.

Juergen Gross (2):
xen: add domid_to_domain() helper xen/gnttab: reduce size of struct active_grant_entry

 xen/common/domain.c      | 54 +++++++++++++++++++++++++---------------
 xen/common/grant_table.c | 13 +++++-----
 xen/include/xen/sched.h  |  4 +++
 3 files changed, 45 insertions(+), 26 deletions(-)
Signature · 1 line
2.35.3
#1 lore raw

PATCH 1/2 xen: add domid_to_domain() helper

Add a helper domid_to_domain() returning the struct domain pointer for a domain give by its domid and which is known not being able to be released (its reference count isn't incremented and no rcu_lock_domain() is called for it).

In order to simplify coding add an internal helper for doing the lookup and call that from the new function and similar functions.

---
 xen/common/domain.c     | 54 ++++++++++++++++++++++++++---------------
 xen/include/xen/sched.h |  4 +++
 2 files changed, 38 insertions(+), 20 deletions(-)
xen/common/domain.c +34 -20
index c23f449451..2b1866ea42 100644
@@ -832,25 +832,32 @@ out:
     return 0;
 }
 
-
-struct domain *get_domain_by_id(domid_t dom)
+/* rcu_read_lock(&domlist_read_lock) must be held. */
+static struct domain *domid_2_domain(domid_t dom)
 {
     struct domain *d;
 
-    rcu_read_lock(&domlist_read_lock);
-
     for ( d = rcu_dereference(domain_hash[DOMAIN_HASH(dom)]);
           d != NULL;
           d = rcu_dereference(d->next_in_hashbucket) )
     {
         if ( d->domain_id == dom )
-        {
-            if ( unlikely(!get_domain(d)) )
-                d = NULL;
-            break;
-        }
+            return d;
     }
 
+    return NULL;
+}
+
+struct domain *get_domain_by_id(domid_t dom)
+{
+    struct domain *d;
+
+    rcu_read_lock(&domlist_read_lock);
+
+    d = domid_2_domain(dom);
+    if ( d && unlikely(!get_domain(d)) )
+        d = NULL;
+
     rcu_read_unlock(&domlist_read_lock);
 
     return d;
@@ -859,20 +866,27 @@ struct domain *get_domain_by_id(domid_t dom)
 
 struct domain *rcu_lock_domain_by_id(domid_t dom)
 {
-    struct domain *d = NULL;
+    struct domain *d;
 
     rcu_read_lock(&domlist_read_lock);
 
-    for ( d = rcu_dereference(domain_hash[DOMAIN_HASH(dom)]);
-          d != NULL;
-          d = rcu_dereference(d->next_in_hashbucket) )
-    {
-        if ( d->domain_id == dom )
-        {
-            rcu_lock_domain(d);
-            break;
-        }
-    }
+    d = domid_2_domain(dom);
+    if ( d )
+        rcu_lock_domain(d);
+
+    rcu_read_unlock(&domlist_read_lock);
+
+    return d;
+}
+
+/* Use only if struct domain is known to stay allocated! */
+struct domain *domid_to_domain(domid_t dom)
+{
+    struct domain *d;
+
+    rcu_read_lock(&domlist_read_lock);
+
+    d = domid_2_domain(dom);
 
     rcu_read_unlock(&domlist_read_lock);
 
xen/include/xen/sched.h +4 -0
index 557b3229f6..f4c4d3a60f 100644
@@ -737,8 +737,12 @@ static inline struct domain *rcu_lock_current_domain(void)
     return /*rcu_lock_domain*/(current->domain);
 }
 
+/* Get struct domain AND increase ref-count of domain. */
 struct domain *get_domain_by_id(domid_t dom);
 
+/* Get struct domain known to stay allocated. */
+struct domain *domid_to_domain(domid_t dom);
+
 struct domain *get_pg_owner(domid_t domid);
 
 static inline void put_pg_owner(struct domain *pg_owner)
Signature · 1 line
2.35.3
#2 lore raw

Re: [PATCH 1/2] xen: add domid_to_domain() helper

Quoted 9 lines · Juergen Gross

Add a helper domid_to_domain() returning the struct domain pointer for a domain give by its domid and which is known not being able to be released (its reference count isn't incremented and no rcu_lock_domain() is called for it).

In order to simplify coding add an internal helper for doing the lookup and call that from the new function and similar functions.

I don't see an issue with adding such a helper (responding to your concern in the cover letter), but I think the constraints need to be empahsized
more: We already have get_knownalive_domain() and get_domain_by_id(), so how about naming the new helper get_knownalive_domain_by_id()? And then ...

Quoted 28 lines
xen/common/domain.c +10 -11
@@ -859,20 +866,27 @@ struct domain *get_domain_by_id(domid_t dom)
 
 struct domain *rcu_lock_domain_by_id(domid_t dom)
 {
-    struct domain *d = NULL;
+    struct domain *d;
 
     rcu_read_lock(&domlist_read_lock);
 
-    for ( d = rcu_dereference(domain_hash[DOMAIN_HASH(dom)]);
-          d != NULL;
-          d = rcu_dereference(d->next_in_hashbucket) )
-    {
-        if ( d->domain_id == dom )
-        {
-            rcu_lock_domain(d);
-            break;
-        }
-    }
+    d = domid_2_domain(dom);
+    if ( d )
+        rcu_lock_domain(d);
+
+    rcu_read_unlock(&domlist_read_lock);
+
+    return d;
+}
+

xen/common/domain.c struct domain *get_domain_by_id(domid_t dom) · line 891

Quoted 10 lines
xen/common/domain.c +8 -0
+/* Use only if struct domain is known to stay allocated! */
+struct domain *domid_to_domain(domid_t dom)
+{
+    struct domain *d;
+
+    rcu_read_lock(&domlist_read_lock);
+
+    d = domid_2_domain(dom);
 
     rcu_read_unlock(&domlist_read_lock);

... extend the comment here and in the header (or perhaps one in the header would suffice and the definition here doesn't need any further comment) to explicitly say "reference held or RCU-locked".

Jan

#3 lore raw

Re: [PATCH 1/2] xen: add domid_to_domain() helper

Quoted 9 lines · Jan Beulich
Quoted 8 lines · Juergen Gross

Add a helper domid_to_domain() returning the struct domain pointer for a domain give by its domid and which is known not being able to be released (its reference count isn't incremented and no rcu_lock_domain() is called for it).

In order to simplify coding add an internal helper for doing the lookup and call that from the new function and similar functions.

Quoted 6 lines
Quoted 1 line

I don't see an issue with adding such a helper (responding to your concern in the cover letter), but I think the constraints need to be empahsized
more: We already have get_knownalive_domain() and get_domain_by_id(), so how about naming the new helper get_knownalive_domain_by_id()? And then ...

I explicitly didn't name it "get_...", as those helpers all increment the reference count of the domain. And this is NOT done by the new helper.

Quoted 38 lines
Quoted 38 lines
xen/common/domain.c +18 -11
@@ -859,20 +866,27 @@ struct domain *get_domain_by_id(domid_t dom)
 
  struct domain *rcu_lock_domain_by_id(domid_t dom)
  {
-    struct domain *d = NULL;
+    struct domain *d;
 
      rcu_read_lock(&domlist_read_lock);
 
-    for ( d = rcu_dereference(domain_hash[DOMAIN_HASH(dom)]);
-          d != NULL;
-          d = rcu_dereference(d->next_in_hashbucket) )
-    {
-        if ( d->domain_id == dom )
-        {
-            rcu_lock_domain(d);
-            break;
-        }
-    }
+    d = domid_2_domain(dom);
+    if ( d )
+        rcu_lock_domain(d);
+
+    rcu_read_unlock(&domlist_read_lock);
+
+    return d;
+}
+
+/* Use only if struct domain is known to stay allocated! */
+struct domain *domid_to_domain(domid_t dom)
+{
+    struct domain *d;
+
+    rcu_read_lock(&domlist_read_lock);
+
+    d = domid_2_domain(dom);
 
Quoted 5 lines

Review struct domain *get_domain_by_id(domid_t dom) · line 891

Quoted 1 line
(quoted diff) +0 -0
      rcu_read_unlock(&domlist_read_lock);

... extend the comment here and in the header (or perhaps one in the header would suffice and the definition here doesn't need any further comment) to explicitly say "reference held or RCU-locked".

Yes, good idea.

Juergen

#4 lore raw

Re: [PATCH 1/2] xen: add domid_to_domain() helper

Quoted 12 lines · Juergen Gross
Quoted 11 lines · Jan Beulich
Quoted 9 lines · Juergen Gross

Add a helper domid_to_domain() returning the struct domain pointer for a domain give by its domid and which is known not being able to be released (its reference count isn't incremented and no rcu_lock_domain() is called for it).

In order to simplify coding add an internal helper for doing the lookup and call that from the new function and similar functions.

Quoted 7 lines
Quoted 4 lines

I don't see an issue with adding such a helper (responding to your concern in the cover letter), but I think the constraints need to be empahsized
more: We already have get_knownalive_domain() and get_domain_by_id(), so how about naming the new helper get_knownalive_domain_by_id()? And then ...

I explicitly didn't name it "get_...", as those helpers all increment the reference count of the domain. And this is NOT done by the new helper.

Hmm, agreed. But domid_to_domain() isn't expressing the "known alive" aspect, yet that's relevant to see when reviewing new uses of the function. Such uses aren't likely to make the reviewer go look at the function declaration when the function name is pretty "innocent".

Jan

#5 lore raw

Re: [PATCH 1/2] xen: add domid_to_domain() helper

Quoted 18 lines · Jan Beulich
Quoted 17 lines · Juergen Gross
Quoted 15 lines · Jan Beulich
Quoted 9 lines · Juergen Gross

Add a helper domid_to_domain() returning the struct domain pointer for a domain give by its domid and which is known not being able to be released (its reference count isn't incremented and no rcu_lock_domain() is called for it).

In order to simplify coding add an internal helper for doing the lookup and call that from the new function and similar functions.

I don't see an issue with adding such a helper (responding to your concern in the cover letter), but I think the constraints need to be empahsized
more: We already have get_knownalive_domain() and get_domain_by_id(), so how about naming the new helper get_knownalive_domain_by_id()? And then ...

Quoted 7 lines
Quoted 2 lines

I explicitly didn't name it "get_...", as those helpers all increment the reference count of the domain. And this is NOT done by the new helper.

Hmm, agreed. But domid_to_domain() isn't expressing the "known alive" aspect, yet that's relevant to see when reviewing new uses of the function. Such uses aren't likely to make the reviewer go look at the function declaration when the function name is pretty "innocent".

Okay, what about domid_to_knownalive_domain()?

Or knownalive_domain_from_domid()?

Juergen

#6 lore raw

Re: [PATCH 1/2] xen: add domid_to_domain() helper

Quoted 22 lines · Juergen Gross
Quoted 21 lines · Jan Beulich
Quoted 19 lines · Juergen Gross
Quoted 9 lines · Jan Beulich
Quoted 8 lines · Juergen Gross

Add a helper domid_to_domain() returning the struct domain pointer for a domain give by its domid and which is known not being able to be released (its reference count isn't incremented and no rcu_lock_domain() is called for it).

In order to simplify coding add an internal helper for doing the lookup and call that from the new function and similar functions.

Quoted 6 lines
Quoted 1 line

I don't see an issue with adding such a helper (responding to your concern in the cover letter), but I think the constraints need to be empahsized
more: We already have get_knownalive_domain() and get_domain_by_id(), so how about naming the new helper get_knownalive_domain_by_id()? And then ...

I explicitly didn't name it "get_...", as those helpers all increment the reference count of the domain. And this is NOT done by the new helper.

Quoted 8 lines
Quoted 4 lines

Hmm, agreed. But domid_to_domain() isn't expressing the "known alive" aspect, yet that's relevant to see when reviewing new uses of the function. Such uses aren't likely to make the reviewer go look at the function declaration when the function name is pretty "innocent".

Okay, what about domid_to_knownalive_domain()?

Or knownalive_domain_from_domid()?

Either would be fine with me.

Jan

#7 lore raw

Re: [PATCH 1/2] xen: add domid_to_domain() helper

In reply to Juergen Gross

Hi Juergen,

Quoted 22 lines · Juergen Gross
Quoted 21 lines · Jan Beulich
Quoted 19 lines · Juergen Gross
Quoted 9 lines · Jan Beulich
Quoted 8 lines · Juergen Gross

Add a helper domid_to_domain() returning the struct domain pointer for a domain give by its domid and which is known not being able to be released (its reference count isn't incremented and no rcu_lock_domain() is called for it).

In order to simplify coding add an internal helper for doing the lookup and call that from the new function and similar functions.

Quoted 6 lines
Quoted 1 line

I don't see an issue with adding such a helper (responding to your concern in the cover letter), but I think the constraints need to be empahsized
more: We already have get_knownalive_domain() and get_domain_by_id(), so how about naming the new helper get_knownalive_domain_by_id()? And then ...

I explicitly didn't name it "get_...", as those helpers all increment the reference count of the domain. And this is NOT done by the new helper.

Quoted 8 lines
Quoted 4 lines

Hmm, agreed. But domid_to_domain() isn't expressing the "known alive" aspect, yet that's relevant to see when reviewing new uses of the function. Such uses aren't likely to make the reviewer go look at the function declaration when the function name is pretty "innocent".

Okay, what about domid_to_knownalive_domain()?

Or knownalive_domain_from_domid()?

FWIW, I am fine with either. However, please don't replace 'to' with '2' if you need a internal helper. Just suffixed with 'locked' to make clear this is a version where the caller should take the lock.

Cheers,

Signature · 1 line
Julien Grall
#8 lore raw

Re: [PATCH 1/2] xen: add domid_to_domain() helper

Quoted 37 lines · Julien Grall
Quoted 36 lines · Juergen Gross
Quoted 34 lines · Jan Beulich
Quoted 22 lines · Juergen Gross
Quoted 13 lines · Jan Beulich
Quoted 11 lines · Juergen Gross

Add a helper domid_to_domain() returning the struct domain pointer for a domain give by its domid and which is known not being able to be released (its reference count isn't incremented and no rcu_lock_domain()
is called for it).

In order to simplify coding add an internal helper for doing the lookup
and call that from the new function and similar functions.

Quoted 7 lines

I don't see an issue with adding such a helper (responding to your concern
in the cover letter), but I think the constraints need to be empahsized
more: We already have get_knownalive_domain() and get_domain_by_id(), so
how about naming the new helper get_knownalive_domain_by_id()? And then ...

Quoted 3 lines

I explicitly didn't name it "get_...", as those helpers all increment the
reference count of the domain. And this is NOT done by the new helper.

Hmm, agreed. But domid_to_domain() isn't expressing the "known alive" aspect,
yet that's relevant to see when reviewing new uses of the function. Such uses
aren't likely to make the reviewer go look at the function declaration when
the function name is pretty "innocent".

Quoted 7 lines
Quoted 3 lines

Okay, what about domid_to_knownalive_domain()?

Or knownalive_domain_from_domid()?

FWIW, I am fine with either. However, please don't replace 'to' with '2' if you need a internal helper. Just suffixed with 'locked' to make clear this is a version where the caller should take the lock.

Hmm - personally I dislike "_locked" suffixes on functions. If the "internal helper" aspect is to be made more explicit, then perhaps by way of prefixing a single underscore?

Jan

#9 lore raw

Re: [PATCH 1/2] xen: add domid_to_domain() helper

Quoted 42 lines · Jan Beulich
Quoted 41 lines · Julien Grall
Quoted 39 lines · Juergen Gross
Quoted 27 lines · Jan Beulich
Quoted 22 lines · Juergen Gross
Quoted 13 lines · Jan Beulich
Quoted 11 lines · Juergen Gross

Add a helper domid_to_domain() returning the struct domain pointer for a domain give by its domid and which is known not being able to be released (its reference count isn't incremented and no rcu_lock_domain()
is called for it).

In order to simplify coding add an internal helper for doing the lookup
and call that from the new function and similar functions.

Quoted 7 lines

I don't see an issue with adding such a helper (responding to your concern
in the cover letter), but I think the constraints need to be empahsized
more: We already have get_knownalive_domain() and get_domain_by_id(), so
how about naming the new helper get_knownalive_domain_by_id()? And then ...

Quoted 3 lines

I explicitly didn't name it "get_...", as those helpers all increment the
reference count of the domain. And this is NOT done by the new helper.

Quoted 7 lines

Hmm, agreed. But domid_to_domain() isn't expressing the "known alive" aspect,
yet that's relevant to see when reviewing new uses of the function. Such uses
aren't likely to make the reviewer go look at the function declaration when
the function name is pretty "innocent".

Okay, what about domid_to_knownalive_domain()?

Or knownalive_domain_from_domid()?

Quoted 7 lines
Quoted 3 lines

FWIW, I am fine with either. However, please don't replace 'to' with '2' if you need a internal helper. Just suffixed with 'locked' to make clear this is a version where the caller should take the lock.

Hmm - personally I dislike "_locked" suffixes on functions. If the "internal helper" aspect is to be made more explicit, then perhaps by way of prefixing a single underscore?

I am OK with that. Although, from previous discussion, I would have expected that explicit name would have been your preference ("locked" is more explicit than "_").

Cheers,

Signature · 1 line
Julien Grall
#10 lore raw

Re: [PATCH 1/2] xen: add domid_to_domain() helper

In reply to Julien Grall
Quoted 30 lines · Julien Grall

Hi Juergen,

Quoted 27 lines · Juergen Gross
Quoted 25 lines · Jan Beulich
Quoted 12 lines · Juergen Gross
Quoted 11 lines · Jan Beulich
Quoted 9 lines · Juergen Gross

Add a helper domid_to_domain() returning the struct domain pointer for a domain give by its domid and which is known not being able to be released (its reference count isn't incremented and no rcu_lock_domain() is called for it).

In order to simplify coding add an internal helper for doing the lookup and call that from the new function and similar functions.

Quoted 7 lines
Quoted 4 lines

I don't see an issue with adding such a helper (responding to your concern in the cover letter), but I think the constraints need to be empahsized
more: We already have get_knownalive_domain() and get_domain_by_id(), so how about naming the new helper get_knownalive_domain_by_id()? And then ...

I explicitly didn't name it "get_...", as those helpers all increment the reference count of the domain. And this is NOT done by the new helper.

Hmm, agreed. But domid_to_domain() isn't expressing the "known alive" aspect, yet that's relevant to see when reviewing new uses of the function. Such uses aren't likely to make the reviewer go look at the function declaration when the function name is pretty "innocent".

Quoted 5 lines
Quoted 3 lines

Okay, what about domid_to_knownalive_domain()?

Or knownalive_domain_from_domid()?

FWIW, I am fine with either. However, please don't replace 'to' with '2' if you need a internal helper. Just suffixed with 'locked' to make clear this is a version where the caller should take the lock.

I can just rename it to "domid_to_domain()", now that the official helper will get another name.

Juergen

#11 lore raw

PATCH 2/2 xen/gnttab: reduce size of struct active_grant_entry

In reply to Juergen Gross

The size of struct active_grant_entry for 64-bit builds is 40 or 48 bytes today (with or without NDEBUG).

It can easily be reduced by 8 bytes by replacing the trans_domain pointer with the domid of the related domain. trans_domain is only ever used for transitive grants, which last known user has been the old Xenolinux branch of the Linux kernel.

This reduction will result in less memory usage and (for production builds) in faster code, as indexing into the active_grant_entry array will be much easier with an entry having a power-of-2 size.

The performance loss when using transitive grants shouldn't really matter, given the probability that those aren't in use at all today.

---
 xen/common/grant_table.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
xen/common/grant_table.c +7 -6
index fba329dcc2..8e4bbe3824 100644
@@ -381,13 +381,13 @@ struct active_grant_entry {
 })
 
     domid_t       domid;  /* Domain being granted access.             */
+    domid_t       trans_domid; /* Domain granting access.             */
     unsigned int  start:15; /* For sub-page grants, the start offset
                                in the page.                           */
     bool          is_sub_page:1; /* True if this is a sub-page grant. */
     unsigned int  length:16; /* For sub-page grants, the length of the
                                 grant.                                */
     grant_ref_t   trans_gref;
-    struct domain *trans_domain;
     mfn_t         mfn;    /* Machine frame being granted.             */
 #ifndef NDEBUG
     gfn_t         gfn;    /* Guest's idea of the frame being granted. */
@@ -1095,7 +1095,7 @@ map_grant_ref(
             act->start = 0;
             act->length = PAGE_SIZE;
             act->is_sub_page = false;
-            act->trans_domain = rd;
+            act->trans_domid = rd->domain_id;
             act->trans_gref = ref;
         }
     }
@@ -2494,7 +2494,8 @@ release_grant_for_copy(
     else
     {
         status = &status_entry(rgt, gref);
-        td = act->trans_domain;
+        td = (act->trans_domid == rd->domain_id)
+             ? rd : domid_to_domain(act->trans_domid);
         trans_gref = act->trans_gref;
     }
 
@@ -2657,7 +2658,7 @@ acquire_grant_for_copy(
                           !mfn_eq(act->mfn, grant_mfn) ||
                           act->start != trans_page_off ||
                           act->length != trans_length ||
-                          act->trans_domain != td ||
+                          act->trans_domid != td->domain_id ||
                           act->trans_gref != trans_gref ||
                           !act->is_sub_page)) )
         {
@@ -2676,7 +2677,7 @@ acquire_grant_for_copy(
             act->domid = ldom;
             act->start = trans_page_off;
             act->length = trans_length;
-            act->trans_domain = td;
+            act->trans_domid = td->domain_id;
             act->trans_gref = trans_gref;
             act->mfn = grant_mfn;
             act_set_gfn(act, INVALID_GFN);
@@ -2738,7 +2739,7 @@ acquire_grant_for_copy(
             act->is_sub_page = is_sub_page;
             act->start = trans_page_off;
             act->length = trans_length;
-            act->trans_domain = td;
+            act->trans_domid = td->domain_id;
             act->trans_gref = trans_gref;
             act->mfn = grant_mfn;
         }
Signature · 1 line
2.35.3
#12 lore raw
Quoted 2 lines · Juergen Gross

The size of struct active_grant_entry for 64-bit builds is 40 or 48 bytes today (with or without NDEBUG).

... and leaving aside DEBUG_LOCKS / DEBUG_LOCK_PROFILE.

Quoted 4 lines

It can easily be reduced by 8 bytes by replacing the trans_domain pointer with the domid of the related domain. trans_domain is only ever used for transitive grants, which last known user has been the old Xenolinux branch of the Linux kernel.

That tree used grant transfers, but I'm unaware of (actual) uses of transitive grants; there may have been code there to allow their use, but iirc that would then not have had any users. Or am I mis-remembering?

xen/common/grant_table.c struct active_grant_entry { · line 384

Quoted 7 lines
xen/common/grant_table.c +1 -0
@@ -381,13 +381,13 @@ struct active_grant_entry {
 })
 
     domid_t       domid;  /* Domain being granted access.             */
+    domid_t       trans_domid; /* Domain granting access.             */

I'm afraid I consider the comment misleading and not in line with field name. For normal grants this is merely the "source" domain (i.e. "granting" in the comment is correct, but "trans" in the name isn't), while for transitive grants there are two domains granting access. Therefore may I suggest to use src_domid or orig_domid, or otherwise omit the comment (just like there was none originally)?

Jan

#13 lore raw
Quoted 5 lines · Jan Beulich
Quoted 2 lines · Juergen Gross

The size of struct active_grant_entry for 64-bit builds is 40 or 48 bytes today (with or without NDEBUG).

... and leaving aside DEBUG_LOCKS / DEBUG_LOCK_PROFILE.

Only leaving aside DEBUG_LOCK_PROFILE. DEBUG_LOCKS doesn't matter regarding struct active_grant_entry size.

Quoted 10 lines
Quoted 5 lines

It can easily be reduced by 8 bytes by replacing the trans_domain pointer with the domid of the related domain. trans_domain is only ever used for transitive grants, which last known user has been the old Xenolinux branch of the Linux kernel.

That tree used grant transfers, but I'm unaware of (actual) uses of transitive grants; there may have been code there to allow their use, but iirc that would then not have had any users. Or am I mis-remembering?

Oh, maybe I mixed those two cases up.

Quoted 5 lines
Quoted 5 lines
xen/common/grant_table.c +0 -0
@@ -381,13 +381,13 @@ struct active_grant_entry {
  })
 
Quoted 10 lines

xen/common/grant_table.c struct active_grant_entry { · line 384

Quoted 2 lines
xen/common/grant_table.c +1 -0
      domid_t       domid;  /* Domain being granted access.             */
+    domid_t       trans_domid; /* Domain granting access.             */

I'm afraid I consider the comment misleading and not in line with field name. For normal grants this is merely the "source" domain (i.e. "granting" in the comment is correct, but "trans" in the name isn't), while for transitive grants there are two domains granting access. Therefore may I suggest to use src_domid or orig_domid, or otherwise omit the comment (just like there was none originally)?

I'd prefer the rename to src_domid (orig_domid sounds for me like an old value of domid).

Juergen