[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • To: Shawn Anastasio <sanastasio@xxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 26 Sep 2023 09:32:22 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=VyxJEsHwmToT1pWzQ6OsbRTzkPir4+aJVLEwtRLkP14=; b=kXf8Zumg5eeixBU/WGF6dl4vyt2DsND9/cpUv6JTIU9PVnsOUwmXAgsagdgSBqE2FgED3k0QLcMbrKw/JAdVEtUlKX1GH4sWwJTitMk2fagU+VLKumT8qOH+BEuBLxRLnhqfx9xJNQgExzdg3H32Gm85oJssTqWcrIcaMyFsn1K52ah9AkRrCVCJcy7wxAdTbHr5Xl5bJC/B61ZLcqN/8O+7rZxn7CMvtEfjRz/wrBfBTaDwjMT1H3BFUqSawRaEVEelMrFxCYyollmas8PEAIZQOTigaxjuTPF5YR+6Pg9gmtmPCPsP5Z9bPmMZSiglLbrKqiFZ7o43/zfJbadGrw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nI++HXbPqIMajtCOwdxApFapNNmkRsUacmUohbD6exoVLbHSSap725Ndmv7WFqwx4Tv22ByELblL9asg+GZwUsqLCSqNOGnRjbln0Ud4kfGlDjg7pubceV/viImnxfu/ZaN0aLSMKQtPtFOz2qBALlJa6kN0IpBjq0Yayz4Lv2df18ChFt6zfmC7G5H0idx1OkS2dbzN6bSKXEyQ9vFBBEgoAH5lrfNZZgLY1m8AmOy28NrLWttjUODIcc0MSWvywrgNpTMAcwNYxdiv4vq8/OWsV2RFOZz2JmXrIUHNx9BnKHqlsAT07CUY5dYSbi3enqVy21iU9yjhkD7w2l953w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Timothy Pearson <tpearson@xxxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 26 Sep 2023 07:33:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 26.09.2023 00:42, Shawn Anastasio wrote:
> When building for Power with CONFIG_DEBUG unset, a compiler error gets
> raised inside page_alloc.c's node_to_scrub function, likely due to the
> increased optimization level:
> 
> 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] )

That's gcc13?

> 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.

Looks very similar to the situation that c890499871cc ("timer: fix
NR_CPUS=1 build with gcc13") was dealing with, just that here it's
MAX_NUMNODES. I'd therefore prefer a solution similar to the one
taken there, i.e. make code conditional rather than add yet more
code.

Otherwise, ...

> --- a/xen/common/page_alloc.c
> +++ b/xen/common/page_alloc.c
> @@ -1211,6 +1211,9 @@ static unsigned int node_to_scrub(bool get_node)
>          } while ( !cpumask_empty(&node_to_cpumask(node)) &&
>                    (node != local_node) );
> 
> +        if ( node >= MAX_NUMNODES )
> +            break;

... this clearly redundant check would need to gain a comment.

What I'm puzzled by is that on Arm we had no reports of a similar
problem, despite NUMA also not getting selected there (yet).

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.