Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp7545141imm; Thu, 28 Jun 2018 05:40:04 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJlznuh0R5ktiPrfS96hgGsMOMHY9fpr12LQYMWM6igZpuBlBQ7YHrzIC16i9bVjUU+mvs2 X-Received: by 2002:a17:902:6b05:: with SMTP id o5-v6mr10485885plk.67.1530189604291; Thu, 28 Jun 2018 05:40:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530189604; cv=none; d=google.com; s=arc-20160816; b=B1vvxy268CkkrWiWvRiXMAtmx/r4ygmxd9xt8AYbIAhWcf+QxkWz26nmEYN5+ekT0/ uf7WHzktnd3j4bPopJAf0TgKNo5jRRaZH2CB3Rjiox6IARygZtCfpUE5deetTWWs9aGA qWb5UEmYnPnHz+N8mz27+x3at98rBftgVGeF3HUz4O6n2cZVCiU4d6E6N40qibQtAe75 Kfv4XQlubJO6a6o4zhdlx5HMO3HY8e+Go9jPmePSKx+c2+LGiZAERnuBhinOq0ly63IP MqXE5z0KQ76Fb63VE4wVHJTch6yzpP49G0e0Bgy3mGK6T0Y9TARFvNAFS5/CliOPQa0+ AHKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:to:subject:cc :arc-authentication-results; bh=7iHkkGOTNnla80wBM2ImXV3pnDPOQZssHR8q+lIvz2I=; b=aWM0K+3qG/JjRGR9TWZONfUC+9OT4uBgEIoSHpX5X/Tv2sdYL3VIr/blpNmsC8Z449 tjfFDz+ZENBJ30PP9WG0e59P4SzN3iQIXyZeHwY4oR4xBBH9cnpczPgm/cceyIPc0T2Z S9LYawdpNwWMY6Ua9fgLSWV2EXDMQhch0K1goxil95xwx5xFXD2eDdv67at/EBMA7p3C 3mGwNbMy1WC6Ew/eNZHM2rW/NjSZjDfwSCWHBwvmN3j6xKbodKfd1jv/XD6nnjCqi8bq kMMGhIYqzS9qRUDjYivoij02JG61RTUqvhRSIh+DZVUr+vkSCxDV9+DbPxuXB6GvSpbi UPkw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u195-v6si5796031pgb.443.2018.06.28.05.39.49; Thu, 28 Jun 2018 05:40:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934786AbeF1MMX (ORCPT + 99 others); Thu, 28 Jun 2018 08:12:23 -0400 Received: from foss.arm.com ([217.140.101.70]:46432 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933830AbeF1MMW (ORCPT ); Thu, 28 Jun 2018 08:12:22 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6B53780D; Thu, 28 Jun 2018 05:12:22 -0700 (PDT) Received: from [10.1.210.28] (unknown [10.1.210.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id ED4233F5C0; Thu, 28 Jun 2018 05:12:20 -0700 (PDT) Cc: Sudeep Holla , Shunyong Yang , catalin.marinas@arm.com, will.deacon@arm.com, linux-kernel@vger.kernel.org, jeremy.linton@arm.com, Joey Zheng Subject: Re: [RFC PATCH] arm64: topology: Map PPTT node offset to logic physical package id To: Andrew Jones References: <1530177508-15298-1-git-send-email-shunyong.yang@hxt-semitech.com> <20180628115748.kprobde6c3joc6ll@kamzik.brq.redhat.com> From: Sudeep Holla Organization: ARM Message-ID: Date: Thu, 28 Jun 2018 13:12:18 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180628115748.kprobde6c3joc6ll@kamzik.brq.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28/06/18 12:57, Andrew Jones wrote: > On Thu, Jun 28, 2018 at 10:38:24AM +0100, Sudeep Holla wrote: >> Hi Shunyong, >> >> On 28/06/18 10:18, Shunyong Yang wrote: >>> As PPTT spec doesn't define the physical package id, >>> find_acpi_cpu_topology_package() will return offset of the node with >>> Physical package field set when querying physical package id. So, it >>> returns 162(0xA2) in following example. >>> >>> [0A2h 0162 1] Subtable Type : 00 [Processor Hierarchy >>> Node] >>> [0A3h 0163 1] Length : 1C >>> [0A4h 0164 2] Reserved : 0000 >>> [0A6h 0166 4] Flags (decoded below) : 00000003 >>> Physical package : 1 >>> ACPI Processor ID valid : 1 >>> [0AAh 0170 4] Parent : 00000000 >>> [0AEh 0174 4] ACPI Processor ID : 00001000 >>> [0B2h 0178 4] Private Resource Number : 00000002 >>> [0B6h 0182 4] Private Resource : 0000006C >>> [0BAh 0186 4] Private Resource : 00000084 >>> >>> So, when "cat physical_package" in /sys/devices/system/cpu/cpu0/topology/, >>> it will output 162(0xA2). And if some items are added before the node >>> above, the output will change to other value. >>> >>> This patch maps the node offset to a logic package id. It maps the first >>> node offset to 0, the second to 1, and so on. >>> >>> Then, it will not output a big value, such as 162 above. And it will >>> not change when some nodes(Physical package not set) are added. >>> >>> And as long as the nodes with Physical package field set in PPTT keeps >>> the real hardware order, the logic id can map to hardware package id to >>> some extent. >>> >>> Hope to get feedback from you. >> >> Thanks for the patch, but Andrew Jones has also posted a patch[1] which >> I had a look but was not sure what is the best approach to fix it yet. >> I will think about it and respond to that. >> > > I'll send a v1 yet today. The RFC version was actually OK, as the concern > with ACPI nodes not being in the expected order wasn't actually a problem. > The thread-id or core-id would only be reset to zero when a yet to be > remapped core-id (and all its peers) was found when iterating the PEs. > Since all peers were handled at the same time, the counter reset was > correct, even when the ACPI nodes were out-of-order. The code didn't make > that very obvious, though, and there was some room for other cleanups, > so I've reworked it. Once I run it through a couple more rounds of testing > I'll repost. > OK sure. I liked the approach in Shunyong's patch. I was thinking if we can avoid the list and dynamic allocation on each addition and make it more simpler. -- Regards, Sudeep