Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3059357img; Mon, 25 Mar 2019 02:57:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqzOV59ykQlEhr5NC5K2ZWqvJbmzoBou/ECZDLAiorLd8c4Qd3NynvC6VLaHfV6HqroRzgUS X-Received: by 2002:a17:902:bb0c:: with SMTP id l12mr24578084pls.108.1553507863958; Mon, 25 Mar 2019 02:57:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553507863; cv=none; d=google.com; s=arc-20160816; b=KW5rEhSzHcgCC0XDhc5ANklem/xZM5MOLooet0H1vfYDOmghRfl0ALpHJBH0q/HsqI aY6ZQ2x9ZTOkBuuFIAeFzQRHwSaO1NrzTaj/2i1c1euGz61gQ+Dh38N+6jY6C+6k1WZk r6EyXlt1GPU4wvTztXcZU1Da9q3SPzIIpZO303dowKOjjA+FH3IqrRjNucac4PQn3RoR 76wbBKPLzYz8flg9nvhb//mTiVTyjYW1PnfRLYPLd7427JP2Q/YI03ThQnGg8nO2N8rM 3I9p0Bo/eaGwZNKVFrG/HsBUqSJscZ5Z9s18Wrl1Qqkbo72Qyv00YAzbcZALnYkT7xye b5Lg== 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 :in-reply-to:references:mime-version; bh=XOd9IT2dezh2M2cUgQ4aKfbEw2w2NXDJPkRGJfYzM+s=; b=QH+zWobeVy5rQaMGcMPwgDKKAhxeGV/JOk3fPDwxIpsH8gm5MrdQkSpnN6vDhnsoCE spl0HuOMj1CbABuGdGJSVmVndRqL3BH4ujn9H+5xg+tlbMFKnmwXCVzcZtc35NVHylyf ImLS++IQlHKnBxAwgAvvzXJKh0VZTINU8NjtcbeldsdfQjLwUNMNyztRJbtYkhXMy4eg ShENa8hKpEIs0wPJwmXGlEo81TUvRgXUrQBa94JOBaiv4J8cxLz7NzS2f5DllxgBMiHm U+sXrx0m6yGSOXM187xNeLw54rcUGbX5XP/aT3Lu9TPHXEUL6y3vrr0EXfYP/cZEzL1H 1TIw== ARC-Authentication-Results: i=1; mx.google.com; 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 76si10375427pge.555.2019.03.25.02.57.28; Mon, 25 Mar 2019 02:57:43 -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; 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 S1730377AbfCYJ4y (ORCPT + 99 others); Mon, 25 Mar 2019 05:56:54 -0400 Received: from mail-oi1-f196.google.com ([209.85.167.196]:42446 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730216AbfCYJ4x (ORCPT ); Mon, 25 Mar 2019 05:56:53 -0400 Received: by mail-oi1-f196.google.com with SMTP id w139so6425159oie.9; Mon, 25 Mar 2019 02:56:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XOd9IT2dezh2M2cUgQ4aKfbEw2w2NXDJPkRGJfYzM+s=; b=ncLLxsX44EXmI2LNJA2TTu5bow9U4sg3SLFm6mHb9qCF8O+GK5NX78OoOoHILT2c4J gimDVY5MgodzO4A/Ay4A7Lwh8LvUOM7sjPgucw9ti30qwoGA01TRKRiKdqucFqlGRd80 MyRxjhhAbT2KIuWX7wizrElE86AkAu0JkYZdoBjujqYqOw0kzgE4YibByVzQ/4VuJb+L W9/GojV5Gcr2ZPcx7Z5Py/s6mDmFktCAhIyBTi52RSX8v+rk94gz+S4RJb5xg5Liieo4 sW6gKq92ZGlf3tkOlNdAsVBZJiZk7wNIKLPOaXoP84NBl00lgzcLBN9Ddi6RnQXDTnjY BxkQ== X-Gm-Message-State: APjAAAUqvyYc4BPE2hpEaP4xrdHSh8FeGl0PerjYXBEZZlqNh0ItSLJf hXFnU4d55Sbqgs44bzfWxMwG35K4KLMyABfkITY= X-Received: by 2002:aca:8d3:: with SMTP id 202mr11171314oii.76.1553507813031; Mon, 25 Mar 2019 02:56:53 -0700 (PDT) MIME-Version: 1.0 References: <1637073.gl2OfxWTjI@aspire.rjw.lan> <1762575.ER2xjzr9E1@aspire.rjw.lan> <20190322150009.GY6058@hirez.programming.kicks-ass.net> In-Reply-To: <20190322150009.GY6058@hirez.programming.kicks-ass.net> From: "Rafael J. Wysocki" Date: Mon, 25 Mar 2019 10:56:42 +0100 Message-ID: Subject: Re: [PATCH 2/2] PM / arch: x86: MSR_IA32_ENERGY_PERF_BIAS sysfs interface To: Peter Zijlstra Cc: "Rafael J. Wysocki" , x86 , LKML , Len Brown , Linux PM , Srinivas Pandruvada , Laura Abbott , Thomas Gleixner , Ingo Molnar , Simon Schricker , Borislav Petkov , Hannes Reinecke 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 Fri, Mar 22, 2019 at 4:00 PM Peter Zijlstra wrote: > > On Thu, Mar 21, 2019 at 11:20:17PM +0100, Rafael J. Wysocki wrote: > > + ret = rdmsrl_on_cpu(cpu, MSR_IA32_ENERGY_PERF_BIAS, &epb); > > + if (ret < 0) > > + return ret; > > + > > + ret = wrmsrl_on_cpu(cpu, MSR_IA32_ENERGY_PERF_BIAS, > > + (epb & ~EPB_MASK) | val); > > That's two back-to-back IPIs and a giant waste. Giant with respect to what? I know that the read can be avoidable if more MSR bits are stored in memory, but I don't expect this i/f to be used very often (once per boot maybe or on AC<->DC changes at most), so I didn't think that this would be a good tradeoff. > If you'd use a proper msr shadow variable, you'd not have to do the > rdmsr_on_cpu :-) Not really. The MSR can be updated from elsewhere which is not controlled by this code.