Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp41964lqe; Fri, 5 Apr 2024 11:57:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWlXYI061DKCR+mjyea7ZkCL0kHYMit8kd27VfFF3/Zji3qUy3aEIB6g/CaGAsr3rn3qOSeW6nh3UAShG6SlRqOQBx4ZT0rlF7bSoMa4w== X-Google-Smtp-Source: AGHT+IGAjyw+JF32+cXJROkEB9KT7SHxMRPwh31XyP35XC0K9tGV0naLzKtq2vExxh9uKxNKzXMw X-Received: by 2002:a17:90b:30c2:b0:29d:eea9:c800 with SMTP id hi2-20020a17090b30c200b0029deea9c800mr2004363pjb.7.1712343456865; Fri, 05 Apr 2024 11:57:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712343456; cv=pass; d=google.com; s=arc-20160816; b=amavyKcDFeBI5H2/2vRFstJIGrkBL3Q24bwor8IYhAFvhn8RxIDkFifrhCHqyoixcQ B9Hm4pE5p9blZ0pP797kt+dZMnw6kHQmc65f9Siqis/0mrGrwz3duD7T2zHtTWlHa87w PTHLiWq+cbfw7+3W/2wde07Pv3EmlgexHsMh9GXtSFAbLASdpyWQgoYtuB4D9WIzvnxm fDsTuGB0ggpGO7QHDiI+zSGkEuXEtGnalfVtUmE6FTwWv5RaW7GNsTmVKahNKBYOR9kI 7n0VGNP/gTAGIzO/hE8pIWXzPAgMB5rkZZE0mWvd/UKOdrdrGhM9aWxpWDRSwGF8vVQH eyOw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:date:cc:to:from:subject :message-id:dkim-signature; bh=wPdvei4itXRqvsvlShaOrLg+41Ce6iTgGJoyJMM/egM=; fh=9bfK85rwoJvTDaZNuB8/s11gapf83NaVUB4FrlwoLjY=; b=kPos2ProphYGhM/Y+6DaKKjyYS0IV3uc+8cMs/z3kBdfyWvai/gsaEC8uhheMCZicK gUZkKaZf2/+khVDM1K5M4kP+sBvGSDwbcckrNjhDG7PkovanjN9jnmQpjfN6ohvX2E5L zfX9O4PZ7fhlkdXpY61U/4OmuQlNkSby2zK9P2O9C4fY01G6VU/BImc+BhtaiR7m42f9 qa5UBpuxeP9tyQVVWetfejpoglPd6658/AUK8J03AuIVWWm5itUQOAfoC1a0PHy9KBWW kLhzhwhHi73b2WGFmmcXuNsJPK/n7DVrlHTyTTU6G0Nl5P58GomZajnkXKi8phCeb71q A99g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=S+5e6+2l; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-crypto+bounces-3372-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-3372-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b9-20020a17090ae38900b002a28ed784cdsi1870160pjz.166.2024.04.05.11.57.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Apr 2024 11:57:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-3372-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=S+5e6+2l; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-crypto+bounces-3372-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-3372-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 87086283BE4 for ; Fri, 5 Apr 2024 18:57:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8C1D6172BA0; Fri, 5 Apr 2024 18:57:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="S+5e6+2l" X-Original-To: linux-crypto@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8934617279E; Fri, 5 Apr 2024 18:57:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712343454; cv=none; b=A4vVnFuAEdOmA+KZr2+/lAC7nQPwhYOqouuUMYC/m55sA9p6meNDitkWGJ1NFoDJz1OnEcf8iZ2kWozOJw6r83XXkEyDR4fYhnYnF3MKAYFMwdoeC3u0xUZdo9ZVyMQMR4iYRkR4suAbCMFwdgOKlz80Z08GRwYOuNWDqO7BOe8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712343454; c=relaxed/simple; bh=LnamEoZaR3iwKuwi0MrPtYbjJA5iVWtngHBMfSeCOnc=; h=Message-ID:Subject:From:To:Cc:Date:Content-Type:MIME-Version; b=SaVewlGbXl/+CUkc4xe4OLGTMy7dN6zebgeNRAX6XM4ydtr7IODBzPG729S6iMQykUSTmWoFN/h/o+ApfpFCswbhCSxEHKHwHA1spL2QqFGpHuO0LtNbENy2h/2F2eLGJgUnDagYkR16P0k6u1F3nbJfNbELNQeZUwr2nwbZXk4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=S+5e6+2l; arc=none smtp.client-ip=198.175.65.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712343453; x=1743879453; h=message-id:subject:from:to:cc:date: content-transfer-encoding:mime-version; bh=LnamEoZaR3iwKuwi0MrPtYbjJA5iVWtngHBMfSeCOnc=; b=S+5e6+2lylHUY1+aSCn5b3LDBG2DhrIHZCpQPhYP8HOmZIUkhlIXtEHu gCAfKKnmDhU/Mt7gXPc6eE50esYYKLOd8sHTDYQGDrsM+9+MXe73th1mM 6zPbySyJOu6ad5CjV86ObjkIhEx4MSI5zCqd6KBkLp8byTeL0a9Cf/YfC XP2hjgqIfe72pfXUHCa6g13EUb/bcxYzYzPuC+mQmVFc4Cty1EV72mJbo YDs0aIBKxDstE26pAsgy3G6eXO4+Vnj9FBkWtiQLXUuKwyglwomQw0IaZ B8++6TMx9gNQvek7FlgowkgvScG2jmuNcw/fFxH7xaxW6WHor7GxEz64Z g==; X-CSE-ConnectionGUID: ZRCEN42HQF6yaO6UWKtSEQ== X-CSE-MsgGUID: NDAFJe+SRLibMf6AQxtA9w== X-IronPort-AV: E=McAfee;i="6600,9927,11035"; a="30168079" X-IronPort-AV: E=Sophos;i="6.07,181,1708416000"; d="scan'208";a="30168079" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Apr 2024 11:57:32 -0700 X-CSE-ConnectionGUID: WVTk02faR+GSXUEVAchgYw== X-CSE-MsgGUID: 6tmd2CxkTNygQJMwk8i/Bg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,181,1708416000"; d="scan'208";a="19275901" Received: from yessieki-mobl.amr.corp.intel.com ([10.212.83.7]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Apr 2024 11:57:31 -0700 Message-ID: Subject: [PATCH] crypto: iaa - Use cpumask_weight() when rebalancing From: Tom Zanussi To: Herbert Xu Cc: davem@davemloft.net, linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org Date: Fri, 05 Apr 2024 13:57:30 -0500 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4-0ubuntu2 Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 If some cpus are offlined, or if the node mask is smaller than expected, the 'nonexistent cpu' warning in rebalance_wq_table() may be erroneously triggered. Use cpumask_weight() to make sure we only iterate over the exact number of cpus in the mask. Also use num_possible_cpus() instead of num_online_cpus() to make sure all slots in the wq table are initialized. Signed-off-by: Tom Zanussi --- drivers/crypto/intel/iaa/iaa_crypto_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/intel/iaa/iaa_crypto_main.c b/drivers/crypto/in= tel/iaa/iaa_crypto_main.c index 6229b24b0d35..814fb2c31626 100644 --- a/drivers/crypto/intel/iaa/iaa_crypto_main.c +++ b/drivers/crypto/intel/iaa/iaa_crypto_main.c @@ -922,7 +922,7 @@ static void rebalance_wq_table(void) for_each_node_with_cpus(node) { node_cpus =3D cpumask_of_node(node); =20 - for (cpu =3D 0; cpu < nr_cpus_per_node; cpu++) { + for (cpu =3D 0; cpu < cpumask_weight(node_cpus); cpu++) { int node_cpu =3D cpumask_nth(cpu, node_cpus); =20 if (WARN_ON(node_cpu >=3D nr_cpu_ids)) { @@ -2005,7 +2005,7 @@ static int __init iaa_crypto_init_module(void) int ret =3D 0; int node; =20 - nr_cpus =3D num_online_cpus(); + nr_cpus =3D num_possible_cpus(); for_each_node_with_cpus(node) nr_nodes++; if (!nr_nodes) { --=20 2.38.1