From patchwork Thu Oct 19 08:02:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Gleixner X-Patchwork-Id: 10016163 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2D35B602C8 for ; Thu, 19 Oct 2017 08:03:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FC6628C73 for ; Thu, 19 Oct 2017 08:03:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1381428C82; Thu, 19 Oct 2017 08:03:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93CAA28C73 for ; Thu, 19 Oct 2017 08:03:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751854AbdJSIDk (ORCPT ); Thu, 19 Oct 2017 04:03:40 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:59989 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751711AbdJSIDi (ORCPT ); Thu, 19 Oct 2017 04:03:38 -0400 Received: from hsi-kbw-5-158-153-52.hsi19.kabel-badenwuerttemberg.de ([5.158.153.52] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1e55mx-0003c8-OJ; Thu, 19 Oct 2017 10:02:47 +0200 Date: Thu, 19 Oct 2017 10:02:50 +0200 (CEST) From: Thomas Gleixner To: Guenter Roeck cc: Shu Wang , fenghua yu , jdelvare@suse.com, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, chuhu@redhat.com, yizhan@redhat.com Subject: Re: [PATCH] hwmon: (coretemp) remove duplicated coretemp for same core id In-Reply-To: <20d0960f-e77a-8ee7-0205-707de46d034d@roeck-us.net> Message-ID: References: <20171017084450.4365-1-shuwang@redhat.com> <20171017152550.GA14871@roeck-us.net> <2144493088.17257615.1508296874903.JavaMail.zimbra@redhat.com> <602729d0-9a01-7e88-3062-cb9d8b0c45a4@roeck-us.net> <1715470689.17543079.1508380102988.JavaMail.zimbra@redhat.com> <20d0960f-e77a-8ee7-0205-707de46d034d@roeck-us.net> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Sender: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, 18 Oct 2017, Guenter Roeck wrote: > On 10/18/2017 07:28 PM, Shu Wang wrote: > > > > > > Fix kernel warning on my 4cpus 2core_id system. The cpu0 and cpu1 > > > > > > have same core_id 0, so both cpu0 and cpu1 will try to create file > > > > > > temp2_label when it's online. > > > > > > > > > > > > > > > > > - coretemp_cpu_online(cpu=0) > > > > > > - create_core_data(cpu=0, attr_no=2) > > > > > > - create_core_attrs(attr_no=2) > > > > > > - coretemp_cpu_online(cpu=1) > > > > > > - create_core_data(cpu=1, attr_no=2) > > > > > > - create_core_attrs(attr_no=2) > > > > > > > > > > > > $ grep -e processor -e 'core id' /proc/cpuinfo > > > > > > processor : 0 > > > > > > core id : 0 > > > > > > processor : 1 > > > > > > core id : 0 > > > > > > processor : 2 > > > > > > core id : 1 > > > > > > processor : 3 > > > > > > core id : 1 > > > > > > > > > > Complete output of /proc/cpuinfo might be helpful. > > > > > > > > $ cat /proc/cpuinfo > > > > processor : 0 > > > > vendor_id : GenuineIntel > > > > cpu family : 6 > > > > model : 61 > > > > model name : Intel(R) Core(TM) i7-5600U CPU @ 2.60GHz > > > > > > This is a hyperthreading CPU, which should already be handled, > > > > Do you mean that for my system, coretemp_cpu_online should only > > be called twice instead of four times to create two core attrs? > > > > coretemp_add_core() should only be called twice, and cpumask_intersects() > should filter out the duplicate ones. > > /* > * Check whether a thread sibling is already online. If not add the > * interface for this CPU core. > */ > if (!cpumask_intersects(&pdata->cpumask, > topology_sibling_cpumask(cpu))) > coretemp_add_core(pdev, cpu, 0); > > Thomas, is it possible that something is wrong with this code ? Hrmm. Not that I can see. The only thing I can think of is that the logical package association of the CPUs is screwed. Debug patch below. Thanks, tglx 8<------------ --- To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c @@ -611,6 +611,9 @@ static int coretemp_cpu_online(unsigned if (cpuhp_tasks_frozen) return 0; + pr_info("CPU %u %u pkgid %d\n", cpu, smp_processor_id(), + topology_logical_package_id(cpu)); + /* * CPUID.06H.EAX[0] indicates whether the CPU has thermal * sensors. We check this bit only, all the early CPUs