Skip to contentSkip to conversation

sedf/build: Fix build when using -fno-inline

PATCH Andrew Cooper 3 participants 5 messages Oct 3, 2012 – Oct 4, 2012

lore
Share & tools
lore
#0 lore raw

I found this issue while trying to debug on a separate issue. It certainly affects unstable thru 4.1, and probably earlier, so should be take for backport.

Signature · 2 lines
Andrew Cooper - Dom0 Kernel Engineer, Citrix XenServer
T: +44 (0)1223 225 900, http://www.citrix.com

# HG changeset patch
# Parent 5fbdbf585f5f2ee9a3e3c75a8a9f9f2cc6eda65c
build: Fix build when using -fno-inline

struct task_slice.migrated is not initialised by this function, and subsequently returned by value, leading to the error:

sched_sedf.c: In function ‘sedf_do_extra_schedule’:
sched_sedf.c:711: error: ‘ret.migrated’ may be used uninitialised in this function

for both gcc 4.1.2 and 4.4.3 (which are the two I have easily to hand) when combined with the -fno-inline compile option.

Signed-off-by Andrew Cooper <[email protected]>

--
This is compile tested only, but given that the sole caller of sedf_do_extra_schedule() unconditionally sets migrated to 0, I am fairly confident of the correctness of the fix.

xen/common/sched_sedf.c +1 -1
diff -r 5fbdbf585f5f xen/common/sched_sedf.c
@@ -667,7 +667,7 @@ static void desched_extra_dom(s_time_t n
 static struct task_slice sedf_do_extra_schedule(
     s_time_t now, s_time_t end_xt, struct list_head *extraq[], int cpu)
 {
-    struct task_slice   ret;
+    struct task_slice   ret = { 0 };
     struct sedf_vcpu_info *runinf;
     ASSERT(end_xt > now);
 

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

#1 lore raw
Quoted 4 lines · Andrew Cooper

I found this issue while trying to debug on a separate issue. It certainly affects unstable thru 4.1, and probably earlier, so should be take for backport.

Apologies - try this patch which has less Unicode in the commit message.

Signature · 2 lines
Andrew Cooper - Dom0 Kernel Engineer, Citrix XenServer
T: +44 (0)1223 225 900, http://www.citrix.com

# HG changeset patch
# Parent 5fbdbf585f5f2ee9a3e3c75a8a9f9f2cc6eda65c
sedf/build: Fix build when using -fno-inline

struct task_slice.migrated is not initialised by this function, and subsequently returned by value, leading to the error:

sched_sedf.c: In function 'sedf_do_extra_schedule':
sched_sedf.c:711: error: 'ret.migrated' may be used uninitialised in this function

for both gcc 4.1.2 and 4.4.3 (which are the two I have easily to hand) when combined with the -fno-inline compile option.

Signed-off-by Andrew Cooper <[email protected]>

--
This is compile tested only, but given that the sole caller of sedf_do_extra_schedule() unconditionally sets migrated to 0, I am fairly confident of the correctness of the fix.

Changes since v1:
- Fix unicode issue in comment.

xen/common/sched_sedf.c +1 -1
diff -r 5fbdbf585f5f xen/common/sched_sedf.c
@@ -667,7 +667,7 @@ static void desched_extra_dom(s_time_t n
 static struct task_slice sedf_do_extra_schedule(
     s_time_t now, s_time_t end_xt, struct list_head *extraq[], int cpu)
 {
-    struct task_slice   ret;
+    struct task_slice   ret = { 0 };
     struct sedf_vcpu_info *runinf;
     ASSERT(end_xt > now);
 

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

#2 lore raw
Quoted 8 lines
Quoted 1 line
Quoted 1 line

Andrew Cooper <[email protected]> 10/03/12 2:38 PM >>>

Quoted 4 lines · Andrew Cooper

I found this issue while trying to debug on a separate issue. It certainly affects unstable thru 4.1, and probably earlier, so should be take for backport.

Apologies - try this patch which has less Unicode in the commit message.

I certainly agree to the change for -unstable, but what's the rationale for the backport request (given that there's no -fno-inline anywhere in the tree)? Is this actively causing problems in any non-debugging environment?

Jan

#3 lore raw
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line

Andrew Cooper <[email protected]> 10/03/12 2:38 PM >>>

Quoted 4 lines · Andrew Cooper

I found this issue while trying to debug on a separate issue. It certainly affects unstable thru 4.1, and probably earlier, so should be take for backport.

Quoted 7 lines
Quoted 1 line

Apologies - try this patch which has less Unicode in the commit message.

I certainly agree to the change for -unstable, but what's the rationale for the backport request (given that there's no -fno-inline anywhere in the tree)? Is this actively causing problems in any non-debugging environment?

Jan

Not as far as I am aware. Backporting it will make no difference to the older trees in general, but will prevent people who are debugging older trees from needing to fix the build every time they actually need to invoke -fno-inline. (I have been working on this issue for 4 straight days now, debugging on 4.1 and was quite taken aback when the build broke).

I would argue that the benefits (for developers) do outweigh the bascially-0 cost, even if it isn't strictly a functional bugfix.

Signature · 2 lines
Andrew Cooper - Dom0 Kernel Engineer, Citrix XenServer
T: +44 (0)1223 225 900, http://www.citrix.com
#4 lore raw
In reply to Andrew Cooper
Quoted 7 lines · Andrew Cooper

# HG changeset patch
# Parent 5fbdbf585f5f2ee9a3e3c75a8a9f9f2cc6eda65c
sedf/build: Fix build when using -fno-inline

struct task_slice.migrated is not initialised by this function, and subsequently returned by value, leading to the error:

Quoted 9 lines

sched_sedf.c: In function 'sedf_do_extra_schedule':
sched_sedf.c:711: error: 'ret.migrated' may be used uninitialised in this function

for both gcc 4.1.2 and 4.4.3 (which are the two I have easily to hand) when combined with the -fno-inline compile option.

Signed-off-by Andrew Cooper <[email protected]>

Quoted 6 lines

--
This is compile tested only, but given that the sole caller of sedf_do_extra_schedule() unconditionally sets migrated to 0, I am fairly
confident of the correctness of the fix.

Agreed, sedf does not include any task migration mechanism, so 0 is all you can have there. :-)

Thanks and Regards,
Dario

Signature · 4 lines
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://retis.sssup.it/people/faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)

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