lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1FE6DD409037234FAB833C420AA843EC0138200C@orsmsx424.amr.corp.intel.com>
Date:	Tue, 29 Apr 2008 15:32:46 -0700
From:	"Luck, Tony" <tony.luck@...el.com>
To:	"Alex Chiang" <achiang@...com>, <lenb@...nel.org>,
	<linux-ia64@...r.kernel.org>, <linux-acpi@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 2/2] ia64: Provide ACPI fixup for /proc/cpuinfo/physical_id

Alex,

I chewed on this a bit ... 
 
+void ia64_fix_socket_id(int num, u32 slot)
+{
+	if (cpu_data(num)->socket_id == -1)
+		cpu_data(num)->socket_id= slot;
+}
+EXPORT_SYMBOL_GPL(ia64_fix_socket_id);

1) socket_id is only defined when CONFIG_SMP=y, so this breaks UP
   build.  Fix: Wrap body of this function inside #ifdef
2) should really just name this function "arch_fix_phys_package_id"
   and avoid the #define rename in topology.h


diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
+	/*
+	 * If ACPI describes a slot number for this CPU, we can use it
+	 * to fix a broken topology->physical_package_id.
+	 */
+	status = acpi_evaluate_object(pr->handle, "_SUN", NULL, &buffer);
+	if (ACPI_SUCCESS(status))
+		arch_fix_phys_package_id(pr->id, object.integer.value);
+

Comment here still refers to what the previous patch was doing. Should
now say that we are fixing /proc/cpuinfo "physical id".
 
diff --git a/include/asm-ia64/topology.h b/include/asm-ia64/topology.h
+#define arch_fix_phys_package_id(num, slot)	ia64_fix_socket_id(num, slot)

Not needed if we name ia64_fix_socket_id() appropriately. Turn this
into an extern definition for arch_fix_phys_package_id() and drop the
extern from cpu.h

diff --git a/include/asm-x86/topology.h b/include/asm-x86/topology.h
+#define arch_fix_phys_package_id(num, slot)

Style preference is to now use a "static inline void" function for
this to make sure args are correctly typed, and to avoid warnings about
unused variables.

updated version of the patch looks like this ... ok???

-Tony

commit fe086a7bea7ab714930bd48addba961ceeef7634
Author: Alex Chiang <achiang@...com>
Date:   Tue Apr 29 15:05:29 2008 -0700

    [IA64] Provide ACPI fixup for /proc/cpuinfo/physical_id
    
    Legacy HP ia64 platforms currently cannot provide
    /proc/cpuinfo/physical_id due to legacy SAL/PAL implementations.
    However, that physical topology information can be obtained
    via ACPI.
    
    Provide an interface that gives ACPI one last chance to provide
    physical_id for these legacy platforms. This logic only comes
    into play iff:
    
    - ACPI actually provides slot information for the CPU
    - we lack a valid socket_id
    
    Otherwise, we don't do anything.
    
    Since x86 uses the ACPI processor driver as well, we provide a nop
    stub function for arch_fix_phys_package_id() in asm-x86/topology.h
    
    Signed-off-by: Alex Chiang <achiang@...com>
    Signed-off-by: Tony Luck <tony.luck@...el.com>

diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c
index a2484fc..abb17a6 100644
--- a/arch/ia64/kernel/topology.c
+++ b/arch/ia64/kernel/topology.c
@@ -27,6 +27,15 @@
 
 static struct ia64_cpu *sysfs_cpus;
 
+void arch_fix_phys_package_id(int num, u32 slot)
+{
+#ifdef CONFIG_SMP
+	if (cpu_data(num)->socket_id == -1)
+		cpu_data(num)->socket_id = slot;
+#endif
+}
+EXPORT_SYMBOL_GPL(arch_fix_phys_package_id);
+
 int arch_register_cpu(int num)
 {
 #if defined (CONFIG_ACPI) && defined (CONFIG_HOTPLUG_CPU)
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
index dd28c91..5241e3f 100644
--- a/drivers/acpi/processor_core.c
+++ b/drivers/acpi/processor_core.c
@@ -603,6 +603,15 @@ static int acpi_processor_get_info(struct acpi_processor *pr, unsigned has_uid)
 		request_region(pr->throttling.address, 6, "ACPI CPU throttle");
 	}
 
+	/*
+	 * If ACPI describes a slot number for this CPU, we can use it
+	 * ensure we get the right value in the "physical id" field
+	 * of /proc/cpuinfo
+	 */
+	status = acpi_evaluate_object(pr->handle, "_SUN", NULL, &buffer);
+	if (ACPI_SUCCESS(status))
+		arch_fix_phys_package_id(pr->id, object.integer.value);
+
 	return 0;
 }
 
diff --git a/include/asm-ia64/topology.h b/include/asm-ia64/topology.h
index f2f72ef..32863b3 100644
--- a/include/asm-ia64/topology.h
+++ b/include/asm-ia64/topology.h
@@ -116,6 +116,8 @@ void build_cpu_to_node_map(void);
 #define smt_capable() 				(smp_num_siblings > 1)
 #endif
 
+extern void arch_fix_phys_package_id(int num, u32 slot);
+
 #define pcibus_to_cpumask(bus)	(pcibus_to_node(bus) == -1 ? \
 					CPU_MASK_ALL : \
 					node_to_cpumask(pcibus_to_node(bus)) \
diff --git a/include/asm-x86/topology.h b/include/asm-x86/topology.h
index 0e6d6b0..4f35a0f 100644
--- a/include/asm-x86/topology.h
+++ b/include/asm-x86/topology.h
@@ -193,6 +193,10 @@ extern cpumask_t cpu_coregroup_map(int cpu);
 #define topology_thread_siblings(cpu)		(per_cpu(cpu_sibling_map, cpu))
 #endif
 
+static inline void arch_fix_phys_package_id(int num, u32 slot)
+{
+}
+
 struct pci_bus;
 void set_pci_bus_resources_arch_default(struct pci_bus *b);
 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