Skip to contentSkip to conversation

Fix Power CI build

PATCH In review Shawn Anastasio 4 participants 8 messages Sep 26, 2023 – Sep 27, 2023

lore
Share & tools
lore
#0 lore raw

v3 cover Fix Power CI build

Hello all,

This series contains a few minor fixes to the CI config and one additional patch to common/ that resolve ppc64-specific CI failures that Jan discovered.

Thanks,

Shawn Anastasio (2):
automation: Change build script to use arch defconfig xen/common: Add NUMA node id bounds check to
page_alloc.c/node_to_scrub

 automation/scripts/build | 5 ++++-
 xen/common/page_alloc.c  | 8 ++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

--
2.30.2

#4 lore raw

PATCH v3 2/2 xen/common: Add NUMA node id bounds check to page_alloc.c/node_to_scrub

When building for Power with CONFIG_DEBUG unset, a compiler error gets raised inside page_alloc.c's node_to_scrub function:

common/page_alloc.c: In function 'node_to_scrub.part.0':
common/page_alloc.c:1217:29: error: array subscript 1 is above array
bounds of 'long unsigned int[1]' [-Werror=array-bounds]
1217 | if ( node_need_scrub[node] )

It appears that this is a false positive, given that in practice cycle_node should never return a node ID >= MAX_NUMNODES as long as the architecture's node_online_map is properly defined and initialized, so this additional bounds check is only to satisfy GCC.

---
v2: Add comment to explain the bounds check.

 xen/common/page_alloc.c | 8 ++++++++
 1 file changed, 8 insertions(+)
xen/common/page_alloc.c +8 -0
index 35d9a26fa6..9b5df74fdd 100644
@@ -1211,6 +1211,14 @@ static unsigned int node_to_scrub(bool get_node)
         } while ( !cpumask_empty(&node_to_cpumask(node)) &&
                   (node != local_node) );
 
+        /*
+         * In practice `node` will always be within MAX_NUMNODES, but GCC can't
+         * always see that, so an explicit check is necessary to avoid tripping
+         * its out-of-bounds array access warning (-Warray-bounds).
+         */
+        if ( node >= MAX_NUMNODES )
+            break;
+
         if ( node == local_node )
             break;
 

--
2.30.2

#1 lore raw

PATCH v3 1/2 automation: Change build script to use arch defconfig

In reply to Shawn Anastasio

Change automation build script to call the make defconfig target before setting CONFIG_DEBUG and extra options. This fixes issues on Power where the build fails without using the ppc64_defconfig.

---
v3: Drop unnecessary sed.

v2: No changes.

 automation/scripts/build | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
automation/scripts/build +4 -1
index b4edcf010e..b3c71fb6fb 100755
@@ -22,7 +22,10 @@ if [[ "${RANDCONFIG}" == "y" ]]; then
     # RANDCONFIG implies HYPERVISOR_ONLY
     HYPERVISOR_ONLY="y"
 else
-    echo "CONFIG_DEBUG=${debug}" > xen/.config
+    # Start off with arch's defconfig
+    make -C xen defconfig
+
+    echo "CONFIG_DEBUG=${debug}" >> xen/.config
 
     if [[ -n "${EXTRA_XEN_CONFIG}" ]]; then
         echo "${EXTRA_XEN_CONFIG}" >> xen/.config

--
2.30.2

#2 lore raw

Re: [PATCH v3 1/2] automation: Change build script to use arch defconfig

Hi Shawn,

Quoted 8 lines · Shawn Anastasio

Change automation build script to call the make defconfig target before setting CONFIG_DEBUG and extra options. This fixes issues on Power where the build fails without using the ppc64_defconfig.

As discussed in v1, CI fixes should be included in 4.18, so:

Kind regards,
Henry

Quoted 28 lines

---
v3: Drop unnecessary sed.

v2: No changes.

automation/scripts/build | 5 ++++-

1 file changed, 4 insertions(+), 1 deletion(-)
automation/scripts/build +0 -0
index b4edcf010e..b3c71fb6fb 100755
@@ -22,7 +22,10 @@ if [[ "${RANDCONFIG}" == "y" ]]; then
    # RANDCONFIG implies HYPERVISOR_ONLY
    HYPERVISOR_ONLY="y"

else

automation/scripts/build +4 -2
-    echo "CONFIG_DEBUG=${debug}" > xen/.config
+    # Start off with arch's defconfig
+    make -C xen defconfig
+
+    echo "CONFIG_DEBUG=${debug}" >> xen/.config
 
    if [[ -n "${EXTRA_XEN_CONFIG}" ]]; then
        echo "${EXTRA_XEN_CONFIG}" >> xen/.config
--

2.30.2

#5 lore raw

Re: [PATCH v3 2/2] xen/common: Add NUMA node id bounds check to page_alloc.c/node_to_scrub

In reply to Shawn Anastasio

Hi,

Quoted 10 lines · Shawn Anastasio

When building for Power with CONFIG_DEBUG unset, a compiler error gets raised inside page_alloc.c's node_to_scrub function:

common/page_alloc.c: In function 'node_to_scrub.part.0':
common/page_alloc.c:1217:29: error: array subscript 1 is above array
bounds of 'long unsigned int[1]' [-Werror=array-bounds]
1217 | if ( node_need_scrub[node] )

Quoted 7 lines

It appears that this is a false positive, given that in practice cycle_node should never return a node ID >= MAX_NUMNODES as long as the architecture's node_online_map is properly defined and initialized, so this additional bounds check is only to satisfy GCC.

I am seeing some discussions going on about this patch, but once this is patch is ready for merge please feel free to add:

Kind regards,
Henry

Quoted 29 lines

---
v2: Add comment to explain the bounds check.

xen/common/page_alloc.c | 8 ++++++++

1 file changed, 8 insertions(+)
xen/common/page_alloc.c +8 -1
index 35d9a26fa6..9b5df74fdd 100644
@@ -1211,6 +1211,14 @@ static unsigned int node_to_scrub(bool get_node)
        } while ( !cpumask_empty(&node_to_cpumask(node)) &&
                  (node != local_node) );
 
+        /*
+         * In practice `node` will always be within MAX_NUMNODES, but GCC can't
+         * always see that, so an explicit check is necessary to avoid tripping
+         * its out-of-bounds array access warning (-Warray-bounds).
+         */
+        if ( node >= MAX_NUMNODES )
+            break;
+
        if ( node == local_node )
            break;
 
--

2.30.2

Reviewed-by on v3 1/2
#3 lore raw

Re: [PATCH v3 1/2] automation: Change build script to use arch defconfig

In reply to Shawn Anastasio
Quoted 6 lines · Shawn Anastasio

Change automation build script to call the make defconfig target before setting CONFIG_DEBUG and extra options. This fixes issues on Power where the build fails without using the ppc64_defconfig.

Quoted 27 lines

---
v3: Drop unnecessary sed.

v2: No changes.

 automation/scripts/build | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
automation/scripts/build +4 -2
index b4edcf010e..b3c71fb6fb 100755
@@ -22,7 +22,10 @@ if [[ "${RANDCONFIG}" == "y" ]]; then
     # RANDCONFIG implies HYPERVISOR_ONLY
     HYPERVISOR_ONLY="y"
 else
-    echo "CONFIG_DEBUG=${debug}" > xen/.config
+    # Start off with arch's defconfig
+    make -C xen defconfig
+
+    echo "CONFIG_DEBUG=${debug}" >> xen/.config
 
     if [[ -n "${EXTRA_XEN_CONFIG}" ]]; then
         echo "${EXTRA_XEN_CONFIG}" >> xen/.config
--

2.30.2

#6 lore raw

Re: [PATCH v3 2/2] xen/common: Add NUMA node id bounds check to page_alloc.c/node_to_scrub

In reply to Shawn Anastasio
Quoted 6 lines · Shawn Anastasio
xen/common/page_alloc.c +0 -0
@@ -1211,6 +1211,14 @@ static unsigned int node_to_scrub(bool get_node)
         } while ( !cpumask_empty(&node_to_cpumask(node)) &&
                   (node != local_node) );
 

xen/common/page_alloc.c static unsigned int node_to_scrub(bool get_node) · line 1223

Quoted 10 lines
xen/common/page_alloc.c +8 -0
+        /*
+         * In practice `node` will always be within MAX_NUMNODES, but GCC can't
+         * always see that, so an explicit check is necessary to avoid tripping
+         * its out-of-bounds array access warning (-Warray-bounds).
+         */
+        if ( node >= MAX_NUMNODES )
+            break;
+
         if ( node == local_node )
             break;

My comment on v1 wasn't addressed, either verbally or by a code change. Imo that would move us a tiny step closer to what Andrew was asking for as well.

Jan

#7 lore raw

Re: [PATCH v3 2/2] xen/common: Add NUMA node id bounds check to page_alloc.c/node_to_scrub

Quoted 7 lines · Jan Beulich
Quoted 6 lines · Shawn Anastasio
xen/common/page_alloc.c +0 -0
@@ -1211,6 +1211,14 @@ static unsigned int node_to_scrub(bool get_node)
         } while ( !cpumask_empty(&node_to_cpumask(node)) &&
                   (node != local_node) );
 
Quoted 12 lines

xen/common/page_alloc.c static unsigned int node_to_scrub(bool get_node) · line 1223

Quoted 10 lines
xen/common/page_alloc.c +8 -0
+        /*
+         * In practice `node` will always be within MAX_NUMNODES, but GCC can't
+         * always see that, so an explicit check is necessary to avoid tripping
+         * its out-of-bounds array access warning (-Warray-bounds).
+         */
+        if ( node >= MAX_NUMNODES )
+            break;
+
         if ( node == local_node )
             break;

My comment on v1 wasn't addressed, either verbally or by a code change.

I have to apologize, you did respond, and I didn't spot the response earlier on. I'm not happy about the added code, but at least it has a comment now. Hence I guess I simply withdraw my objection, so the change can go in.

Jan

Quoted 5 lines

Imo
that would move us a tiny step closer to what Andrew was asking for as well.

Jan