From patchwork Fri Dec 16 20:24:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 34084 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp1184057wrn; Fri, 16 Dec 2022 12:36:49 -0800 (PST) X-Google-Smtp-Source: AMrXdXvQWAzTpft+GxeievJSr2V3KsWPMmtqot810TrvofLsmxtrsLo8wCQU8XVrpLok52KB9PRD X-Received: by 2002:a17:906:6b13:b0:7ae:29fa:ba8f with SMTP id q19-20020a1709066b1300b007ae29faba8fmr19578004ejr.2.1671223009105; Fri, 16 Dec 2022 12:36:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671223009; cv=none; d=google.com; s=arc-20160816; b=MqzXxKyM0fC7ukhUpGIUqWsAQxAni9MREHTA1rQzSZneKk2qcfjBMZCzktLCXePZ/P mY1+tHH2MKLvdUOlu1LyEeSbu2nFuyLGmxkZ0AfYREf7RYKoRMUWXNkvko3CHAGHiKqN xdwSTdv2r4DlSY7LSz+eEBUVYvnfJvkc8U+gYRAnbDvgbgCoe/SqjR+vBf9p75Wp+fUN fyhZF+ogog75otX+AK8A8R43wv8BhxqYsZl8Mia5wDJhdcEWorg93PjBrXG6XlPJT2QQ vFEl2DgbYqf2eklkCFVYX3IxMaPbOujAAQqygFR5hUmqp8bl2BsttElPAmR8WbYYAqOi 7Jpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=kO1kFNElmiazijaeVmClgAjGGa3reOuDHRabVz/YO1k=; b=JfA01MbHvXgo6BhhkCK+/1vCf2Rdcoz1Q3yCOeFz7wCLfDhb45gX4/8p3hPw64uREW KErw57OttDHNnT/9H6X44RDclKgbua75jSCAz/p990FBoYptwvnyrdmXa5IwVFquUak5 vgGrGUetc4AoLTUMzZv0ksq5SnV7Y+VcxAwgZ/ZreRfzPtlcdaWzXsDHDJYNNEGKy+gH hd5Wu+s+hLCIe5E11JoURRullrDfCObrdxMHsu7Qa6RlrS2Jp6+9fZsYeh+jjPQs8DN5 c0DG9GytdmRqtgK552rLA945i4th/aYxS1aMju0K9uWpc77YK6B66x0V9aVPRFCfyaBL PDmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IrUsxxSb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg3-20020a170907970300b007f5e85a453asi612412ejc.354.2022.12.16.12.36.25; Fri, 16 Dec 2022 12:36:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IrUsxxSb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231986AbiLPU0w (ORCPT + 99 others); Fri, 16 Dec 2022 15:26:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231958AbiLPU0t (ORCPT ); Fri, 16 Dec 2022 15:26:49 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CFF63945E for ; Fri, 16 Dec 2022 12:26:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1671222361; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=kO1kFNElmiazijaeVmClgAjGGa3reOuDHRabVz/YO1k=; b=IrUsxxSbDP34wjTzqZztyrlrHUGE3rbIZaBjBwWTkppROKxDFaIgr4RozsVxV+WyS/WbNL rFUJVAJNCbKvn3h+wZP1Qpny4IR2jfCAzQc3ADHDE7SOCOQ0ftJHWI7Nu5dIZOeTblKSEy 9CUQ9QcgWSKj6hmGgfB149lk5L40xwY= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-203-WLYL5WUlM4OrgTcuyZvtoA-1; Fri, 16 Dec 2022 15:25:56 -0500 X-MC-Unique: WLYL5WUlM4OrgTcuyZvtoA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B8B5C3815D38; Fri, 16 Dec 2022 20:25:55 +0000 (UTC) Received: from tpad.localdomain (ovpn-112-2.gru2.redhat.com [10.97.112.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7D27E40C6EC4; Fri, 16 Dec 2022 20:25:55 +0000 (UTC) Received: by tpad.localdomain (Postfix, from userid 1000) id A290F403B5B80; Fri, 16 Dec 2022 17:24:08 -0300 (-03) Date: Fri, 16 Dec 2022 17:24:08 -0300 From: Marcelo Tosatti To: Guenter Roeck Cc: Fenghua Yu , linux-kernel@vger.kernel.org, linux-hwmon@vger.kernel.org, Frederic Weisbecker Subject: [PATCH v3] hwmon: coretemp: avoid RDMSR interruptions to isolated CPUs Message-ID: References: <68f76ac7-5edd-d437-8bef-e233f2876660@roeck-us.net> <34dc4244-4e62-0b73-b6f9-430e4ee1a1e6@roeck-us.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <34dc4244-4e62-0b73-b6f9-430e4ee1a1e6@roeck-us.net> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752284638836949682?= X-GMAIL-MSGID: =?utf-8?q?1752404338039341307?= The coretemp driver uses rdmsr_on_cpu calls to read MSR_IA32_PACKAGE_THERM_STATUS/MSR_IA32_THERM_STATUS registers, which contain information about current core temperature. For certain low latency applications, the RDMSR interruption exceeds the applications requirements. So do not create core files in sysfs, for CPUs which have isolation and nohz_full enabled. Temperature information from the housekeeping cores should be sufficient to infer die temperature. Signed-off-by: Marcelo Tosatti --- v3: do not create sysfs files for isolated CPUs (Guenter Roeck) v2: improve changelog to mention that an error is returned, and sysfs file is not disabled (Guenter Roeck) diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c index 9bee4d33fbdf..619dfde7a712 100644 --- a/drivers/hwmon/coretemp.c +++ b/drivers/hwmon/coretemp.c @@ -27,6 +27,7 @@ #include #include #include +#include #define DRVNAME "coretemp" @@ -458,6 +459,9 @@ static int create_core_data(struct platform_device *pdev, unsigned int cpu, u32 eax, edx; int err, index, attr_no; + if (!housekeeping_cpu(cpu, HK_TYPE_MISC)) + return 0; + /* * Find attr number for sysfs: * We map the attr number to core id of the CPU