From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C5651C3DA41 for ; Thu, 11 Jul 2024 11:17:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/r51nS+g7lQoWT0HNbExECB6/rA+diGsBSoUeSas/gM=; b=S9p5erhu5DiTtDbQzLXNAT8JpS xoRyy/yv3EaOrA5GoEIM4hCIPmhZcFnIJpcg3cxWWEWdoQFDU0eY1JejwDAXT3yW44QN1ljMlcgDL EbOj5Addk95xRPuL7un8NUf0SPls6xX764T5K1PmRjQxrDuVgAepmhS5Zw275WIepTPyCSzrW2zsk KnDBXNQtloRfBiXG7TlQsaTNW09KixCnAgi8jpN34ZHCGOE4hMyoKri1yMdHMqavWO1rh7FDVg2Lt gB8wHuwA8pYFwDaA7wZf5MgluFHgCpzjFEZas3uO81GR/1K6mhMtjJAvS+arHZyKj87tZNa6BYzHQ oLwemR0A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRrnW-0000000DieG-10jv; Thu, 11 Jul 2024 11:17:14 +0000 Received: from mail-ej1-f47.google.com ([209.85.218.47]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRrnE-0000000DiX1-1kvg for linux-arm-kernel@lists.infradead.org; Thu, 11 Jul 2024 11:16:57 +0000 Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a77bf336171so141690566b.1 for ; Thu, 11 Jul 2024 04:16:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720696614; x=1721301414; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/r51nS+g7lQoWT0HNbExECB6/rA+diGsBSoUeSas/gM=; b=a197IpueNTYdpMoA0aGJ9WRSyS+wI+SZscIkqgbbRzXwfCR8lqeABCsyudl9h3D00R UYg64H/BLPGrpyVz6+uypc4m3nvjQLTy3spUq19mToXB7RIiNsAaLXol/SGAOX+Q6P1h LFY8e6sG+fhItsqXdNzzfPAdg1hi4x77EYnOF/1uoFD3JtYmFo2AM8TNptpD+c7JePj2 v9bprBfKIo+lQmuHkZNop0a8a/5iwE1phj8TYKBGOgAKy4R6qPaQTiF9dWlbSJjIP4CJ SOEt22W4hkxK3tUtKXtOWhsy7WGrt5xUzYkWGd08QOz4bD8JeDnftk9P9gO6UkZOxVpV u+Wg== X-Forwarded-Encrypted: i=1; AJvYcCXQPCebUCP01/onGfqE4xqoxsJW1oRZ5iNV9+qnrNRMqCWfE/85Rxf6oQ+Lu8ZGVsJsnQTAqzC7m4ciGKv1+1Ywq0HvFouLLPLkRRQ4IxhktYSTNUA= X-Gm-Message-State: AOJu0Yx+gRXl2gHxl6tQDiXXL9Sw/kyoQo+K3Qr03B1YJYHEhHlgNUS7 z1H1g2c1zEiOkj6KdRopzmwFm6iZy8Stf9878aQ4M7x2Je3pmNyT X-Google-Smtp-Source: AGHT+IE6LZHdbstxR+votJm7nuupUZbWEEQffPECqBfV2tlXDzop1gI1NS4S6fcacoV6R+qMyM4bdw== X-Received: by 2002:a17:906:5806:b0:a6f:e699:a9f8 with SMTP id a640c23a62f3a-a798a2cc14amr156904966b.18.1720696614118; Thu, 11 Jul 2024 04:16:54 -0700 (PDT) Received: from gmail.com (fwdproxy-lla-115.fbsv.net. [2a03:2880:30ff:73::face:b00c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a797ddb28ccsm132052466b.147.2024.07.11.04.16.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jul 2024 04:16:53 -0700 (PDT) Date: Thu, 11 Jul 2024 04:16:51 -0700 From: Breno Leitao To: Vladimir Oltean Cc: netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Herbert Xu , Madalin Bucur , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH net-next 1/5] net: dpaa: avoid on-stack arrays of NR_CPUS elements Message-ID: References: <20240710230025.46487-1-vladimir.oltean@nxp.com> <20240710230025.46487-2-vladimir.oltean@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240710230025.46487-2-vladimir.oltean@nxp.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240711_041656_479700_EC4432D5 X-CRM114-Status: GOOD ( 15.72 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hello Vladimir, On Thu, Jul 11, 2024 at 02:00:21AM +0300, Vladimir Oltean wrote: > The dpaa-eth driver is written for PowerPC and Arm SoCs which have 1-24 > CPUs. It depends on CONFIG_NR_CPUS having a reasonably small value in > Kconfig. Otherwise, there are 2 functions which allocate on-stack arrays > of NR_CPUS elements, and these can quickly explode in size, leading to > warnings such as: > > drivers/net/ethernet/freescale/dpaa/dpaa_eth.c:3280:12: warning: > stack frame size (16664) exceeds limit (2048) in 'dpaa_eth_probe' [-Wframe-larger-than] > > The problem is twofold: > - Reducing the array size to the boot-time num_possible_cpus() (rather > than the compile-time NR_CPUS) creates a variable-length array, > which should be avoided in the Linux kernel. > - Using NR_CPUS as an array size makes the driver blow up in stack > consumption with generic, as opposed to hand-crafted, .config files. > > A simple solution is to use dynamic allocation for num_possible_cpus() > elements (aka a small number determined at runtime). > > Link: https://lore.kernel.org/all/202406261920.l5pzM1rj-lkp@intel.com/ > Signed-off-by: Vladimir Oltean Reviewed-by: Breno Leitao Thanks for working on it. --breno