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 BA59EC3DA42 for ; Mon, 8 Jul 2024 19:08:40 +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=i5VCdX60NWwfC1nVwekLYgNiGy5kNm96Cosdiq19/GM=; b=vQSN2nVZ7kKB4R2x8s2sWgCatJ JHnagCSvH4pTBedIQIWKLvItV/Uzuhn4hsz6IUgHJ8kT76ekPf+A9xaImu8B89d/jWrSbB4reR1RF OVfj7RR3L334Pwj/7qz3kOiEAiu537HTllnwhgGI3gxwy40DTAYdBGoJwoVKnzYVXVMXDuLR9SI+y hKQ50DL9VrZNlI8/uiJH7zPHY4UqN/mJ/OQIB+xsvPPtBK/aKMFIWh3v5B2dFMullfW0OPlEfjUbg CninIxI4oxUUgw/vOgvfM2dK4KRjx/U3ovMY8yd4Fk1gs+9bqCsRIpaCaYEytHBPMWk1/IDAxlLXm Ru2hmQWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQtit-00000004n10-0j7n; Mon, 08 Jul 2024 19:08:27 +0000 Received: from mail-ed1-f44.google.com ([209.85.208.44]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sQtid-00000004mwv-1Kzb for linux-arm-kernel@lists.infradead.org; Mon, 08 Jul 2024 19:08:12 +0000 Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-57d05e0017aso5117418a12.1 for ; Mon, 08 Jul 2024 12:08:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720465689; x=1721070489; 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=i5VCdX60NWwfC1nVwekLYgNiGy5kNm96Cosdiq19/GM=; b=OomBrLwXwNKTSOukDM6+fnpUc9CHKuz8V8vXacA2Skmvc5cIecphSm91Y9FCagVn3i 77AQ/j9roT3Zor5bK2UJ/1LoAh6PL+iDLOFsJol6ykEL3Sr4HgMFuk7a2TgtTMAY0BCy tL9bdrEpD8aI8bOZN9+2Q1OfuOVDGw308L7mTGBlRsmVPsrkHryyFou8g1lDx+VK5kFx kpxeMLES8iLccYm9FzOoit1F+eGhLQtwoteJa8i4ilBEt4XukD9mAC35ZT/sq2D0lbxb G4tzlrcmxqRbIL09YvD2aOSGtMLjn2sZbIhnBuEstSiaHCzlmbMCWMlSJc0UgN2al+RB NlKw== X-Forwarded-Encrypted: i=1; AJvYcCWofXp4cWXnTlZTVY0giYahSebKO52zOav67b5d47JXl4q4/fyDyI0qIDE4tsJSIVhjNngMzSzyC3BhloVQHOvNgBzQ41YslIdeCNErTp/+DyC+Fp4= X-Gm-Message-State: AOJu0Ywvkf8YiLpm8oo4dPmkUo7IVckWdcCJ/WJZMwyFR2f99csKFI93 m2RTDOSRdpEsxXRaLc8rofSf4Se8U7F9ZdfDxadGy0m0UN8ymykz X-Google-Smtp-Source: AGHT+IHe2bAuF3QoVgM+CiLRff4u7OuOz5mDHUAISjnBCInvO4afmYAsw4m/dW4O/4hmNTBdmgEXYA== X-Received: by 2002:a05:6402:84d:b0:57d:12c3:eca6 with SMTP id 4fb4d7f45d1cf-594ba0ced20mr293140a12.18.1720465688385; Mon, 08 Jul 2024 12:08:08 -0700 (PDT) Received: from gmail.com (fwdproxy-lla-001.fbsv.net. [2a03:2880:30ff:1::face:b00c]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-594bda30f76sm146037a12.97.2024.07.08.12.08.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jul 2024 12:08:08 -0700 (PDT) Date: Mon, 8 Jul 2024 12:08:05 -0700 From: Breno Leitao To: Vladimir Oltean Cc: kernel test robot , linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev, kuba@kernel.org, horms@kernel.org, Roy.Pledge@nxp.com, open list Subject: Re: [PATCH 1/4] soc: fsl: qbman: FSL_DPAA depends on COMPILE_TEST Message-ID: References: <20240624162128.1665620-1-leitao@debian.org> <202406261920.l5pzM1rj-lkp@intel.com> <20240626140623.7ebsspddqwc24ne4@skbuf> <20240708133746.ea62kkeq2inzcos5@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240708133746.ea62kkeq2inzcos5@skbuf> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240708_120811_379395_B711E824 X-CRM114-Status: GOOD ( 19.25 ) 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 Mon, Jul 08, 2024 at 04:37:46PM +0300, Vladimir Oltean wrote: > On Thu, Jun 27, 2024 at 11:40:24AM -0700, Breno Leitao wrote: > > > > 454 | static int dpaa_set_coalesce(struct net_device *dev, > > > > | ^ > > > > 1 warning generated. > > > > > > Arrays of NR_CPUS elements are what it probably doesn't like? > > Can it use the number of online CPUs instead of NR_CPUS? > I don't see how, given that variable length arrays are something which > should be avoided in the kernel? I thought about a patch like the following (compile tested only). What do you think? Author: Breno Leitao Date: Mon Jul 8 11:57:33 2024 -0700 net: dpaa: Allocate only for online CPUs in dpaa_set_coalesce Currently, dpaa_set_coalesce allocates a boolean for every possible CPU (NR_CPUS). This approach is suboptimal and causes failures in COMPILE_TEST. For reference, see: https://lore.kernel.org/all/202406261920.l5pzM1rj-lkp@intel.com/ Modify the allocation to consider only online CPUs instead of NR_CPUs. This change reduces the function's memory footprint and resolves the COMPILE_TEST issues. Signed-off-by: Breno Leitao diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c index 5bd0b36d1feb..7202a5310045 100644 --- a/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_ethtool.c @@ -457,7 +457,7 @@ static int dpaa_set_coalesce(struct net_device *dev, struct netlink_ext_ack *extack) { const cpumask_t *cpus = qman_affine_cpus(); - bool needs_revert[NR_CPUS] = {false}; + bool *needs_revert; struct qman_portal *portal; u32 period, prev_period; u8 thresh, prev_thresh; @@ -466,6 +466,11 @@ static int dpaa_set_coalesce(struct net_device *dev, period = c->rx_coalesce_usecs; thresh = c->rx_max_coalesced_frames; + needs_revert = kmalloc_array(num_possible_cpus(), sizeof(bool), GFP_KERNEL); + if (!needs_revert) + return -ENOMEM; + memset(needs_revert, 0, num_online_cpus() * sizeof(bool)); + /* save previous values */ portal = qman_get_affine_portal(smp_processor_id()); qman_portal_get_iperiod(portal, &prev_period); @@ -498,6 +503,7 @@ static int dpaa_set_coalesce(struct net_device *dev, qman_dqrr_set_ithresh(portal, prev_thresh); } + kfree(needs_revert); return res; }