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 X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90CEAC433E0 for ; Fri, 31 Jul 2020 08:02:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6A8B8207F5 for ; Fri, 31 Jul 2020 08:02:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ellerman.id.au header.i=@ellerman.id.au header.b="pPeyl5/N" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731746AbgGaIC0 (ORCPT ); Fri, 31 Jul 2020 04:02:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731479AbgGaIC0 (ORCPT ); Fri, 31 Jul 2020 04:02:26 -0400 Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2C36C061574 for ; Fri, 31 Jul 2020 01:02:25 -0700 (PDT) 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 ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4BJ0B64wr3z9sTM; Fri, 31 Jul 2020 18:02:22 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ellerman.id.au; s=201909; t=1596182544; bh=VIvlFmLeEbazI6X4NrR2A4yECMiZVAa1vCybgh1Mduk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=pPeyl5/NlC4K+MRg9yrpan6haPOfQboM84UFywQ+27jiRB4Must46goJhWYfneqsu 1XXxWssioctiie7J4pqqq0j82L9DowqWmz/t5CPrb04JcnDIB8+MYnCSISCaX21r7k u0f8C5XhEMU79kJe5jmL2nHyQhxBumAeP01uS22XlMe6bvgDDHBgUidQhfXSV/KSPF 9Wy8MWamdDLnJ6rQ0ioFp+OyTSVYKlmmCtUaliXRwX4vX35GGhe904HqzGmXuYeTSZ LIsPpgbPzfc+9O6W5OdjiOM5lL8D++64sV6bPTGp3qeOYvcGW/o4f01d+qd4iZlNQw lA8SX9b6z+spw== From: Michael Ellerman To: Srikar Dronamraju Cc: linuxppc-dev , Srikar Dronamraju , LKML , Nicholas Piggin , Anton Blanchard , Oliver O'Halloran , Nathan Lynch , Michael Neuling , Gautham R Shenoy , Ingo Molnar , Peter Zijlstra , Valentin Schneider , Jordan Niethe Subject: Re: [PATCH v4 10/10] powerpc/smp: Implement cpu_to_coregroup_id In-Reply-To: <20200727053230.19753-11-srikar@linux.vnet.ibm.com> References: <20200727053230.19753-1-srikar@linux.vnet.ibm.com> <20200727053230.19753-11-srikar@linux.vnet.ibm.com> Date: Fri, 31 Jul 2020 18:02:21 +1000 Message-ID: <87wo2k3yeq.fsf@mpe.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Srikar Dronamraju writes: > Lookup the coregroup id from the associativity array. It's slightly strange that this is called in patch 9, but only properly implemented here in patch 10. I'm not saying you have to squash them together, but it would be good if the change log for patch 9 mentioned that a subsequent commit will complete the implementation and how that affects the behaviour. cheers > If unable to detect the coregroup id, fallback on the core id. > This way, ensure sched_domain degenerates and an extra sched domain is > not created. > > Ideally this function should have been implemented in > arch/powerpc/kernel/smp.c. However if its implemented in mm/numa.c, we > don't need to find the primary domain again. > > If the device-tree mentions more than one coregroup, then kernel > implements only the last or the smallest coregroup, which currently > corresponds to the penultimate domain in the device-tree. > > Cc: linuxppc-dev > Cc: LKML > Cc: Michael Ellerman > Cc: Nicholas Piggin > Cc: Anton Blanchard > Cc: Oliver O'Halloran > Cc: Nathan Lynch > Cc: Michael Neuling > Cc: Gautham R Shenoy > Cc: Ingo Molnar > Cc: Peter Zijlstra > Cc: Valentin Schneider > Cc: Jordan Niethe > Reviewed-by : Gautham R. Shenoy > Signed-off-by: Srikar Dronamraju > --- > Changelog v1 -> v2: > Move coregroup_enabled before getting associativity (Gautham) > > arch/powerpc/mm/numa.c | 20 ++++++++++++++++++++ > 1 file changed, 20 insertions(+) > > diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c > index 0d57779e7942..8b3b3ec7fcc4 100644 > --- a/arch/powerpc/mm/numa.c > +++ b/arch/powerpc/mm/numa.c > @@ -1218,6 +1218,26 @@ int find_and_online_cpu_nid(int cpu) > > int cpu_to_coregroup_id(int cpu) > { > + __be32 associativity[VPHN_ASSOC_BUFSIZE] = {0}; > + int index; > + > + if (cpu < 0 || cpu > nr_cpu_ids) > + return -1; > + > + if (!coregroup_enabled) > + goto out; > + > + if (!firmware_has_feature(FW_FEATURE_VPHN)) > + goto out; > + > + if (vphn_get_associativity(cpu, associativity)) > + goto out; > + > + index = of_read_number(associativity, 1); > + if (index > min_common_depth + 1) > + return of_read_number(&associativity[index - 1], 1); > + > +out: > return cpu_to_core_id(cpu); > } > > -- > 2.17.1