Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1740610imm; Wed, 16 May 2018 02:17:18 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrm8muA9PhesWy7Euh5QIf5YO+jOlRWeviVWUS22sMGoJG0hbjuxCTuWKljmnbbaCIRBeCN X-Received: by 2002:a63:7f18:: with SMTP id a24-v6mr58034pgd.312.1526462238441; Wed, 16 May 2018 02:17:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526462238; cv=none; d=google.com; s=arc-20160816; b=Z/H0szoAzO+nW1JitzTa3pEFQfZW+ZXnus4QXXLKUrayHTGU1Z2WDc/m7/oQSywf6d eR1iDsKmXMivMNgRa4/oHYpCj4aUKlsWR4xQHMltU42II9vuhxQFmBJbVH4tfDn1Ks45 Y1JJSe9udfyYj3BDeu4dIzen5OmxY73BfhVI5Akf1ETDT/P/7ZeFCaOFMlXrM30fIF// /dRJpZUg2wLaejvUqGvcgWqng9mVqu9sqU/ZzA9TNwcRst3l2JFjRl+Ac+xh18WZuRnb WMztz+CZ3/nTD9sT3zB2/xDqIQrI775Zn0czxzTggSSK4mppvRJhsqUK+hQGebNETiNU GMuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=pGriXAdftVXtMZOQinlcCn7Wogq5rx1URUCvXX1o8Qk=; b=YFoyBDTIXmKE4uyuJi9BZY3YMeo8G3aN8d4ivokNEPxndpmPM2tP4t8JQ2gmUv9OpC nTogsIDc3IalQw/C/Zjb9d+iSTNJaJmgvLgJtl3wz5KjG4mUYUNRVQjaFEq72fJxWjp3 yryuSD9/iONk02w7N6oWa6obB4ztP661+NcUWVZ5StYG73LR+B58d/aMa8ML2kPVKAM7 7fJ0w3TK1Lr1/8il8pBW7B1ZcJjrjX8g9kbngzHzdU1kRSRQBrEXrqXLh9KeV/5IySSo WeL6qMUipCBBuYATSFugEOQlBUTsF+K12J73EUVZ/b8ATLW0/q31/9UuRQRhNRXp/JVZ qZvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=i5bMU5Id; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r2-v6si2136892pli.370.2018.05.16.02.17.03; Wed, 16 May 2018 02:17:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=i5bMU5Id; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752400AbeEPJPN (ORCPT + 99 others); Wed, 16 May 2018 05:15:13 -0400 Received: from mail-ot0-f196.google.com ([74.125.82.196]:33109 "EHLO mail-ot0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751595AbeEPJPL (ORCPT ); Wed, 16 May 2018 05:15:11 -0400 Received: by mail-ot0-f196.google.com with SMTP id l22-v6so79388otj.0; Wed, 16 May 2018 02:15:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=pGriXAdftVXtMZOQinlcCn7Wogq5rx1URUCvXX1o8Qk=; b=i5bMU5IdJP6bKj/dQzuG9gMSvrhbGWEKhzMY9Et1QWYfP+Agv35Y4cPcHcUFQV17Cy BQK5Y8Q57TNOeGGw6Q5ex0bxvE0U0X633yNCwb8wHkL8K8wAzxIyh3r6aAhv2yNXQE2G EWrnQFgPEkkEpGqN+OKcj+S864Lw1LdhgYUJLCv9b5m7TNdjHrt2Du8llFIKf0f0OJKW MO5U8yK8iM09oH1d1p5cSWTRcQaKmiUvSRRQzTBCgSrQNsOHuMT2T/a8JG71mqr0yFEW Dx7N0gnVmkvbSxEqGkklABjH3KP6nreCCTBwXAMvb5RR19yOLQ6pWQH80LjWVCC+ea0+ OSig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=pGriXAdftVXtMZOQinlcCn7Wogq5rx1URUCvXX1o8Qk=; b=hnvKqB7CVPPn+ZMjoApg+u8kP1EpAhH/ZDXMhF8lXrHgS6Uan5Ai7R7IaFcaXJRJmC gjIRa/US7cwt48izu/Zo6uT2XbyEnSfBr2Tt68TswHkyseZGcjJtUPhpWLwYSnMa1FH+ ZsCgWkT4W8riz4VstvHGVxnB2XqTO62JCVGHlCZwPW5pxtfOR3XrevhL55Vu46cR8ku0 rSOMegjCqybstyRyZnvyRqzWqdZaMNwS/vq8rvsXYeKMvuedYQWpRsvWxOj7IbwEnqBN do7WnvRxhHC+NgIG9JBgnrwUDuuRCqYcTLhOrLsnXBxupvJK00/2EsUYtbvDqxJD7xET iL3w== X-Gm-Message-State: ALKqPwenxLdfSe+2vhbfNyGJcvLBACLGaxxQrEUmimYuM21KWPb3VlZ1 NzmrHRY7GeJPytcroKgPqZUiV61LeJ4BvPRE/f0= X-Received: by 2002:a9d:5990:: with SMTP id u16-v6mr37949oth.370.1526462110165; Wed, 16 May 2018 02:15:10 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:1468:0:0:0:0:0 with HTTP; Wed, 16 May 2018 02:15:09 -0700 (PDT) In-Reply-To: <20180516072202.GV12217@hirez.programming.kicks-ass.net> References: <20180516044911.28797-1-srinivas.pandruvada@linux.intel.com> <20180516044911.28797-4-srinivas.pandruvada@linux.intel.com> <20180516072202.GV12217@hirez.programming.kicks-ass.net> From: "Rafael J. Wysocki" Date: Wed, 16 May 2018 11:15:09 +0200 X-Google-Sender-Auth: voSa1Q1eTZ7msLEEpHdtJ79oU5U Message-ID: Subject: Re: [RFC/RFT] [PATCH 03/10] cpufreq: intel_pstate: Utility functions to boost HWP performance limits To: Peter Zijlstra Cc: Srinivas Pandruvada , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Len Brown , "Rafael J. Wysocki" , Mel Gorman , "the arch/x86 maintainers" , Linux PM , Viresh Kumar , Juri Lelli , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 16, 2018 at 9:22 AM, Peter Zijlstra wrote: > On Tue, May 15, 2018 at 09:49:04PM -0700, Srinivas Pandruvada wrote: >> Setup necessary infrastructure to be able to boost HWP performance on a >> remote CPU. First initialize data structure to be able to use >> smp_call_function_single_async(). The boost up function simply set HWP >> min to HWP max value and EPP to 0. The boost down function simply restores >> to last cached HWP Request value. >> >> To avoid reading HWP Request MSR during dynamic update, the HWP Request >> MSR value is cached in the local memory. This caching is done whenever >> HWP request MSR is modified during driver init on in setpolicy() callback >> path. > > The patch does two independent things; best to split that. > > >> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c >> index f686bbe..dc7dfa9 100644 >> --- a/drivers/cpufreq/intel_pstate.c >> +++ b/drivers/cpufreq/intel_pstate.c >> @@ -221,6 +221,9 @@ struct global_params { >> * preference/bias >> * @epp_saved: Saved EPP/EPB during system suspend or CPU offline >> * operation >> + * @hwp_req_cached: Cached value of the last HWP request MSR > > That's simply not true given the code below. It looks like the last "not boosted EPP" value. >> @@ -763,6 +768,7 @@ static void intel_pstate_hwp_set(unsigned int cpu) >> intel_pstate_set_epb(cpu, epp); >> } >> skip_epp: >> + cpu_data->hwp_req_cached = value; >> wrmsrl_on_cpu(cpu, MSR_HWP_REQUEST, value); >> } >> >> @@ -1381,6 +1387,39 @@ static void intel_pstate_get_cpu_pstates(struct cpudata *cpu) >> intel_pstate_set_min_pstate(cpu); >> } >> >> + >> +static inline void intel_pstate_hwp_boost_up(struct cpudata *cpu) >> +{ >> + u64 hwp_req; >> + u8 max; >> + >> + max = (u8) (cpu->hwp_req_cached >> 8); >> + >> + hwp_req = cpu->hwp_req_cached & ~GENMASK_ULL(31, 24); >> + hwp_req = (hwp_req & ~GENMASK_ULL(7, 0)) | max; >> + >> + wrmsrl(MSR_HWP_REQUEST, hwp_req); >> +} >> + >> +static inline void intel_pstate_hwp_boost_down(struct cpudata *cpu) >> +{ >> + wrmsrl(MSR_HWP_REQUEST, cpu->hwp_req_cached); >> +} > > This is not a traditional msr shadow; that would be updated on every > wrmsr. There is not a comment in sight explaining why this one is > different. So if the "cached" thing is the last "not boosted EPP", that's why it is not updated here.