From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751346AbdJSF0F (ORCPT ); Thu, 19 Oct 2017 01:26:05 -0400 Received: from mail-pg0-f54.google.com ([74.125.83.54]:57135 "EHLO mail-pg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751013AbdJSF0D (ORCPT ); Thu, 19 Oct 2017 01:26:03 -0400 X-Google-Smtp-Source: ABhQp+TH+9gTx6YuNWnOa+F79hLGLI8LBwjP6jHKtGCb2S3rR5zHzuNg6t4fxY+ox6CK5s0UL2uNGg== Subject: Re: [PATCH] hwmon: (coretemp) remove duplicated coretemp for same core id To: Shu Wang Cc: fenghua yu , jdelvare@suse.com, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org, chuhu@redhat.com, yizhan@redhat.com, Thomas Gleixner 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> From: Guenter Roeck Message-ID: <20d0960f-e77a-8ee7-0205-707de46d034d@roeck-us.net> Date: Wed, 18 Oct 2017 22:25:57 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <1715470689.17543079.1508380102988.JavaMail.zimbra@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/18/2017 07:28 PM, Shu Wang wrote: >> From: "Guenter Roeck" >> To: "Shu Wang" >> Cc: "fenghua yu" , jdelvare@suse.com, linux-hwmon@vger.kernel.org, >> linux-kernel@vger.kernel.org, chuhu@redhat.com, yizhan@redhat.com >> Sent: Wednesday, October 18, 2017 9:14:39 PM >> Subject: Re: [PATCH] hwmon: (coretemp) remove duplicated coretemp for same core id >> >> On 10/17/2017 08:21 PM, Shu Wang wrote: >>>> From: "Guenter Roeck" >>>> To: shuwang@redhat.com >>>> Cc: "fenghua yu" , jdelvare@suse.com, >>>> linux-hwmon@vger.kernel.org, >>>> linux-kernel@vger.kernel.org, chuhu@redhat.com, yizhan@redhat.com >>>> Sent: Tuesday, October 17, 2017 11:25:50 PM >>>> Subject: Re: [PATCH] hwmon: (coretemp) remove duplicated coretemp for same >>>> core id >>>> >>>> On Tue, Oct 17, 2017 at 04:44:50PM +0800, shuwang@redhat.com wrote: >>>>> From: Shu Wang >>>>> >>>>> 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. >>>>> >>>> What system/cpu is that ? >>>> >>>> Normally I would assume that each CPU (package) instantiates >>>> a separate instance of the driver. >>> >>> The system is ThinkPad X1 Carbon 3rd laptop, model 20BTS1N70F. >>> >>>> >>>>> - 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 ? Guenter >> and the problem would affect pretty much everyone. I'll have >> to look into this more closely. Is this with the ToT kernel ? > > What's a ToT kernel? The kernel I built was the latest > kernel-4.14.0_rc5+ from linus repo. > ToT => Top Of Tree. My apologies, I thought that was a commonly used acronym. Guenter