* [PATCH 0/2] x86: fix memory leaks @ 2016-04-29 14:41 Jan Beulich 2016-04-29 14:49 ` [PATCH 1/2] x86/p2m: clean up altp2m Jan Beulich ` (2 more replies) 0 siblings, 3 replies; 9+ messages in thread From: Jan Beulich @ 2016-04-29 14:41 UTC (permalink / raw) To: xen-devel; +Cc: George Dunlap, Andrew Cooper, Wei Liu 1: p2m: clean up altp2m 2: fix domain cleanup Signed-off-by: Jan Beulich <jbeulich@suse.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] x86/p2m: clean up altp2m 2016-04-29 14:41 [PATCH 0/2] x86: fix memory leaks Jan Beulich @ 2016-04-29 14:49 ` Jan Beulich 2016-04-29 14:53 ` Andrew Cooper 2016-05-03 16:44 ` George Dunlap 2016-04-29 14:49 ` [PATCH 2/2] x86: fix domain cleanup Jan Beulich 2016-04-29 15:36 ` [PATCH 0/2] x86: fix memory leaks Wei Liu 2 siblings, 2 replies; 9+ messages in thread From: Jan Beulich @ 2016-04-29 14:49 UTC (permalink / raw) To: xen-devel; +Cc: George Dunlap, Andrew Cooper, Wei Liu [-- Attachment #1: Type: text/plain, Size: 522 bytes --] Signed-off-by: Jan Beulich <jbeulich@suse.com> --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -618,9 +618,11 @@ void p2m_teardown(struct p2m_domain *p2m void p2m_final_teardown(struct domain *d) { - /* We must teardown unconditionally because + /* + * We must teardown both of them unconditionally because * we initialise them unconditionally. */ + p2m_teardown_altp2m(d); p2m_teardown_nestedp2m(d); /* Iterate over all p2m tables per domain */ [-- Attachment #2: x86-altp2m-teardown.patch --] [-- Type: text/plain, Size: 544 bytes --] x86/p2m: clean up altp2m Signed-off-by: Jan Beulich <jbeulich@suse.com> --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -618,9 +618,11 @@ void p2m_teardown(struct p2m_domain *p2m void p2m_final_teardown(struct domain *d) { - /* We must teardown unconditionally because + /* + * We must teardown both of them unconditionally because * we initialise them unconditionally. */ + p2m_teardown_altp2m(d); p2m_teardown_nestedp2m(d); /* Iterate over all p2m tables per domain */ [-- 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] 9+ messages in thread
* Re: [PATCH 1/2] x86/p2m: clean up altp2m 2016-04-29 14:49 ` [PATCH 1/2] x86/p2m: clean up altp2m Jan Beulich @ 2016-04-29 14:53 ` Andrew Cooper 2016-05-03 16:44 ` George Dunlap 1 sibling, 0 replies; 9+ messages in thread From: Andrew Cooper @ 2016-04-29 14:53 UTC (permalink / raw) To: Jan Beulich, xen-devel; +Cc: George Dunlap, Wei Liu On 29/04/16 15:49, Jan Beulich wrote: > Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] x86/p2m: clean up altp2m 2016-04-29 14:49 ` [PATCH 1/2] x86/p2m: clean up altp2m Jan Beulich 2016-04-29 14:53 ` Andrew Cooper @ 2016-05-03 16:44 ` George Dunlap 2016-05-03 16:45 ` George Dunlap 1 sibling, 1 reply; 9+ messages in thread From: George Dunlap @ 2016-05-03 16:44 UTC (permalink / raw) To: Jan Beulich; +Cc: xen-devel, Wei Liu, Andrew Cooper On Fri, Apr 29, 2016 at 3:49 PM, Jan Beulich <JBeulich@suse.com> wrote: > Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: George Dunlap <george.dunlap@citrix.com> > > --- a/xen/arch/x86/mm/p2m.c > +++ b/xen/arch/x86/mm/p2m.c > @@ -618,9 +618,11 @@ void p2m_teardown(struct p2m_domain *p2m > > void p2m_final_teardown(struct domain *d) > { > - /* We must teardown unconditionally because > + /* > + * We must teardown both of them unconditionally because > * we initialise them unconditionally. > */ > + p2m_teardown_altp2m(d); > p2m_teardown_nestedp2m(d); > > /* Iterate over all p2m tables per domain */ > > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel > _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] x86/p2m: clean up altp2m 2016-05-03 16:44 ` George Dunlap @ 2016-05-03 16:45 ` George Dunlap 2016-05-04 7:25 ` Jan Beulich 0 siblings, 1 reply; 9+ messages in thread From: George Dunlap @ 2016-05-03 16:45 UTC (permalink / raw) To: Jan Beulich; +Cc: xen-devel, Wei Liu, Andrew Cooper On Tue, May 3, 2016 at 5:44 PM, George Dunlap <George.Dunlap@eu.citrix.com> wrote: > On Fri, Apr 29, 2016 at 3:49 PM, Jan Beulich <JBeulich@suse.com> wrote: >> Signed-off-by: Jan Beulich <jbeulich@suse.com> > > Acked-by: George Dunlap <george.dunlap@citrix.com> And I guess this is a candidate for backport to 4.6 too? -George _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] x86/p2m: clean up altp2m 2016-05-03 16:45 ` George Dunlap @ 2016-05-04 7:25 ` Jan Beulich 0 siblings, 0 replies; 9+ messages in thread From: Jan Beulich @ 2016-05-04 7:25 UTC (permalink / raw) To: George Dunlap; +Cc: Andrew Cooper, Wei Liu, xen-devel >>> On 03.05.16 at 18:45, <George.Dunlap@eu.citrix.com> wrote: > On Tue, May 3, 2016 at 5:44 PM, George Dunlap > <George.Dunlap@eu.citrix.com> wrote: >> On Fri, Apr 29, 2016 at 3:49 PM, Jan Beulich <JBeulich@suse.com> wrote: >>> Signed-off-by: Jan Beulich <jbeulich@suse.com> >> >> Acked-by: George Dunlap <george.dunlap@citrix.com> > > And I guess this is a candidate for backport to 4.6 too? Definitely (and I have it in my queue already). Jan _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/2] x86: fix domain cleanup 2016-04-29 14:41 [PATCH 0/2] x86: fix memory leaks Jan Beulich 2016-04-29 14:49 ` [PATCH 1/2] x86/p2m: clean up altp2m Jan Beulich @ 2016-04-29 14:49 ` Jan Beulich 2016-04-29 15:34 ` Andrew Cooper 2016-04-29 15:36 ` [PATCH 0/2] x86: fix memory leaks Wei Liu 2 siblings, 1 reply; 9+ messages in thread From: Jan Beulich @ 2016-04-29 14:49 UTC (permalink / raw) To: xen-devel; +Cc: George Dunlap, Andrew Cooper, Wei Liu [-- Attachment #1: Type: text/plain, Size: 2054 bytes --] Free d->arch.cpuids on both the creation error path and during destruction. Don't bypass iommu_domain_destroy(). Move psr_domain_init() up so that hvm_domain_initialise() again is the last thing which can fail, and hence doesn't require undoing later on. Move psr_domain_free() up on the creation error path, so that cleanup once again gets done in reverse order of setup. Signed-off-by: Jan Beulich <jbeulich@suse.com> --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -642,21 +642,18 @@ int arch_domain_create(struct domain *d, } spin_lock_init(&d->arch.e820_lock); + if ( (rc = psr_domain_init(d)) != 0 ) + goto fail; + if ( has_hvm_container_domain(d) ) { if ( (rc = hvm_domain_initialise(d)) != 0 ) - { - iommu_domain_destroy(d); goto fail; - } } else /* 64-bit PV guest by default. */ d->arch.is_32bit_pv = d->arch.has_32bit_shinfo = 0; - if ( (rc = psr_domain_init(d)) != 0 ) - goto fail; - /* initialize default tsc behavior in case tools don't */ tsc_set_info(d, TSC_MODE_DEFAULT, 0UL, 0, 0); spin_lock_init(&d->arch.vtsc_lock); @@ -674,8 +671,11 @@ int arch_domain_create(struct domain *d, fail: d->is_dying = DOMDYING_dead; + psr_domain_free(d); + iommu_domain_destroy(d); cleanup_domain_irq_mapping(d); free_xenheap_page(d->shared_info); + xfree(d->arch.cpuids); if ( paging_initialised ) paging_final_teardown(d); free_perdomain_mappings(d); @@ -684,7 +684,6 @@ int arch_domain_create(struct domain *d, xfree(d->arch.pv_domain.cpuidmasks); free_xenheap_page(d->arch.pv_domain.gdt_ldt_l1tab); } - psr_domain_free(d); return rc; } @@ -694,6 +693,7 @@ void arch_domain_destroy(struct domain * hvm_domain_destroy(d); xfree(d->arch.e820); + xfree(d->arch.cpuids); free_domain_pirqs(d); if ( !is_idle_domain(d) ) [-- Attachment #2: x86-free-cpuids.patch --] [-- Type: text/plain, Size: 2075 bytes --] x86: fix domain cleanup Free d->arch.cpuids on both the creation error path and during destruction. Don't bypass iommu_domain_destroy(). Move psr_domain_init() up so that hvm_domain_initialise() again is the last thing which can fail, and hence doesn't require undoing later on. Move psr_domain_free() up on the creation error path, so that cleanup once again gets done in reverse order of setup. Signed-off-by: Jan Beulich <jbeulich@suse.com> --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -642,21 +642,18 @@ int arch_domain_create(struct domain *d, } spin_lock_init(&d->arch.e820_lock); + if ( (rc = psr_domain_init(d)) != 0 ) + goto fail; + if ( has_hvm_container_domain(d) ) { if ( (rc = hvm_domain_initialise(d)) != 0 ) - { - iommu_domain_destroy(d); goto fail; - } } else /* 64-bit PV guest by default. */ d->arch.is_32bit_pv = d->arch.has_32bit_shinfo = 0; - if ( (rc = psr_domain_init(d)) != 0 ) - goto fail; - /* initialize default tsc behavior in case tools don't */ tsc_set_info(d, TSC_MODE_DEFAULT, 0UL, 0, 0); spin_lock_init(&d->arch.vtsc_lock); @@ -674,8 +671,11 @@ int arch_domain_create(struct domain *d, fail: d->is_dying = DOMDYING_dead; + psr_domain_free(d); + iommu_domain_destroy(d); cleanup_domain_irq_mapping(d); free_xenheap_page(d->shared_info); + xfree(d->arch.cpuids); if ( paging_initialised ) paging_final_teardown(d); free_perdomain_mappings(d); @@ -684,7 +684,6 @@ int arch_domain_create(struct domain *d, xfree(d->arch.pv_domain.cpuidmasks); free_xenheap_page(d->arch.pv_domain.gdt_ldt_l1tab); } - psr_domain_free(d); return rc; } @@ -694,6 +693,7 @@ void arch_domain_destroy(struct domain * hvm_domain_destroy(d); xfree(d->arch.e820); + xfree(d->arch.cpuids); free_domain_pirqs(d); if ( !is_idle_domain(d) ) [-- 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] 9+ messages in thread
* Re: [PATCH 2/2] x86: fix domain cleanup 2016-04-29 14:49 ` [PATCH 2/2] x86: fix domain cleanup Jan Beulich @ 2016-04-29 15:34 ` Andrew Cooper 0 siblings, 0 replies; 9+ messages in thread From: Andrew Cooper @ 2016-04-29 15:34 UTC (permalink / raw) To: Jan Beulich, xen-devel; +Cc: George Dunlap, Wei Liu On 29/04/16 15:49, Jan Beulich wrote: > Free d->arch.cpuids on both the creation error path and during > destruction. > > Don't bypass iommu_domain_destroy(). > > Move psr_domain_init() up so that hvm_domain_initialise() again is the > last thing which can fail, and hence doesn't require undoing later on. > > Move psr_domain_free() up on the creation error path, so that cleanup > once again gets done in reverse order of setup. > > Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 0/2] x86: fix memory leaks 2016-04-29 14:41 [PATCH 0/2] x86: fix memory leaks Jan Beulich 2016-04-29 14:49 ` [PATCH 1/2] x86/p2m: clean up altp2m Jan Beulich 2016-04-29 14:49 ` [PATCH 2/2] x86: fix domain cleanup Jan Beulich @ 2016-04-29 15:36 ` Wei Liu 2 siblings, 0 replies; 9+ messages in thread From: Wei Liu @ 2016-04-29 15:36 UTC (permalink / raw) To: Jan Beulich; +Cc: George Dunlap, xen-devel, Wei Liu, Andrew Cooper On Fri, Apr 29, 2016 at 08:41:14AM -0600, Jan Beulich wrote: > 1: p2m: clean up altp2m > 2: fix domain cleanup > > Signed-off-by: Jan Beulich <jbeulich@suse.com> > Release-acked-by: Wei Liu <wei.liu2@citrix.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-05-04 7:25 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-04-29 14:41 [PATCH 0/2] x86: fix memory leaks Jan Beulich 2016-04-29 14:49 ` [PATCH 1/2] x86/p2m: clean up altp2m Jan Beulich 2016-04-29 14:53 ` Andrew Cooper 2016-05-03 16:44 ` George Dunlap 2016-05-03 16:45 ` George Dunlap 2016-05-04 7:25 ` Jan Beulich 2016-04-29 14:49 ` [PATCH 2/2] x86: fix domain cleanup Jan Beulich 2016-04-29 15:34 ` Andrew Cooper 2016-04-29 15:36 ` [PATCH 0/2] x86: fix memory leaks Wei Liu
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).