Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp299135img; Mon, 18 Mar 2019 03:29:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqws5r5uTUBag9j4VOyHziXGL0PHGxVYjWZqFvYc58vTEsEWiyvwVCKfqZW/L8u1xA5UztzX X-Received: by 2002:a17:902:1621:: with SMTP id g30mr19085346plg.116.1552904941107; Mon, 18 Mar 2019 03:29:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552904941; cv=none; d=google.com; s=arc-20160816; b=aNnjdfym+xA8wJwmNGIZgRR+yztTTqYoZKRRA7NbvQ9qUzIA3AzGaDjfcEAqNT3/Da QhSAk173868yzGxUHb6c6BM9af+BSQqpzNJ2r+f68cjJUytUzXtlP2evp+Bh/6PdeQ3I 3s0yO8thwgjUDbf/oLVZcBS01tZAz8glZsdf9fCYvt81gWQU3GTEv0eDdIG36n6mQ/2i bU4JXcgK0Hmxof8e9DSGXOOsmcoPvS/QOk6iZElTDFU/zMP9puz4968KyKcrn8pL1j7v oduV2Hl7pJNSXJLytSD+pZs7hRSBE2Po+hkbnZRZB103BMKNdhqwqxER/7qJIu7dOBIM lrCA== 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=UB5+VDaMkJ6XffH9lcsh5IN6zc7Cp893+Z5eIvmeNgw=; b=bPU6QCIp4c/FpgCD5ytVUsxGbvUX0ytlsy3KDztOS9MHjo5+fe7eDnJQ4lFXoSvVtQ FrYZHF2I3X+tcgAq54ZZxPYonxLxnjBxtRyNCs4h4G16mC5g6GxVwbXKvNK9LhPaU6+h fwXzof7zn8rym+6FZPrm5qbswSZJPkkgYbqgybipCg3cep2d5DjpIbfJK122Z4OdxQjr nhv385MiWwbrLImDU6Wa74WEzq9gIGyPz49fo0j6okP5rkp2ZnXArSItyOzn9NJTNN+k NMWRF25CKUrnWVOBqLEp3R9LDHrX6Ee/EykT/e3tFsk9nXE3qYL12Ev6R5lcTXojTNcv IxMQ== 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 10si3078180pfi.183.2019.03.18.03.28.45; Mon, 18 Mar 2019 03:29:01 -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 S1727427AbfCRK0W (ORCPT + 99 others); Mon, 18 Mar 2019 06:26:22 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:46526 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726773AbfCRK0W (ORCPT ); Mon, 18 Mar 2019 06:26:22 -0400 Received: by mail-ot1-f68.google.com with SMTP id c18so13889716otl.13; Mon, 18 Mar 2019 03:26:21 -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=UB5+VDaMkJ6XffH9lcsh5IN6zc7Cp893+Z5eIvmeNgw=; b=dlC28rqkR01p5LSrHfDyptRNr9fikd80nBguEBBMwYYOAzCVzjumM+vngXUhFArPia IxpQ/+iCuOHq5bInnXoisXMCRuuXEKtd18iR5myDTWSypv5SkVMa5f1jJ33TpI9eHDrK O8FJfrLpiP5itdaEI1KjOC/pEhpN69GDWZIR+deS+9+6N/t4x050lxXQ/QqhFdVQ1uxV 6ei3EwlF9ygnkUq7NftpDmOgPFws/LCh6mSucb7joKXZ283CS0+buKqJhiPD2Y6NemMc lmxjFrLm/YkuKxLhPEDSXZfrFACNDf2UddNPF7Nb9xYYhFH1CqGcJ8o6Bszafhraw3F+ p4hQ== X-Gm-Message-State: APjAAAUh5Y9XJcsc2bWk4P1piAAFy+SNNK7qeI+/edhEwrDegA8mxPjz nfTXOHwBVIfLxpC01ipRshn1QzBdHOm3YqD84jI= X-Received: by 2002:a9d:36a:: with SMTP id 97mr217490otv.124.1552904781212; Mon, 18 Mar 2019 03:26:21 -0700 (PDT) MIME-Version: 1.0 References: <6369897.qxlu8PgE1t@house> <2947538.dvgdW3vLlg@house> In-Reply-To: <2947538.dvgdW3vLlg@house> From: "Rafael J. Wysocki" Date: Mon, 18 Mar 2019 11:26:10 +0100 Message-ID: Subject: Re: [PATCH] [RESEND] Do not modify perf bias performance setting by default at boot To: Thomas Renninger Cc: "Rafael J. Wysocki" , Len Brown , Hannes Reinecke , Linux PM , LKML , Borislav Petkov , Simon Schricker , Srinivas Pandruvada , Len Brown 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 15, 2019 at 4:36 PM Thomas Renninger wrote: > > Hi Rafael, > > On Thursday, March 14, 2019 11:08:03 PM CET Rafael J. Wysocki wrote: > > On Thu, Mar 14, 2019 at 3:42 PM Thomas Renninger wrote: > > > This is a revert of mainline git commits: > > > commit b51ef52df71cb28e9d90cd1d48b79bf19f0bab06 > > > commit 17edf2d79f1ea6dfdb4c444801d928953b9f98d6 > > > commit abe48b108247e9b90b4c6739662a2e5c765ed114 > > > > I'm not quite convinced that reverting these is the right thing to do here. > > Ok, I try harder. > > > > It is about this kernel message showing up on quite a lot servers: > > > [ 0.072652] ENERGY_PERF_BIAS: Set to 'normal', was 'performance' > > > [ 0.076003] ENERGY_PERF_BIAS: View and update with > > > x86_energy_perf_policy(8) > > What happens on boot is a matter of convention and the convention by > > which the EPB is set to "neutral" at that point has been used for > > quite a while. Changing it now may confuse some users or even worse. > > SUSE has this patch included for quite a while (in all kind of > SLE 12 SP flavors), possibly other distributions as well. > Unfortunately the patch got removed recently, because my commit (this one) > was ignored by Len a while ago. > > I also like to see more examples of BIOSes not initializing this value. > This message is rare (so the setting back does not happen often, probably > only wrongly with latest BIOSes overriding intended BIOS performance settings > on servers). > > On my workstation the BIOS initializes perf bias to: > cpupower info > analyzing CPU 0: > perf-bias: 7 > > I could grep through quite some dozens of machines..., but these are mostly > servers and probably show either "zero"/"performance" or "6"/"normal" because > the Linux kernel overrides the INTENDED performance perf bias value to 6. The perf bias Intended by whom? Yes, the kernel replaces whatever the original BIOS setting is with its own one. It may not match every setup perfectly, but at least it is consistent. Why exactly is it worse than whatever the BIOS has set? > So we (SUSE) are going with this patch forever. > > Otherwise we would run into a similar support nightmare we ran into, when > Intel decided to ignore CPU idle states as exported by BIOS through ACPI. > BIOS documentation of all big server vendors mentioned "performance" settings. > With a kernel update these BIOS C states settings have been ignored (some long > latency once were not exported on purpose). > > The list of breaking conventions and specifications is long... > People mostly blame the "bad BIOS developer". In this case things have been > broke by the kernel. I agree that the kernel should not modify the EPB on system-wide resume and on CPU online, but I don't see why changing the BIOS setting at init time is a problem really. > It's now (with the resume patch) broken in way, that "performance" setting So the point seems to be that the BIOS setting should be preserved or people are not able to configure the systems for performance through setting things in the BIOS. However, that only means that setting things in the BIOS is not sufficient to configure a system for performance and that has always been the case AFAICS, with or without the EPB. If you want to configure a system for performance, you need to do that not just in the BIOS, but also in the OS (and, quite arguably, I would expect the latter to be sufficient). > in the mainline kernel is unusable for years already. > > Can we please get this finally properly fixed! > > > That is a bug. There is no reason to change the EPB on CPU > > offline/online and I agree that this needs to be fixed. The reverts > > would make this problem go away, but that's not the only possible way > > to fix it. > > It is the only proper way to fix this. I beg to differ. The system-wide resume part will still not be working properly after the reverts. > > Moreover, what is done during system-wide resume appears to be a bug > > too. Whatever EPB value is there during suspend should be saved and > > it should be restored during resume. Reverting the commits above will > > not fix that particular issue. > > Someone could have a look what happens on a recent system > after suspend (with this patch on top). > I do not have laptops to test suspend/resume with latest kernels. > These broken patches have been added a bit too quickly. > > I doubt much BIOSes "forgot to initialize this value" and I have my doubts > that resume let's the CPU fall back to "uninitialized" value. > I more expect BIOS resets performance value after resume and the kernel is > doing it all wrong. > Hm, in fact this could be proofed by modifying perf bias value, do a suspend > resume cyle. If the value is kept we should avoid another try of complicating > things and simply reverting touching perf bias value altogether, correct? No, AFAICS. If the EPB value has been modified from user space after initializing the system, that new value should be preserved across system-side suspend/resume (and hibernation) and also (arguably) across CPU online/offline. Not the BIOS-set value, but the new one set by user space. The only way to guarantee the preservation of it across suspend/resume is to save it at suspend time and restore it during resume. Relying on the BIOS to avoid touching it may be a bit overly optimistic. > BIOS probably does not store perf BIAS value and re-applies it after > suspend resume. Some might re-set it to the intial value (performance..., > D'oh). Right. Thanks, Rafael