public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Subject: [patch 08/15] Add topology_core_siblings to topology.h
Date: Tue, 29 Apr 2008 16:01:25 +0200	[thread overview]
Message-ID: <20080429140250.553361834@de.ibm.com> (raw)
In-Reply-To: 20080429140117.631962807@de.ibm.com

[-- Attachment #1: 008-nodes-s390-siblings.diff --]
[-- Type: text/plain, Size: 2514 bytes --]

From: Heiko Carstens <heiko.carstens@de.ibm.com>

This exposes the core siblings to user space via sysfs.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>

---

 arch/s390/kernel/topology.c |   21 ++++++++++++++++++---
 include/asm-s390/topology.h |    4 ++++
 2 files changed, 22 insertions(+), 3 deletions(-)

Index: quilt-2.6/arch/s390/kernel/topology.c
===================================================================
--- quilt-2.6.orig/arch/s390/kernel/topology.c
+++ quilt-2.6/arch/s390/kernel/topology.c
@@ -66,6 +66,8 @@ static struct timer_list topology_timer;
 static void set_topology_timer(void);
 static DECLARE_WORK(topology_work, topology_work_fn);
 
+cpumask_t cpu_core_map[NR_CPUS];
+
 cpumask_t cpu_coregroup_map(unsigned int cpu)
 {
 	struct core_info *core = &core_info;
@@ -199,6 +201,14 @@ int topology_set_cpu_management(int fc)
 	return rc;
 }
 
+static void update_cpu_core_map(void)
+{
+	int cpu;
+
+	for_each_present_cpu(cpu)
+		cpu_core_map[cpu] = cpu_coregroup_map(cpu);
+}
+
 void arch_update_cpu_topology(void)
 {
 	struct tl_info *info = tl_info;
@@ -206,11 +216,13 @@ void arch_update_cpu_topology(void)
 	int cpu;
 
 	if (!machine_has_topology) {
+		update_cpu_core_map();
 		topology_update_polarization_simple();
 		return;
 	}
 	stsi(info, 15, 1, 2);
 	tl_to_cores(info);
+	update_cpu_core_map();
 	for_each_online_cpu(cpu) {
 		sysdev = get_cpu_sysdev(cpu);
 		kobject_uevent(&sysdev->kobj, KOBJ_CHANGE);
@@ -251,20 +263,23 @@ static int __init init_topology_update(v
 {
 	int rc;
 
+	rc = 0;
 	if (!machine_has_topology) {
 		topology_update_polarization_simple();
-		return 0;
+		goto out;
 	}
 	init_timer_deferrable(&topology_timer);
 	if (machine_has_topology_irq) {
 		rc = register_external_interrupt(0x2005, topology_interrupt);
 		if (rc)
-			return rc;
+			goto out;
 		ctl_set_bit(0, 8);
 	}
 	else
 		set_topology_timer();
-	return 0;
+out:
+	update_cpu_core_map();
+	return rc;
 }
 __initcall(init_topology_update);
 
Index: quilt-2.6/include/asm-s390/topology.h
===================================================================
--- quilt-2.6.orig/include/asm-s390/topology.h
+++ quilt-2.6/include/asm-s390/topology.h
@@ -7,6 +7,10 @@
 
 cpumask_t cpu_coregroup_map(unsigned int cpu);
 
+extern cpumask_t cpu_core_map[NR_CPUS];
+
+#define topology_core_siblings(cpu)	(cpu_core_map[cpu])
+
 int topology_set_cpu_management(int fc);
 void topology_schedule_update(void);
 

-- 
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.


  parent reply	other threads:[~2008-04-29 14:19 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-29 14:01 [patch 00/15] 2nd batch of s390 patches for 2.6.26 Martin Schwidefsky
2008-04-29 14:01 ` [patch 01/15] cio: Use strict_strtoul() for attributes Martin Schwidefsky
2008-04-29 14:01 ` [patch 02/15] Move show_regs to traps.c Martin Schwidefsky
2008-04-29 14:01 ` [patch 03/15] Add missing ifndef/define to include/asm-s390/sysinfo.h Martin Schwidefsky
2008-04-29 14:01 ` [patch 04/15] smp: Fix locking order Martin Schwidefsky
2008-04-29 14:01 ` [patch 05/15] Automatically detect added cpus Martin Schwidefsky
2008-04-29 14:01 ` [patch 06/15] remove -traditional Martin Schwidefsky
2008-04-29 14:01 ` [patch 07/15] cio: Make isc handling more robust Martin Schwidefsky
2008-04-29 14:01 ` Martin Schwidefsky [this message]
2008-04-29 14:01 ` [patch 09/15] cpu topology: Fix possible deadlock Martin Schwidefsky
2008-04-29 14:01 ` [patch 10/15] uaccess_mvcos: #ifdef config dependent code Martin Schwidefsky
2008-04-29 14:01 ` [patch 11/15] Move stfl to system.h and delete duplicated version Martin Schwidefsky
2008-04-29 14:01 ` [patch 12/15] vmemmap: use clear_table to initialise page tables Martin Schwidefsky
2008-04-29 14:01 ` [patch 13/15] Convert machine feature detection code to C Martin Schwidefsky
2008-04-29 14:01 ` [patch 14/15] System z large page support Martin Schwidefsky
2008-04-29 14:01 ` [patch 15/15] Convert to SPARSEMEM & SPARSEMEM_VMEMMAP Martin Schwidefsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080429140250.553361834@de.ibm.com \
    --to=schwidefsky@de.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox