[Xen-devel] [PATCH 2/2] xen/sched: fix freeing per-vcpu data in sched_move_domain()

Juergen Gross posted 2 patches 6 years, 1 month ago
[Xen-devel] [PATCH 2/2] xen/sched: fix freeing per-vcpu data in sched_move_domain()
Posted by Juergen Gross 6 years, 1 month ago
In case of an allocation error of per-vcpu data in sched_move_domain()
the already allocated data is freed just using xfree(). This is wrong
as some schedulers need to do additional operations (e.g. the arinc653
scheduler needs to remove the vcpu-data from a list).

So instead xfree() make use of the sched_free_vdata() hook.

Signed-off-by: Juergen Gross <jgross@suse.com>
---
 xen/common/schedule.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index 13b5ffc7cf..13c17fe944 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -386,7 +386,7 @@ int sched_move_domain(struct domain *d, struct cpupool *c)
         if ( vcpu_priv[v->vcpu_id] == NULL )
         {
             for_each_vcpu ( d, v )
-                xfree(vcpu_priv[v->vcpu_id]);
+                sched_free_vdata(c->sched, vcpu_priv[v->vcpu_id]);
             xfree(vcpu_priv);
             sched_free_domdata(c->sched, domdata);
             return -ENOMEM;
-- 
2.16.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 2/2] xen/sched: fix freeing per-vcpu data in sched_move_domain()
Posted by Jan Beulich 6 years, 1 month ago
On 25.09.2019 09:05, Juergen Gross wrote:
> In case of an allocation error of per-vcpu data in sched_move_domain()
> the already allocated data is freed just using xfree(). This is wrong
> as some schedulers need to do additional operations (e.g. the arinc653
> scheduler needs to remove the vcpu-data from a list).
> 
> So instead xfree() make use of the sched_free_vdata() hook.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH 2/2] xen/sched: fix freeing per-vcpu data in sched_move_domain()
Posted by Dario Faggioli 6 years, 1 month ago
On Wed, 2019-09-25 at 09:05 +0200, Juergen Gross wrote:
> In case of an allocation error of per-vcpu data in
> sched_move_domain()
> the already allocated data is freed just using xfree(). This is wrong
> as some schedulers need to do additional operations (e.g. the
> arinc653
> scheduler needs to remove the vcpu-data from a list).
> 
> So instead xfree() make use of the sched_free_vdata() hook.
> 
> Signed-off-by: Juergen Gross <jgross@suse.com>
>
Reviewed-by: Dario Faggioli <dfaggioli@suse.com>

Regards
-- 
Dario Faggioli, Ph.D
http://about.me/dario.faggioli
Virtualization Software Engineer
SUSE Labs, SUSE https://www.suse.com/
-------------------------------------------------------------------
<<This happens because _I_ choose it to happen!>> (Raistlin Majere)

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel