Re: [Xen-devel] [PATCH v3 1/4] x86/mem_sharing: reorder when pages are unlocked and released

2019-04-29 Thread Tamas K Lengyel
On Mon, Apr 29, 2019 at 10:29 AM George Dunlap wrote: > > On 4/29/19 5:26 PM, Tamas K Lengyel wrote: > > On Mon, Apr 29, 2019 at 10:14 AM Jan Beulich wrote: > >> > > On 29.04.19 at 18:05, wrote: > >>> On Mon, Apr 29, 2019 at 9:52 AM George Dunlap > >>> wrote: > I haven't re-grokked

Re: [Xen-devel] [PATCH v3 1/4] x86/mem_sharing: reorder when pages are unlocked and released

2019-04-29 Thread George Dunlap
On 4/29/19 5:26 PM, Tamas K Lengyel wrote: > On Mon, Apr 29, 2019 at 10:14 AM Jan Beulich wrote: >> > On 29.04.19 at 18:05, wrote: >>> On Mon, Apr 29, 2019 at 9:52 AM George Dunlap >>> wrote: I haven't re-grokked the code here, but assuming I was correct 2 weeks ago, if you have

Re: [Xen-devel] [PATCH v3 1/4] x86/mem_sharing: reorder when pages are unlocked and released

2019-04-29 Thread Tamas K Lengyel
On Mon, Apr 29, 2019 at 10:14 AM Jan Beulich wrote: > > >>> On 29.04.19 at 18:05, wrote: > > On Mon, Apr 29, 2019 at 9:52 AM George Dunlap > > wrote: > >> I haven't re-grokked the code here, but assuming I was correct 2 weeks > >> ago, if you have the BUG_ON() there, you can get rid of the

Re: [Xen-devel] [PATCH v3 1/4] x86/mem_sharing: reorder when pages are unlocked and released

2019-04-29 Thread George Dunlap
On 4/29/19 5:14 PM, Jan Beulich wrote: On 29.04.19 at 18:05, wrote: >> On Mon, Apr 29, 2019 at 9:52 AM George Dunlap >> wrote: >>> I haven't re-grokked the code here, but assuming I was correct 2 weeks >>> ago, if you have the BUG_ON() there, you can get rid of the extra >>> references. >>

Re: [Xen-devel] [PATCH v3 1/4] x86/mem_sharing: reorder when pages are unlocked and released

2019-04-29 Thread Jan Beulich
>>> On 29.04.19 at 18:05, wrote: > On Mon, Apr 29, 2019 at 9:52 AM George Dunlap > wrote: >> I haven't re-grokked the code here, but assuming I was correct 2 weeks >> ago, if you have the BUG_ON() there, you can get rid of the extra >> references. > > Sure, but again, the overhead of having

Re: [Xen-devel] [PATCH v3 1/4] x86/mem_sharing: reorder when pages are unlocked and released

