Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1544685pxb; Fri, 1 Oct 2021 13:03:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzabq7dFF74mEOH9KswsVT6uIjyumPaPUxYWxwnDJg6O604iN1G/yB8FnEvzC7gDrXk/Sb5 X-Received: by 2002:a50:da07:: with SMTP id z7mr16616266edj.301.1633118618547; Fri, 01 Oct 2021 13:03:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633118618; cv=none; d=google.com; s=arc-20160816; b=Ijyo4GVQwN3iATNgnvi2DXJ1n7TrFL9rRgxsy2E1p/p9VGPoaRgof+/iTF9TFhwBjA D0qe67DLkjWPYpwHHR8+mZJJRh6+4+Au2/CGZgglDW95vSxcTEJgylIuI1ZtxLaPco59 cX2WuzqmcndCIAofVdUGm3Em/ERKWk7MfE1YR76cR7gXE3YlBj2UNeiA/IDuH4ShKVD3 xiBJdZTuD/zA1stVKXh/P5I7j+GKWIFWeOc2tfE50i74+R/ryP7HLvWaZN4Ai3Bzqn5s Qo12liWi6S9yraHK5NKiMFyMO9qSs/X+FoGFwjPrjfpkCk04+Tp6y/5rszJ3Wpvkn+oN 60LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=6kWvsqS9wtvwiaERR1Va8UItEXxGSeZlzApY0N8G3rE=; b=MoSdXcaZjoEIjHmJsp5aANXehhcBGn0DykdSFAlKl5g8OR8d/l9r6WYrTTT+8+LVdg QInzV1w9q1yeTO9GzP6jtJOetPmPW0w2teMjQpwxhh0qwS/IvNqL27y5RtQXu57w6t0w gOFMomM1cWBQqpjjPqPUs9JfxaCkaDAJNilf0lh0DGEnYWF6MO4aQcjkY267ScYQT6HW cAmoo4q6chM6Xu2B4F+qtGfw6ZHPUwl6I/ctT1xfWKOl1Vqq4VIh0+m4NsSpFtnWuDcB 0npzmAjXkQDpjbNh3uXrneU+sdpCjdjHd7lr+/OEAZARyd9breYzkSRH6yJJkxXoMnve 0tQQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b27si7747920ejd.608.2021.10.01.13.03.12; Fri, 01 Oct 2021 13:03:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229807AbhJATGb (ORCPT + 99 others); Fri, 1 Oct 2021 15:06:31 -0400 Received: from mail-oi1-f174.google.com ([209.85.167.174]:35397 "EHLO mail-oi1-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229723AbhJATGb (ORCPT ); Fri, 1 Oct 2021 15:06:31 -0400 Received: by mail-oi1-f174.google.com with SMTP id n64so12670585oih.2; Fri, 01 Oct 2021 12:04:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6kWvsqS9wtvwiaERR1Va8UItEXxGSeZlzApY0N8G3rE=; b=q94lhcFZLqGuzJpezvCiw8fS3mZssVIacMfRks9iZu7EhlaV52myfGaJEJs8wenHms yAhIjtjL4GVWAyPQE67iMQXelm7eDT+C2urNhqWJ0Do+XzlU2C6hdvAkyH+62CbtBYDD XwEFKTGQCuAFk+NcL5X+cMqyOC4f4mLLtESgfwZB/g1J4rtCNz3eBdSw8B//aLiK//It ka5YWFMf7O3GJtT6n6T2GHyAkT9fxSi5KYGa72f3GKaxnemH+YUu6rV9rtfjxzgZ0frl /X2QJIX9Ttjj2c/U+yOBOLwcqvDzFBVoPc58rD4VKaUO2EQxlNoaYreowNnY4aJHA2PS XMBA== X-Gm-Message-State: AOAM533zK3hZnCHlG35ggnsJFBTZ78cliHEkPZk4+18koq6eNvkSYBk4 paf3r5MvsTdJzCq7+T2YfvdF0dZjbjkdJyPizC8= X-Received: by 2002:a05:6808:1816:: with SMTP id bh22mr4979269oib.69.1633115086415; Fri, 01 Oct 2021 12:04:46 -0700 (PDT) MIME-Version: 1.0 References: <20210928164217.950960-1-srinivas.pandruvada@linux.intel.com> <5b5f8adcf441494c5e17b9fb47dc42f345c737f2.camel@linux.intel.com> In-Reply-To: <5b5f8adcf441494c5e17b9fb47dc42f345c737f2.camel@linux.intel.com> From: "Rafael J. Wysocki" Date: Fri, 1 Oct 2021 21:04:35 +0200 Message-ID: Subject: Re: [PATCH] cpufreq: intel_pstate: Process HWP Guaranteed change notification To: Srinivas Pandruvada Cc: "Rafael J. Wysocki" , "Rafael J. Wysocki" , Len Brown , Viresh Kumar , Linux PM , Linux Kernel Mailing List , Jens Axboe , pablomh@gmail.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 1, 2021 at 9:01 PM Srinivas Pandruvada wrote: > > On Fri, 2021-10-01 at 20:52 +0200, Rafael J. Wysocki wrote: > > On Tue, Sep 28, 2021 at 6:42 PM Srinivas Pandruvada > > wrote: > > > > > > It is possible that HWP guaranteed ratio is changed in response to > > > change in power and thermal limits. For example when Intel Speed > > > Select > > > performance profile is changed or there is change in TDP, hardware > > > can > > > send notifications. It is possible that the guaranteed ratio is > > > increased. This creates an issue when turbo is disabled, as the old > > > limits set in MSR_HWP_REQUEST are still lower and hardware will > > > clip > > > to older limits. > > > > > > This change enables HWP interrupt and process HWP interrupts. When > > > guaranteed is changed, calls cpufreq_update_policy() so that driver > > > callbacks are called to update to new HWP limits. This callback > > > is called from a delayed workqueue of 10ms to avoid frequent > > > updates. > > > > > > Although the scope of IA32_HWP_INTERRUPT is per logical cpu, on > > > some > > > plaforms interrupt is generated on all CPUs. This is particularly a > > > problem during initialization, when the driver didn't allocated > > > data for other CPUs. So this change uses a cpumask of enabled CPUs > > > and > > > process interrupts on those CPUs only. > > > > > > When the cpufreq offline() or suspend()callback is called, HWP > > > interrupt > > > is disabled on those CPUs and also cancels any pending work item. > > > > > > Spin lock is used to protect data and processing shared with > > > interrupt > > > handler. Here READ_ONCE(), WRITE_ONCE() macros are used to > > > designate > > > shared data, even though spin lock act as an optmization barrier > > > here. > > > > > > Signed-off-by: Srinivas Pandruvada < > > > srinivas.pandruvada@linux.intel.com> > > > --- > > > This patch is a replacement from the patch submitted to 5.15 and > > > later > > > reverted. > > > > Applied as 5.16 material, thanks! > I got email that pablo (pablomh@gmail.com) tested this. So he can added > Tested-by also pointed out typo in "optmization". > Shall I send a patch with this change? No need, I will update the commit in the tree.