Re: [PATCH 07/12] x86/virt/guest/xen: Remove use of pgd_list from the Xen guest code

2015-06-16 Thread David Vrabel
On 16/06/15 15:19, Boris Ostrovsky wrote: > On 06/16/2015 10:15 AM, David Vrabel wrote: >> On 15/06/15 21:35, Ingo Molnar wrote: >>> * David Vrabel wrote: >>> On 15/06/15 10:05, Ian Campbell wrote: > On Sat, 2015-06-13 at 11:49 +0200, Ingo Molnar wrote: >> xen_mm_pin_all()/unpin_all()

Re: [PATCH 07/12] x86/virt/guest/xen: Remove use of pgd_list from the Xen guest code

2015-06-16 Thread David Vrabel
On 15/06/15 21:35, Ingo Molnar wrote: > > * David Vrabel wrote: > >> On 15/06/15 10:05, Ian Campbell wrote: >>> On Sat, 2015-06-13 at 11:49 +0200, Ingo Molnar wrote: > xen_mm_pin_all()/unpin_all() are used to implement full guest instance suspend/restore. It's a stop-all method that

Re: [PATCH 07/12] x86/virt/guest/xen: Remove use of pgd_list from the Xen guest code

2015-06-16 Thread Boris Ostrovsky
On 06/16/2015 10:15 AM, David Vrabel wrote: On 15/06/15 21:35, Ingo Molnar wrote: * David Vrabel wrote: On 15/06/15 10:05, Ian Campbell wrote: On Sat, 2015-06-13 at 11:49 +0200, Ingo Molnar wrote: xen_mm_pin_all()/unpin_all() are used to implement full guest instance suspend/restore. It's a

Re: [PATCH 07/12] x86/virt/guest/xen: Remove use of pgd_list from the Xen guest code

2015-06-15 Thread Ingo Molnar
* David Vrabel wrote: > On 15/06/15 10:05, Ian Campbell wrote: > > On Sat, 2015-06-13 at 11:49 +0200, Ingo Molnar wrote: > >> xen_mm_pin_all()/unpin_all() are used to implement full guest instance > >> suspend/restore. It's a stop-all method that needs to iterate through all > >> allocated pg

Re: [PATCH 07/12] x86/virt/guest/xen: Remove use of pgd_list from the Xen guest code

2015-06-15 Thread David Vrabel
On 15/06/15 10:05, Ian Campbell wrote: > On Sat, 2015-06-13 at 11:49 +0200, Ingo Molnar wrote: >> xen_mm_pin_all()/unpin_all() are used to implement full guest instance >> suspend/restore. It's a stop-all method that needs to iterate through >> all allocated pgds in the system to fix them up for Xe

Re: [PATCH 07/12] x86/virt/guest/xen: Remove use of pgd_list from the Xen guest code

2015-06-15 Thread Ian Campbell
On Sat, 2015-06-13 at 11:49 +0200, Ingo Molnar wrote: > xen_mm_pin_all()/unpin_all() are used to implement full guest instance > suspend/restore. It's a stop-all method that needs to iterate through > all allocated pgds in the system to fix them up for Xen's use. > > This code uses pgd_list, proba

Re: [PATCH 07/12] x86/virt/guest/xen: Remove use of pgd_list from the Xen guest code

