From patchwork Tue Apr 21 18:25:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: chris hyser X-Patchwork-Id: 463451 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 0DA3414011B for ; Wed, 22 Apr 2015 04:25:51 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750946AbbDUSZu (ORCPT ); Tue, 21 Apr 2015 14:25:50 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:44669 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752621AbbDUSZt (ORCPT ); Tue, 21 Apr 2015 14:25:49 -0400 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t3LIPklW017338 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 21 Apr 2015 18:25:47 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userv0021.oracle.com (8.13.8/8.13.8) with ESMTP id t3LIPkUg017907 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Tue, 21 Apr 2015 18:25:46 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id t3LIPk1E028376; Tue, 21 Apr 2015 18:25:46 GMT Received: from [192.168.1.3] (/66.66.122.197) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 21 Apr 2015 11:25:45 -0700 Message-ID: <55369624.5040703@oracle.com> Date: Tue, 21 Apr 2015 14:25:40 -0400 From: chris hyser User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: David Miller CC: sparclinux@vger.kernel.org Subject: Re: [PATCH v3] sparc64: Setup sysfs to mark LDOM sockets, cores and threads correctly References: <5526cf9b.DFcVpFfcq8CBXHg7%chris.hyser@oracle.com> <20150409.190647.2248866190992443610.davem@davemloft.net> <20150416.154102.1660094476232520868.davem@davemloft.net> In-Reply-To: <20150416.154102.1660094476232520868.davem@davemloft.net> X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org On 4/16/2015 3:41 PM, David Miller wrote: > From: David Miller > Date: Thu, 09 Apr 2015 19:06:47 -0400 (EDT) >> How will this work on T3, T2, and T1 which all neither have the >> "socket" mdesc nodes nor level 3 caches? > > I'm still waiting for you to resolve this Chris. > > I don't think it's much effort to make this change back down > to using the level=2 cache if no level=3 cache is found. Please > implement that and resubmit. So that does appear to work. This is not the patch. I will send that out shortly but I thought I'd give you a chance to provide feedback while I'm getting that ready. Here is what I see on a T2. before: ----------------- tct2000-52> lscpu Architecture: sparc64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Big Endian CPU(s): 32 On-line CPU(s) list: 0-31 Thread(s) per core: 4 Core(s) per socket: 1 Socket(s): 8 after: ---------------------- tct2000-52> lscpu Architecture: sparc64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Big Endian CPU(s): 32 On-line CPU(s) list: 0-31 Thread(s) per core: 4 Core(s) per socket: 8 Socket(s): 1 Diff from the prior patch (I also see some cleanup here I will do): --- To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/sparc/kernel/mdesc.c b/arch/sparc/kernel/mdesc.c index 78beb94..75e2890 100644 --- a/arch/sparc/kernel/mdesc.c +++ b/arch/sparc/kernel/mdesc.c @@ -694,23 +694,26 @@ static void set_core_ids(struct mdesc_handle *hp) } } -static void set_sock_ids_by_cache(struct mdesc_handle *hp, u64 mp) +static int set_sock_ids_by_cache(struct mdesc_handle *hp, u64 mp, int level) { int idx = 1; + int fnd = 0; /* Identify unique sockets by looking for cpus backpointed to by - * level 3 caches. + * shared level n caches. */ mdesc_for_each_node_by_name(hp, mp, "cache") { - const u64 *level; + const u64 *cur_lvl; - level = mdesc_get_property(hp, mp, "level", NULL); - if (*level != 3) + cur_lvl = mdesc_get_property(hp, mp, "level", NULL); + if (*cur_lvl != level) continue; mark_sock_ids(hp, mp, idx); idx++; + fnd = 1; } + return fnd; } static void set_sock_ids_by_socket(struct mdesc_handle *hp, u64 mp) @@ -742,11 +745,12 @@ static void set_sock_ids(struct mdesc_handle *hp) u64 mp; /* If machine description exposes sockets data use it. - * Otherwise fallback to use L3 cache + * Otherwise fallback to use shared L3 or L2 caches */ mp = mdesc_node_by_name(hp, MDESC_NODE_NULL, "sockets"); if (mp == MDESC_NODE_NULL) - return set_sock_ids_by_cache(hp, mp); + if (!set_sock_ids_by_cache(hp, mp, 3)) + set_sock_ids_by_cache(hp, mp, 2); return set_sock_ids_by_socket(hp, mp); }