Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp665283lqp; Wed, 12 Jun 2024 12:21:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXiHkjanvyErihjZSHf0twdUKZCsbZn4xeB8VRx+zH6/iROwhOz56H7PaMx0KuAle44gyYqw/jm5pfMZPfQjF9eN4lwHHqtCNJg3vNQTQ== X-Google-Smtp-Source: AGHT+IFlg6e3nYYMpE034EtvJgHFy/yI4YAxMS1WTjUgeFYp6WxFqFzJNbKydXa45RuJLv7XF/do X-Received: by 2002:a17:902:a381:b0:1f8:3c9e:3ba8 with SMTP id d9443c01a7336-1f83c9e3e84mr21262715ad.10.1718220077978; Wed, 12 Jun 2024 12:21:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718220077; cv=pass; d=google.com; s=arc-20160816; b=mBHHnhmS9DN5AUDae1BjoEyl/T+jKjKiy+cohgibNByqdB2ttn22Pmu+vbCIzkOmMI 5mOtkR2qxAIW7mFPJFFkAqUyR5IbdCTUev/5Bmzo7FTA9kEiILhdOeSWPn6qtZNPNDpu rHLjExs2k25rhpc7doyMXfxd/HYcq3AhCtOgqolSeUpUauHWRze2JsdZrC+gAuXMJM06 5ZERLdvC0xN/qhPo889clxDWlkCmRe9P9jZx3DGiOZgsDD2ddm83U53ovO7hk9UHr5w8 ILECfl4OgYNGVjaD0amNOtCOGaHxKYFPXy5zh1n2TfJvTkHIUsnv+S+iISR582wpW6lU SP5Q== 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 :content-transfer-encoding:message-id:date:subject:cc:to:from :dkim-signature; bh=9Ob/qXrjqJAceSoyxB449ZMXx3laWo8V/LAGxnOiFvY=; fh=t68Fk0hqnEsiKi3W8Jy8Il4RJi5S7yO/bq9HSvXLGR8=; b=bcgiwaWvg1XqLu620l7R5Fd2skh0ipo4IoBpcAC1isMVOJf2mcwPutR+sm3UCzDFIV 5uZmmyEqeHc1WrVB30ptq4z6AMyatlE0/KiDES4OaHTfG2iT700PRTkS2hqt27vx0iHB eYg7an9lpWQW+OrZQlbGM+WrwBHEuh57TBPoo6qPfnBjXrZIgRfLaj3nztQ7jb76S8V0 Mv6Wx0q2igr7o6MEsgbPc1tBqNJ4RG2pcIX163luPHqC4Y5tuqCwrrsUz9bUo+Rsuneu ju+AUwXYj3nMx1m+ZOlks2c2GM8SRL5S9P7NaPzT19Ky10WcN9n0TTJFObjUTgpvbMhy wVqA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=AL1cUtHJ; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-212124-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212124-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1f6de6e8342si97633555ad.297.2024.06.12.12.21.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 12:21:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-212124-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=AL1cUtHJ; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-212124-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212124-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id ADC90B22951 for ; Wed, 12 Jun 2024 18:52:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5D6DE4F8BB; Wed, 12 Jun 2024 18:51:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="AL1cUtHJ" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 DF5C047A6C for ; Wed, 12 Jun 2024 18:51:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718218307; cv=none; b=e74WGoInlcskj4j8xnARYuaQ3qjd6R+ESPj46mvMfIHnfphGi7uuNKhTKOkGiR06QWuzHz1M0RBbUNN1S4aTnbczuBv4r6uP/O4kH/ConLeKrh+nxZUubOeqrnSaRN4j1CKPiwPReyyXX9t0Xb3M9Zd+Os20YKf6zRoVDzbp/7M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718218307; c=relaxed/simple; bh=frJxwcAjiFNOhQWeHaNFArt3zlqd0jqK4+vYuhq52Do=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=j3S9KDaiV9Sz1ViVN/RpXCsk4qh9dTSFJmRp0RU1Ct6ihlug02jda1PiWj/YsjT2YY0Mw5a42je2DYMZlyYymdGFSxFnbViJj0sW0VaHDCJD5eGs5ymEFzX5FjtK849PuYjAGEt6dxLUQ4aBFBeAbSVUR8u7neapblcslt9EqHY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=AL1cUtHJ; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353722.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45CI6I8i021160; Wed, 12 Jun 2024 18:51:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :to:cc:subject:date:message-id:content-transfer-encoding :mime-version; s=pp1; bh=9Ob/qXrjqJAceSoyxB449ZMXx3laWo8V/LAGxnO iFvY=; b=AL1cUtHJFTKXNwbaBrGQdFBW6szx73qKo6wnarT3H7z7KT/Z47JxY0F hzN5f7ECicPi2FuidPTsJ7t6S5TRVQugAxomrw+Rr6gG7zt633H1g7gQ3FjH9bx3 HjJKxTGx2DjvkCzok1ah5jSTu4z8j1KXsh/49HI6VofUmrVm5xNF7N1+Oe4+jiQT oAAYrbQCaVI4hJ7+Uvh9plmoXO04vDSt4N4dTffWb8d61M7XCJOTkcqW3svHM8Wk cQmNQ/hR0mqOf2t31MhXUOP6D3ueFBbm5Hs3m+3axeJBb7Dltv2J7N+7u3aAzPpq 2iKEqhkCer76jXI1s7SWttXmEfs8Akw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqg490761-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Jun 2024 18:51:15 +0000 (GMT) Received: from m0353722.ppops.net (m0353722.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45CIpFXU020173; Wed, 12 Jun 2024 18:51:15 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3yqg49075y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Jun 2024 18:51:15 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45CHfX85023575; Wed, 12 Jun 2024 18:51:14 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 3yn3umreek-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 12 Jun 2024 18:51:14 +0000 Received: from smtpav04.fra02v.mail.ibm.com (smtpav04.fra02v.mail.ibm.com [10.20.54.103]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45CIp8js49283424 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Jun 2024 18:51:10 GMT Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8E1E020040; Wed, 12 Jun 2024 18:51:08 +0000 (GMT) Received: from smtpav04.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 62B3E2004E; Wed, 12 Jun 2024 18:51:05 +0000 (GMT) Received: from li-80eaad4c-2afd-11b2-a85c-af8123d033e3.ibm.com (unknown [9.124.218.62]) by smtpav04.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 12 Jun 2024 18:51:05 +0000 (GMT) From: "Nysal Jan K.A." To: Michael Ellerman , Thomas Gleixner Cc: Tyrel Datwyler , Michal Suchanek , "Nysal Jan K.A" , Nicholas Piggin , Christophe Leroy , "Naveen N. Rao" , Peter Zijlstra , Laurent Dufour , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/2] Skip offline cores when enabling SMT on PowerPC Date: Thu, 13 Jun 2024 00:20:36 +0530 Message-ID: <20240612185046.1826891-1-nysal@linux.ibm.com> X-Mailer: git-send-email 2.45.1 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: A8EvnlEsFP_fq-jmA-CGzT_5k9TZM_oG X-Proofpoint-ORIG-GUID: 2qjCPoA-xRvzEyff9YZjmR_nt2ylZ3Ry Content-Transfer-Encoding: 8bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-12_09,2024-06-12_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 priorityscore=1501 malwarescore=0 phishscore=0 mlxscore=0 mlxlogscore=901 impostorscore=0 suspectscore=0 spamscore=0 clxscore=1011 bulkscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405170001 definitions=main-2406120131 From: "Nysal Jan K.A" After the addition of HOTPLUG_SMT support for PowerPC [1] there was a regression reported [2] when enabling SMT. On a system with at least one offline core, when enabling SMT, the expectation is that no CPUs of offline cores are made online. On a POWER9 system with 4 cores in SMT4 mode: $ ppc64_cpu --info Core 0: 0* 1* 2* 3* Core 1: 4* 5* 6* 7* Core 2: 8* 9* 10* 11* Core 3: 12* 13* 14* 15* Turn only one core on: $ ppc64_cpu --cores-on=1 $ ppc64_cpu --info Core 0: 0* 1* 2* 3* Core 1: 4 5 6 7 Core 2: 8 9 10 11 Core 3: 12 13 14 15 Change the SMT level to 2: $ ppc64_cpu --smt=2 $ ppc64_cpu --info Core 0: 0* 1* 2 3 Core 1: 4 5 6 7 Core 2: 8 9 10 11 Core 3: 12 13 14 15 As expected we see only two CPUs of core 0 are online Change the SMT level to 4: $ ppc64_cpu --smt=4 $ ppc64_cpu --info Core 0: 0* 1* 2* 3* Core 1: 4* 5* 6* 7* Core 2: 8* 9* 10* 11* Core 3: 12* 13* 14* 15* The CPUs of offline cores are made online. If a core is offline then enabling SMT should not online CPUs of this core. An arch specific function topology_is_core_online() is proposed to address this. Another approach is to check the topology_sibling_cpumask() for any online siblings. This avoids the need for an arch specific function but is less efficient and more importantly this introduces a change in existing behaviour on other architectures. What is the expected behaviour on x86 when enabling SMT and certain cores are offline? [1] https://lore.kernel.org/lkml/20230705145143.40545-1-ldufour@linux.ibm.com/ [2] https://groups.google.com/g/powerpc-utils-devel/c/wrwVzAAnRlI/m/5KJSoqP4BAAJ Nysal Jan K.A (2): cpu/SMT: Enable SMT only if a core is online powerpc/topology: Check if a core is online arch/powerpc/include/asm/topology.h | 13 +++++++++++++ kernel/cpu.c | 12 +++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) base-commit: c760b3725e52403dc1b28644fb09c47a83cacea6 -- 2.35.3