2015-06-14 Thread Ingo Molnar
* Ingo Molnar wrote: > @@ -967,19 +979,32 @@ static void xen_pgd_unpin(struct mm_struct *mm) > */ > void xen_mm_unpin_all(void) > { > - struct page *page; > + struct task_struct *g, *p; > > - spin_lock(&pgd_lock); > + spin_lock(&pgd_lock); /* Implies rcu_read_lock() for the

Re: [PATCH 07/12] x86/virt/guest/xen: Remove use of pgd_list from the Xen guest code

2015-06-13 Thread Oleg Nesterov
On 06/13, Ingo Molnar wrote: > > * Oleg Nesterov wrote: > > > > So we could add tsk->mm_leader or so, > > > > No, no, please do not. Just do something like > > > > for_each_process(p) { > > > > for_each_thread(p, t) { > > So far that's what the for_each_process_thread() iterations

[PATCH 07/12] x86/virt/guest/xen: Remove use of pgd_list from the Xen guest code

2015-06-13 Thread Ingo Molnar
xen_mm_pin_all()/unpin_all() are used to implement full guest instance suspend/restore. It's a stop-all method that needs to iterate through all allocated pgds in the system to fix them up for Xen's use. This code uses pgd_list, probably because it was an easy interface. But we want to remove the

Re: [PATCH 07/12] x86/virt/guest/xen: Remove use of pgd_list from the Xen guest code

2015-06-13 Thread Ingo Molnar
* Oleg Nesterov wrote: > > So we could add tsk->mm_leader or so, > > No, no, please do not. Just do something like > > for_each_process(p) { > > for_each_thread(p, t) { So far that's what the for_each_process_thread() iterations I added do, right? >

Re: [PATCH 07/12] x86/virt/guest/xen: Remove use of pgd_list from the Xen guest code

2015-06-12 Thread Oleg Nesterov
On 06/12, Boris Ostrovsky wrote: > > On 06/12/2015 04:53 PM, Oleg Nesterov wrote: >>> >>> for_each_process(p) { >>> >>> for_each_thread(p, t) { >>> if (t->mm) { >>> do_something(t->mm); >>> break; >>>

Re: [PATCH 07/12] x86/virt/guest/xen: Remove use of pgd_list from the Xen guest code

2015-06-12 Thread Boris Ostrovsky
On 06/12/2015 04:53 PM, Oleg Nesterov wrote: On 06/12, Oleg Nesterov wrote: On 06/12, Ingo Molnar wrote: * Linus Torvalds wrote: So I think the only issue is that ->mm can become NULL when the thread group leader dies - a non-NULL mm should always be shared among all threads. Indeed, we

Re: [PATCH 07/12] x86/virt/guest/xen: Remove use of pgd_list from the Xen guest code

2015-06-12 Thread Oleg Nesterov
On 06/12, Oleg Nesterov wrote: > > On 06/12, Ingo Molnar wrote: > > > > * Linus Torvalds wrote: > > > > > So I think the only issue is that ->mm can become NULL when the thread > > > group > > > leader dies - a non-NULL mm should always be shared among all threads. > > > > Indeed, we do that in e

Re: [PATCH 07/12] x86/virt/guest/xen: Remove use of pgd_list from the Xen guest code

2015-06-12 Thread Oleg Nesterov
On 06/12, Ingo Molnar wrote: > > * Linus Torvalds wrote: > > > So I think the only issue is that ->mm can become NULL when the thread group > > leader dies - a non-NULL mm should always be shared among all threads. > > Indeed, we do that in exit_mm(). Yes, > So we could add tsk->mm_leader or so,

Re: [PATCH 07/12] x86/virt/guest/xen: Remove use of pgd_list from the Xen guest code

2015-06-12 Thread Ingo Molnar
* Linus Torvalds wrote: > On Jun 12, 2015 00:23, "Ingo Molnar" wrote: > > > > We might make it so: but that would mean restricting certain clone_flags > > variants - not sure that's possible with our current ABI usage? > > We already do that. You can't share signal info unless you share the m

Re: [PATCH 07/12] x86/virt/guest/xen: Remove use of pgd_list from the Xen guest code

2015-06-12 Thread Ingo Molnar
* Linus Torvalds wrote: > On Thu, Jun 11, 2015 at 1:37 PM, Linus Torvalds > wrote: > > > > Don't use "for_each_process_thread(g, p)". You only care about each mm, and > > threads all share the same mm, so just do > > > > for_each_process(p) > > > > instead of iterating over all threads too

Re: [PATCH 07/12] x86/virt/guest/xen: Remove use of pgd_list from the Xen guest code

2015-06-11 Thread Linus Torvalds
On Thu, Jun 11, 2015 at 1:37 PM, Linus Torvalds wrote: > > Don't use "for_each_process_thread(g, p)". You only care about each > mm, and threads all share the same mm, so just do > > for_each_process(p) > > instead of iterating over all threads too. Hmm. I may be wrong. It strikes me that one

Re: [PATCH 07/12] x86/virt/guest/xen: Remove use of pgd_list from the Xen guest code

2015-06-11 Thread Linus Torvalds
On Thu, Jun 11, 2015 at 7:07 AM, Ingo Molnar wrote: > > But we want to remove the pgd_list, so convert the code over to walk > all tasks in the system. This is an equivalent method. This is not at all equivalent, and it looks stupid. Don't use "for_each_process_thread(g, p)". You only care about

[PATCH 07/12] x86/virt/guest/xen: Remove use of pgd_list from the Xen guest code

2015-06-11 Thread Ingo Molnar
xen_mm_pin_all()/unpin_all() are used to implement full guest instance suspend/restore. It's a stop-all method that needs to iterate through all allocated pgds in the system to fix them up for Xen's use. This code uses pgd_list, probably because it was an easy interface. But we want to remove the