Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp868296imc; Mon, 11 Mar 2019 00:53:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqy0KeILACguaG8bs4PkibGwbtMxKu8bERp8DFGUtjQSokPbLVJWaitp/s59+Ph0zWsn5/Zo X-Received: by 2002:a65:614f:: with SMTP id o15mr28601078pgv.383.1552290822651; Mon, 11 Mar 2019 00:53:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552290822; cv=none; d=google.com; s=arc-20160816; b=n7uKuBIRLEdKBxZjDE5Ye1ZL5xTPFWYaNd6akeSAVWSXU4SxPg+/wDsv/tYElHIZ7e SIGZ2aZMK6+TJWNqatCeZ/11y3cvTB+ciKBOV4NnlFxsa4kWmf0NRazHwf79GHBRo3oS mFFI46JWX8CiZts0b9JW1rfRH7V5GrKo5vIqWg80tIVAkF/titZDnydbZgQm26+NDpqU rZ/BrN5ipb8F2QhJWSlu9adS1BXdsF4rznEOPTXxjp8Of2aJ6TwFQlUd7ey8/fLRpsD4 bvDg9vvRXiFKBQAIpyEjyd9Z+K7C0Sqs53QcAA6OmGswfVmxlZbhDUtQN8DjRIZBx+VE CwMg== 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:dkim-signature; bh=b2Rz1qmd3psHpbHdykCtGNvZwjs+zPbw/SPlnsjAMDY=; b=oYvMariw57sCN3cekgHSdzM/t2Az4PhgmIlroXdQm4Oz543Giskg765RZ80HVRfjhO V6bW4QeIjGZmYKcMhE3/NZMc3tsufARofCBEYGJwjc+umjKxOrECJy9we5a3mzakmjSm rZ+1H/JD3C3bOp2BQecofVpKtWYSuFDvcYPlNtQlBoi5S4uNg4l1MNGohKWzEh2uWTQ3 q6Ritio/tVOUrp+8/EHvaJzJX2d9xaGT2laP6SdLO6DCMRlwQ88Xu3upii1IGOwlKw7N luA0alXty6Zd1FeW5V6ZNEMkwcU/gYQMhxqpCN9SK/bGh9Eo/l3PR6uzFmL3ckNAL6Cp WKMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="FFk+J/j+"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v41si5095126plg.8.2019.03.11.00.53.26; Mon, 11 Mar 2019 00:53:42 -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=pass header.i=@chromium.org header.s=google header.b="FFk+J/j+"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726706AbfCKHwy (ORCPT + 99 others); Mon, 11 Mar 2019 03:52:54 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:43916 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725932AbfCKHwx (ORCPT ); Mon, 11 Mar 2019 03:52:53 -0400 Received: by mail-io1-f67.google.com with SMTP id y6so3165222ioq.10 for ; Mon, 11 Mar 2019 00:52:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=b2Rz1qmd3psHpbHdykCtGNvZwjs+zPbw/SPlnsjAMDY=; b=FFk+J/j+elOclk3h/Rk2jY85jvf27Eak057l+nY3RnLHH7YnRKFdweJI4nNSIl1eD4 FoXQ3F7wOdU8hAmZbv06MZkqKcZ7LWTJpoNsLJFpDrLzK64Q1H4Iq9SlyYl7KxuLPCct USQBNXK2Dsc92tln9RgUBc8/PjGLP73wJyygs= 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=b2Rz1qmd3psHpbHdykCtGNvZwjs+zPbw/SPlnsjAMDY=; b=GVjQb9VtJG2wuEQ07tNRDSBlwWgDD33/lRtbQQdcKD33NX/NyFvnLwvU3oguMLaVnE rCjEpWyXOV6ooA86RzFsWEtYH0OUjIH14dqwD8PLU4ND4mD6w+svpBgZ+Q2uV4JKvyqP MoA/9wrxE9yFsJC+zHzEtc9HDScwlQooaaGTCSet51FexideUWzklyvaiL2p5Nz58TLH vH6weVRu73Ei5Tsf1LaGlcZ9//5+24CDtjBsTjqPRKT58avY97MpypGSvFvYrg5TVtHF fOXuAq7AIP0Wk2+z7zFHxZKJMvSoZl6SZApqed8qCuEzKebL+X69CY3MsSsLfvyZG1/t INHQ== X-Gm-Message-State: APjAAAW3dixxQgsczOi/XlblqogDm2wmPA4mzcevE5iNQMzws4bgyvTN W3qolg84P9kX58G6spOd3auz0fDAE17g+zrs90jzRA== X-Received: by 2002:a6b:7a48:: with SMTP id k8mr15407718iop.192.1552290772400; Mon, 11 Mar 2019 00:52:52 -0700 (PDT) MIME-Version: 1.0 References: <20180702190154.6864-1-srinivas.pandruvada@linux.intel.com> <9712316ab62bef25953c523bce02e260a9ea40fe.camel@linux.intel.com> <20180730152256.GF1206094@devbig004.ftw2.facebook.com> <20180730173345.GI1206094@devbig004.ftw2.facebook.com> <54d2b8e6-332b-117a-b982-77a535152246@redhat.com> <3914af3f82d8aad8c22d814a20af4be654f8ad43.camel@linux.intel.com> <917a32a4-c806-af99-a9a3-246b28a5196a@redhat.com> In-Reply-To: From: Gwendal Grignou Date: Mon, 11 Mar 2019 00:52:41 -0700 Message-ID: Subject: Re: [PATCH 0/2] ata: libahci: devslp fixes To: Rajat Jain Cc: Hans de Goede , Srinivas Pandruvada , Tejun Heo , "Rafael J. Wysocki" , alan.cox@intel.com, "IDE/ATA development list" , Linux Kernel , Rajat Jain 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 8, 2019 at 11:30 AM Rajat Jain wrote: > > On Fri, Mar 8, 2019 at 12:57 AM Hans de Goede wrote: > > > > Hi, > > > > On 08-03-19 01:04, Srinivas Pandruvada wrote: > > > On Thu, 2019-03-07 at 15:07 -0800, Rajat Jain wrote: > > >> Hello, > > >> > > >> On Thu, Mar 7, 2019 at 12:37 PM Hans de Goede > > >> wrote: > > >>> > > >>> Hi, > > >>> > > >>> On 07-03-19 21:27, Gwendal Grignou wrote: > > >>>> Srinivas, > > >>>> > > >>>> I am looking at problem on a laptop machine that suspends to > > >>>> S01x, but > > >>>> link_management is set to max_performance, because the machine is > > >>>> connected to a charger. > > >>> > > >>> What is setting it to max_performance when charging? I assume > > >>> chrome-os is > > >>> running something in userspace to do this (like TLP, but I guess > > >>> you are not > > >>> using TLP) ? > > >> > > >> Yes, we have a udev script that does this. > > >> > > >>> > > >>> Have you run benchmarks with max_performance vs the default? > > >>> I seriously doubt there will be a significant difference, esp. > > >>> with a chrome-os style workload. > > >>> > > >>>> Given DVLSP must be set before the laptop suspends ["""One of the > > >>>> requirement for modern x86 system to enter lowest power > > >>>> mode (SLP_S0) > > >>>> is SATA IP block to be off."""], the machine never reaches S01x. > > >>>> Does it make sense to change the target_lpm_policy at suspend > > >>>> (ata_port_suspend()) to min_power and bring it back to the > > >>>> original > > >>>> value on resume? > > >>> > > >>> If userspace messes with the setting, then userspace should also > > >>> put it back before suspending... > > >>> > > >>> The upstream kernel's default behavior is to have the target level > > >>> set > > >>> to a fixed level independent of the charging state. Could it be > > >>> this > > >>> fixed level is actually max-performance ? If that is the default > > >>> the > > >>> kernel comes up with, that would indicate a kernel bug. > > >> > > >> Side note: max-performance indeed can be the default forced by the > > >> kernel for some (broken) SATA devices: > > >> > > >> if (dev->horkage & ATA_HORKAGE_NOLPM) { > > >> ata_dev_warn(dev, "LPM support broken, forcing > > >> max_power\n"); > > >> dev->link->ap->target_lpm_policy = ATA_LPM_MAX_POWER; > > >> } > > >> > > >> So definitely these systems won't be able to go into S0ix today. > > >> > > >> But Idrivers/ata/libata-core.c think the main idea that we are asking is: > > >> > > >> 1) Yes, we acknowledge that the userspace has set it max-performance. > > >> > > >> 2) However, given that the kernel already knows that: > > >> - while in suspend, there is no real value in retaining the > > >> max-performance. > > >> - On the contrary, we know system will fail to go into lower > > >> power mode because of max-suspend. > > >> > > >> 3) Does it not make sense to use this knowledge and switch to > > >> min_power when we are actually going to suspend (even if user > > >> specified max-performance), and restore max-performance on resume? > > > > > > It is all about regressions. Hence we added multiple conditions for > > > setting default to min power. > > > It may cause issues for some SATAs, which may not recover once enters > > > slumber or DEVSLP. There is also case where user having issues with > > > default LPM policy hence he changed policy to max performance. We can't > > > detect that. > > > So it will be much safer if user space change policy to default before > > > calling suspend. > > Now I understand, and agree. > > > > > Right, or simply do not mess with the setting in the first place! Reading the kernel code further, I understand the intent to no setting link power from user space anymore. Before 4.16, the link was set to max_performance by the kernel; we have script to set min_power, but that was done indiscriminately, and breaks devices that need max_performance. I added one similar to intel-sata-powermgmt (at https://github.com/rickysarraf/laptop-mode-tools/blob/lmt-upstream/usr/share/laptop-mode-tools/modules/intel-sata-powermgmt), but that was a mistake for kernel 4.19. For future devices, we will make sure to not use devices with horkage ATA_HORKAGE_NOLPM or that require max_performance (see http://preston4tw.blogspot.com/2015/02/transcend-mts400-ssd-power-saving.html). Thanks for your help, Gwendal. > > > > I noticed you did not answer this part of my original reply: > > > > "Have you run benchmarks with max_performance vs the default? > > I seriously doubt there will be a significant difference, esp. > > with a chrome-os style workload." > > > > I seriously doubt the max-performance setting has a user > > noticeable impact on performance. So I repeat has someone > > actually measured this with real-world chrome-os workloads ? > > The reason we're setting it to max-performance is not really > performance - but as a work around to a broken SATA device (Transcend > SSD) that can't handle DEVSLP in active state (similar to what > Srinivas said). Putting it to min_power while suspended was OK because > it'd be in reset anyway at that time. Thanks for your explanations and > help. > > Rajat > > > > > > Regards, > > > > Hans > >