2019-04-29 Thread Tamas K Lengyel
On Mon, Apr 29, 2019 at 9:52 AM George Dunlap wrote: > > On 4/29/19 4:41 PM, Tamas K Lengyel wrote: > > On Mon, Apr 29, 2019 at 9:01 AM Jan Beulich wrote: > >> > > On 26.04.19 at 19:21, wrote: > >>> @@ -999,6 +996,10 @@ static int share_pages(struct domain *sd, gfn_t > >>> sgfn,

Re: [Xen-devel] [PATCH v3 1/4] x86/mem_sharing: reorder when pages are unlocked and released

2019-04-29 Thread Tamas K Lengyel
On Mon, Apr 29, 2019 at 9:44 AM George Dunlap wrote: > > On 4/26/19 6:21 PM, Tamas K Lengyel wrote: > > Calling _put_page_type while also holding the page_lock > > for that page can cause a deadlock. > > I can't immediately see what the mem_sharing_page_[un]lock() functions > are meant to be

Re: [Xen-devel] [PATCH v3 1/4] x86/mem_sharing: reorder when pages are unlocked and released

2019-04-29 Thread George Dunlap
On 4/29/19 4:41 PM, Tamas K Lengyel wrote: > On Mon, Apr 29, 2019 at 9:01 AM Jan Beulich wrote: >> > On 26.04.19 at 19:21, wrote: >>> @@ -999,6 +996,10 @@ static int share_pages(struct domain *sd, gfn_t sgfn, >>> shr_handle_t sh, >>> mem_sharing_page_unlock(secondpg); >>>

Re: [Xen-devel] [PATCH v3 1/4] x86/mem_sharing: reorder when pages are unlocked and released

2019-04-29 Thread George Dunlap
On 4/26/19 6:21 PM, Tamas K Lengyel wrote: > Calling _put_page_type while also holding the page_lock > for that page can cause a deadlock. I can't immediately see what the mem_sharing_page_[un]lock() functions are meant to be protecting against. Is there a comment anywhere describing what

Re: [Xen-devel] [PATCH v3 1/4] x86/mem_sharing: reorder when pages are unlocked and released

2019-04-29 Thread Tamas K Lengyel
On Mon, Apr 29, 2019 at 9:01 AM Jan Beulich wrote: > > >>> On 26.04.19 at 19:21, wrote: > > @@ -999,6 +996,10 @@ static int share_pages(struct domain *sd, gfn_t sgfn, > > shr_handle_t sh, > > mem_sharing_page_unlock(secondpg); > > mem_sharing_page_unlock(firstpg); > > > > +

Re: [Xen-devel] [PATCH v3 1/4] x86/mem_sharing: reorder when pages are unlocked and released

2019-04-29 Thread Tamas K Lengyel
On Mon, Apr 29, 2019 at 8:54 AM George Dunlap wrote: > > On 4/29/19 3:49 PM, Andrew Cooper wrote: > > On 29/04/2019 15:46, George Dunlap wrote: > >> On 4/29/19 3:32 PM, George Dunlap wrote: > >>> On 4/26/19 6:21 PM, Tamas K Lengyel wrote: > Calling _put_page_type while also holding the

Re: [Xen-devel] [PATCH v3 1/4] x86/mem_sharing: reorder when pages are unlocked and released

2019-04-29 Thread Jan Beulich
>>> On 26.04.19 at 19:21, wrote: > @@ -999,6 +996,10 @@ static int share_pages(struct domain *sd, gfn_t sgfn, > shr_handle_t sh, > mem_sharing_page_unlock(secondpg); > mem_sharing_page_unlock(firstpg); > > +BUG_ON(!put_count); > +while ( put_count-- ) > +

Re: [Xen-devel] [PATCH v3 1/4] x86/mem_sharing: reorder when pages are unlocked and released

2019-04-29 Thread Andrew Cooper
On 29/04/2019 15:46, George Dunlap wrote: > On 4/29/19 3:32 PM, George Dunlap wrote: >> On 4/26/19 6:21 PM, Tamas K Lengyel wrote: >>> Calling _put_page_type while also holding the page_lock >>> for that page can cause a deadlock. >>> >>> Signed-off-by: Tamas K Lengyel >>> Cc: Jan Beulich >>>

Re: [Xen-devel] [PATCH v3 1/4] x86/mem_sharing: reorder when pages are unlocked and released

2019-04-29 Thread George Dunlap
On 4/29/19 3:49 PM, Andrew Cooper wrote: > On 29/04/2019 15:46, George Dunlap wrote: >> On 4/29/19 3:32 PM, George Dunlap wrote: >>> On 4/26/19 6:21 PM, Tamas K Lengyel wrote: Calling _put_page_type while also holding the page_lock for that page can cause a deadlock.

Re: [Xen-devel] [PATCH v3 1/4] x86/mem_sharing: reorder when pages are unlocked and released

2019-04-29 Thread George Dunlap
On 4/29/19 3:32 PM, George Dunlap wrote: > On 4/26/19 6:21 PM, Tamas K Lengyel wrote: >> Calling _put_page_type while also holding the page_lock >> for that page can cause a deadlock. >> >> Signed-off-by: Tamas K Lengyel >> Cc: Jan Beulich >> Cc: Andrew Cooper >> Cc: George Dunlap >> Cc: Wei

Re: [Xen-devel] [PATCH v3 1/4] x86/mem_sharing: reorder when pages are unlocked and released

2019-04-29 Thread George Dunlap
On 4/26/19 6:21 PM, Tamas K Lengyel wrote: > Calling _put_page_type while also holding the page_lock > for that page can cause a deadlock. > > Signed-off-by: Tamas K Lengyel > Cc: Jan Beulich > Cc: Andrew Cooper > Cc: George Dunlap > Cc: Wei Liu > Cc: Roger Pau Monne > --- > v3: simplified