Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp217033pxb; Mon, 7 Feb 2022 09:37:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJyE30wzNJijD0HYQgw7mUOomPzCKJPQjeGVwixnv8CXWuibPnGVCNjqdlzRLXB1WLIOkAL3 X-Received: by 2002:a63:824a:: with SMTP id w71mr384759pgd.378.1644255430979; Mon, 07 Feb 2022 09:37:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644255430; cv=none; d=google.com; s=arc-20160816; b=PvTeVig7+RXxMWs/mH7ITuAC3NYeEfMvZzegwKZPZ9tfSDFRNPNaF1FfrUgoP1GIg/ lfMwudFAQjL3xc88h4hicDcuCv5+Nf9IXvicH7ZKf18CXa6z9ox3tqR8d77M6U/SifuL 1ZNybiG5NE6TwR0QJsh9LWuitzwxPKoBUc/rcBQUGZR3E0pG5UUsfb0rLqg6xqVQkxEL T6U7dAJc2Vx9aWMVethptlLKnMZwaghwiw0s7cFX/DBHdqv2EdUKtmSDcaZe1YuhrcDs 35rSrGyo8/MH+a+xkk8Z89pxSeyOG7eic21XVtuzArYsD2QPkQf7DvgteYJz+wn6azSR MtsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=IL3rFnifXR7qIkr0eGfGpGKLMNnmljVy+ERXmHkSgl8=; b=g/Gnsp3GjRwd+tHvLhoTeyxQmVngBt8ee9H0Fsf8vyMv5EOGEepOo930iPI+d/yAc7 wW+chY8GXQEyZe1uZOVoIWtR2VcSmmD7ByoEAYjmmVV+34xBOcpaFkKWAjL7UVCbCCHl XRwRtERDvc2o9GQ1rLoiCv//ZUH7DiaF+0EFXK0yTo/AaqFxjsZxvrYckqf9joYjjVdK wCDf0YKmKCiiqs/PTXq+bmLsiLbdM+B1K84Hwffk6nxDTQ/zhsKqzq+dY8XwjHfETIIm NvkHNgWA0Kd0oBIuIOjOeeYSdsFDg45aDaiZjcD2YSMh6oNaJlFXm9ENicZ4az/tjxE9 BXEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gICqyx86; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w198si10084538pfc.73.2022.02.07.09.36.58; Mon, 07 Feb 2022 09:37:10 -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=@intel.com header.s=Intel header.b=gICqyx86; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378307AbiBEAqM (ORCPT + 99 others); Fri, 4 Feb 2022 19:46:12 -0500 Received: from mga03.intel.com ([134.134.136.65]:15579 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230266AbiBEAqL (ORCPT ); Fri, 4 Feb 2022 19:46:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644021971; x=1675557971; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=RTnhhinurZQZcCo/zAYuMWSmR/Zk64TZ7GLeuH68Ld0=; b=gICqyx86rFzn4xjPwolvYdjiwOjjuWijOoQPm7pbPFSD4sdmiFqHRA6v MfwSFF5/u0cajCNUVIVBJiUSntbmTPgarfRT5sv4/XeFhKAyEMf6kfTTb 9iuPgQRhMotzcCc3Mjq6SvuyekRjmWIsaCwrqtWJTYICh5me7zDyqmVvU 7Fq06lIyixRNvk6PbY56ZcVJwklQ4qunupo/H05WsTLveto0cAn+3Uu2D wHZMXlbiT2V0R05SzrLcdtybjKkS/7sG3mty6mfV6Wj7qTjjvdWly4jNc ecoj0Y+P2RiSCMano4IG6tmPqekamu4fjZKmdgi2AYN4wkC2qPqqvf8dp Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10248"; a="248417672" X-IronPort-AV: E=Sophos;i="5.88,344,1635231600"; d="scan'208";a="248417672" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Feb 2022 16:46:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,344,1635231600"; d="scan'208";a="677248362" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by fmsmga001.fm.intel.com with ESMTP; 04 Feb 2022 16:46:09 -0800 Date: Fri, 4 Feb 2022 16:47:58 -0800 From: Ricardo Neri To: "Rafael J. Wysocki" Cc: "Rafael J. Wysocki" , Daniel Lezcano , Linux PM , the arch/x86 maintainers , "open list:DOCUMENTATION" , Len Brown , Srinivas Pandruvada , Aubrey Li , Amit Kucheria , Andi Kleen , Tim Chen , Lukasz Luba , "Ravi V. Shankar" , Ricardo Neri , Linux Kernel Mailing List Subject: Re: [PATCH v5 0/7] Thermal: Introduce the Hardware Feedback Interface for thermal and performance management Message-ID: <20220205004758.GB11058@ranerica-svr.sc.intel.com> References: <20220127193454.12814-1-ricardo.neri-calderon@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 03, 2022 at 07:57:25PM +0100, Rafael J. Wysocki wrote: > On Sun, Jan 30, 2022 at 4:23 PM Rafael J. Wysocki wrote: > > > > On Thu, Jan 27, 2022 at 8:33 PM Ricardo Neri > > wrote: > > > > > > Hi, > > > > > > This is v5 of this patchset after having incorporated the feedback from > > > reviewers. Please find v1, v2, v3, and v4 in [1], [2], [3], and [4], > > > respectively. > > > > > > The Intel Hardware Feedback Interface (HFI) [5] provides information about > > > the performance and energy efficiency of each CPU in the system. It uses a > > > table that is shared between hardware and the operating system. The > > > contents of the table may be updated as a result of changes in the > > > operating conditions of the system (e.g., reaching a thermal limit) or the > > > action of external factors (e.g., changes in the thermal design power). > > > > > > The information that HFI provides are specified as numeric, unit-less > > > capabilities relative to other CPUs in the system. These capabilities have > > > a range of [0-255] where higher numbers represent higher capabilities. > > > Energy efficiency and performance are reported in separate capabilities. > > > If either the performance or energy capabilities efficiency of a CPU are 0, > > > the hardware recommends to not schedule any tasks on such CPU for > > > performance, energy efficiency or thermal reasons, respectively. > > > > > > The kernel or user space may use the information from the HFI to modify > > > task placement and/or adjust power limits. This patchset focuses on the > > > user space. The thermal notification framework is extended to relay > > > updates of CPU capacity. Thus, a userspace daemon can affinitize workloads > > > to certain CPUs and/or offline CPUs whose capabilities are zero. > > > > > > The frequency of HFI updates is specific to each processor model. On some > > > systems, there is just a single HFI update at boot. On other systems, there > > > may be updates every tens of milliseconds. In order to not overwhelm > > > userspace with too many updates, they are limited to one update every > > > CONFIG_HZ jiffies. > > > > > > Thanks and BR, > > > Ricardo > > > > > > [1]. https://lore.kernel.org/lkml/20211106013312.26698-1-ricardo.neri-calderon@linux.intel.com/ > > > [2]. https://lore.kernel.org/lkml/20211220151438.1196-1-ricardo.neri-calderon@linux.intel.com/ > > > [3]. https://lore.kernel.org/lkml/20220106025059.25847-8-ricardo.neri-calderon@linux.intel.com/ > > > [4]. https://lore.kernel.org/lkml/20220108034743.31277-1-ricardo.neri-calderon@linux.intel.com/ > > > [5]. https://www.intel.com/sdm > > > > > > Changes since v4: > > > ++ Unchanged patches: 1, 2. > > > * Reworded description hfi_instance::hdr and hfi_instance::data. > > > (Patch 3; Srinivas) > > > * Call intel_hfi_online() before enabling the thermal vector at the > > > local APIC is enabled. This makes sure that a CPU has an associated > > > HFI instance when an HFI event happens. Reworded the commit message to > > > reflect this change. (Patch 4; Srinivas) > > > * Set hfi_instances to NULL if we fail to allocate memory for > > > hfi_instance::cpus. (Patch 4; Srinivas) > > > * Delayed initialization of local variables until after the check for a > > > non-NULL hfi_instances in intel_hfi_online(). (Patch 4; Srinivas) > > > * Optimized the error path in init_hfi_init() to not needlessly > > > free the memory of cpumasks that have not been allocated. (Patch 4; > > > Srinivas) > > > * Removed pointless checks for X86_FEATURE_HFI in > > > intel_hfi_[on|off]line(). It is sufficient to check for a non-NULL > > > hfi_instances or a CPU's hfi_instance. (Patch 4) > > > * Added a dedicated (i.e., not system_wq) workqueue to process HFI updates. > > > Reworded commit message accordingly. (Patch 5; Rafael) > > > * Repurposed comment on possibly receiving an HFI event with a NULL > > > hfi_cpu_info::instance. Patch 4 fixed this potential issue. Instead, > > > add a debug statement. (Patch 5; Srinivas) > > > * Wrapped check for NULL hfi_cpu_info::instance in the unlikely macro. > > > (Patch 5; Srinivas) > > > * Renamed struct cpu_capability as struct thermal_genl_cpu_caps. > > > (Patch 6; Rafael) > > > * Removed automatic variable ret from > > > thermal_genl_event_cpu_capability_change() and instead always return > > > -EMSGSIZE on error. (Patch 6; Rafael) > > > * Reworked parsing of HFI capabilities into chunks of > > > HFI_MAX_THERM_NOTIFY_COUNT CPUs at a time to reduce the time > > > we spend with interrupts disabled. (Patch7; Srinivas) > > > * Protected hfi_instance::cpus when iterating over them. (Patch 7; > > > Rafael) > > > > All patches in the series look good to me now, so I will be queuing it > > up for 5.18 unless there are any objections or concerns. > > The series has been applied as 5.18 material, thanks! Thank you very much Rafael for taking the patches. Thanks everyone for your feedback. It did improve the patches. BR, Ricardo