Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp78297lqs; Thu, 13 Jun 2024 04:34:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVg3sgOFk/CswjXt3cwamER5ybIgaLAkFLOyye+6RtYvIuZEYm2Rbi570e2fWzhE9laypldEeJfhZCqPLxhjpegpkhxYgsnp+HPITrbtQ== X-Google-Smtp-Source: AGHT+IHjMjqAXW6sAZiHFCD7oHS8GmjkxNzvwI20zlxCvPCajH5DGUaXprWkVLXMIdCN0vQM61lR X-Received: by 2002:a17:902:e806:b0:1f6:f82d:a8de with SMTP id d9443c01a7336-1f83b68cb62mr52512875ad.38.1718278463560; Thu, 13 Jun 2024 04:34:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718278463; cv=pass; d=google.com; s=arc-20160816; b=dIMiXvJ+P6QLsOOJKzo44i0CeVyu5KjJpV7QLSWcjOgquTqFFkmqJ7NfrVATluzh12 p56H8vyh/baaqQIvjL/3kzD+tSPKTLkN+KqS6/6wuJDExAwIkXfiG3eVKy7KaG6+dx4L dMMXmxdFbS9otBrpIGJHKvOJaRsS7HXpz5UHVpXfE5KTeksy6ZnX2EAubHe2Wpr3jR23 M3t2o9G1PBDewJYl9u2MyMv8noStoiv5qyBCS07BB3ikczn/H9F70ZX6c9NAdGteFuZr kuWW/rQcySBk9868+FLIcQNOizSU8UuPhGQ946Brg1lBZe9bt3qkoe29aUXCZ+NcN5jZ Mpcw== 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 :message-id:date:references:in-reply-to:subject:cc:to:from :dkim-signature; bh=1z2hwHmg3zI5iDN7nSTa67ma/S6hUmgaCaCPmbI3jNE=; fh=49t7NIernG5qIIJfbWJ21SeCc/EscZ+2UKo18TtgGWo=; b=EQtIuVsk/KH/1fVXsi8mgkTH2C58RBhYV1mT4NSPvb+eF0SkRYOw/RAlHspM7Zc0Ae lEjNDQ2x77FsK7yj+ZXoKdW4glrhADkACC67KbUfpZiydr75uQC31J0XBVY3nQdx6WjZ O4uQTkdiMLrVFpY3hQKb+chQfwBuO4MnfoWMFk/CuMVl88oCcwFvp3d1FTTRhgDOeKY8 fL72Q6FFbYeWwllnCCjWu+R58YAgb9RpoKtjO5HhRond2RtTy9IMEn9fkHOokFTJyudH 3jJsiawLpeFX2AL/j4CdHNzypxONsUMFRared4Ts6TakkKjSIFYAzNZKwAshlxPs2XH0 s3tA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=dsezFuET; arc=pass (i=1 spf=pass spfdomain=ellerman.id.au dkim=pass dkdomain=ellerman.id.au); spf=pass (google.com: domain of linux-kernel+bounces-213098-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213098-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f855ecea79si11482065ad.223.2024.06.13.04.34.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 04:34:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213098-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ellerman.id.au header.s=201909 header.b=dsezFuET; arc=pass (i=1 spf=pass spfdomain=ellerman.id.au dkim=pass dkdomain=ellerman.id.au); spf=pass (google.com: domain of linux-kernel+bounces-213098-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213098-linux.lists.archive=gmail.com@vger.kernel.org" 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 35B13285897 for ; Thu, 13 Jun 2024 11:34:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 72DC7142E99; Thu, 13 Jun 2024 11:34:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b="dsezFuET" Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (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 7F9BD1422B5 for ; Thu, 13 Jun 2024 11:34:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=150.107.74.76 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718278456; cv=none; b=IF1iX3JFa5M1noVFABv6R6YhKbvOTShuHjQ5XiHEbQJNHHzGNZcJpRGYRe0kqoSaxXrbskZO40Ggurlm2Rve/zxcEgaGsT7XYMors1blNKDAiL4g0ilqHfxEXLm7Ymmq4jTuIOoayPgEaKMQ2NtxEK0eUCl0GIKJX9HIH3R0U3g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718278456; c=relaxed/simple; bh=cSldylOADan04Rn9YvO2UHvgx9cydhYHmv6mP+L6OXM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=EUKzenbxMrcXvsKwuELcy2SSTxZ8xWbvqfqJfzwzZgGPUZL86WCMdUA/J8H/anIuNGhMRt3zz+pgcT+5NIhbs3wzd2B5YgtEIvvYLFDzCYR88NEglUqjx1BiqTJWWzFOHy5joIhtwbOa0yHKdAImDwKF4mqZpS5BlSvBKTRrIA0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au; spf=pass smtp.mailfrom=ellerman.id.au; dkim=pass (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b=dsezFuET; arc=none smtp.client-ip=150.107.74.76 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ellerman.id.au DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1718278451; bh=1z2hwHmg3zI5iDN7nSTa67ma/S6hUmgaCaCPmbI3jNE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=dsezFuET6MQptgoIk4Rz2FdLfx112u9Qx789Kb6J4Llwv43suNMkBgJJQYDjUaf9q 9PMwVN7VPdH247bgCo1MtVFVRMvX9fR6R77cwc5faN800byW7JZ3yd4LEAg1R352Za GU2G8AD91GMmg4rc9l/tuhy8UCB4yoFI1Fii2QrtjRvJM9MTy3xamznmntrzLqAHHb HhxI6DCtBAo9qAO13nYTcavzOmCFWaiRW3wb1ls8xA1LodFnSv8bpxNI+KoAEzNxvw ndZyvDgLKpZ/Uwiu7IVXY9PytAJ77PvqQwUHX+Wx4c7Ia/Euss5oBGDBynHlU7wdUY 63G7z56OX18aA== Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4W0L0L4qfsz4wcJ; Thu, 13 Jun 2024 21:34:10 +1000 (AEST) From: Michael Ellerman To: "Nysal Jan K.A." , 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: Re: [PATCH 0/2] Skip offline cores when enabling SMT on PowerPC In-Reply-To: <20240612185046.1826891-1-nysal@linux.ibm.com> References: <20240612185046.1826891-1-nysal@linux.ibm.com> Date: Thu, 13 Jun 2024 21:34:10 +1000 Message-ID: <875xudoz4d.fsf@mail.lhotse> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain "Nysal Jan K.A." writes: > From: "Nysal Jan K.A" > > After the addition of HOTPLUG_SMT support for PowerPC [1] there was a > regression reported [2] when enabling SMT. This implies it was a kernel regression. But it can't be a kernel regression because previously there was no support at all for the sysfs interface on powerpc. IIUIC the regression was in the ppc64_cpu userspace tool, which switched to using the new kernel interface without taking into account the way it behaves. Or are you saying the kernel behaviour changed on x86 after the powerpc HOTPLUG_SMT was added? > 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. That's the way the ppc64_cpu tool behaves, but it's not necessarily what other arches want. > 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. It's only x86 and powerpc right? Having different behaviour on the only two arches that support the interface does not seem like a good result. > What is the expected behaviour on x86 when enabling SMT and certain cores > are offline? AFAIK no one really touches SMT on x86 other than to turn it off for security reasons. cheers > [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