Skip to contentSkip to conversation

gnttab: don't use domain lock for serialization

DISCUSSION tupeng212 2 participants 2 messages Oct 16, 2012

lore
Share & tools
lore

tupeng212

author
#0 lore raw

xen/common/grant_table.c
174 static inline void
175 double_gt_lock(struct grant_table *lgt, struct grant_table *rgt) 176 {
177 if ( lgt < rgt )
178 {
179 spin_lock(&lgt->lock);
180 spin_lock(&rgt->lock);
181 }
182 else
183 {
184 if ( lgt != rgt )
185 spin_lock(&rgt->lock);
186 spin_lock(&lgt->lock); //here if the same, we just lock once. 187 }
188 }

I have a question, when lgt == rgt ?
remote domain's grant_table is created by itself, so how they get the same? Thanks a lot!

tupeng212

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#1 lore raw
Quoted 18 lines
Quoted 1 line
Quoted 1 line · On 16.10.12 at 16:38, tupeng212 <[email protected]> wrote:

xen/common/grant_table.c
174 static inline void
175 double_gt_lock(struct grant_table *lgt, struct grant_table *rgt) 176 {
177 if ( lgt < rgt )
178 {
179 spin_lock(&lgt->lock);
180 spin_lock(&rgt->lock);
181 }
182 else
183 {
184 if ( lgt != rgt )
185 spin_lock(&rgt->lock);
186 spin_lock(&lgt->lock); //here if the same, we just lock once. 187 }
188 }

Quoted 2 lines

I have a question, when lgt == rgt ?
remote domain's grant_table is created by itself, so how they get the same?

If backend and frontend are in the same domain (e.g. vbd attached locally to Dom0), both domains (and hence both grant tables) involved are the same.

Jan