Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2645057yba; Mon, 22 Apr 2019 10:22:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhOCPApdxp5W08ECcr6q9UOegsotYHr3he6rs75VEKft75ISO+SfAddQtYpUlkoV4ZQ99I X-Received: by 2002:a62:ed10:: with SMTP id u16mr21508929pfh.187.1555953779908; Mon, 22 Apr 2019 10:22:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555953779; cv=none; d=google.com; s=arc-20160816; b=CRbhDCvquZqB3vU8DvAj7Sr97FSBcshx5qLU5pAcwmJA5gabH4SNQGM77I+NACBJjS 6UBcEYOAmaVUegMLdsO25qApPXEyEb0agyqS+nxSutGuPCmoPqSiO0jttTd5FeQezVqP ZVHnAIBsoLz6hEa36G+tm7+RQQ4UnWaqcQYG2l1JOzTI6olzPDZQENx1jCtw+jyaiW/t vH4TIDv6kwfN8iTfwaJqWZHR8hfEPa/r/W+er6h7ej9+SlxXXzcSz6rByvEfXzbHFvgl +qZ99tzHfBjt4SHVRFtRHuEld0Sw5n54tViPZOK79xANoo4twS8htq/Ftfie0eytWFHw Im2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=ebT1zd4br27smf6EZfBkxJgHdh7UMLcjjUXNrZyZOT8=; b=H53LEziTwgv/d0EB7ccBvBu6+IvN9ybnkNXbYVeH4vS+2dTqNGHgkAairf5UWa77E8 mTtFpMwYBPSq7g60I6Gji4Kw0D/TsUpbEIPXLU0yLPL9iarWGJCrgf0YgK6w8CTPrk3C JfVaKt7vBjYAdoqGboLZn6QoKC65mFjI0ZmA4ydFGxXsN32o9eoNRZtaIcZ4BgcIT8VX 6cG+goldbpG8gAI/c56GTTfe1A3Sg5l9N4yu+s7mn4qAUc+fw3bJYpObAcr1cgLJgFAq bpdGq/H7k7UTsfZs3eTi0x2uz4acriE2GXfae2bt1S3plBC/O0FcLHEIJxdjhLedZqNJ V7Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=qoaKDLJK; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q4si13481217plr.376.2019.04.22.10.22.43; Mon, 22 Apr 2019 10:22:59 -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=@google.com header.s=20161025 header.b=qoaKDLJK; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728371AbfDVQoQ (ORCPT + 99 others); Mon, 22 Apr 2019 12:44:16 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:38541 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728345AbfDVQoO (ORCPT ); Mon, 22 Apr 2019 12:44:14 -0400 Received: by mail-ed1-f68.google.com with SMTP id c1so3974649edk.5 for ; Mon, 22 Apr 2019 09:44:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=ebT1zd4br27smf6EZfBkxJgHdh7UMLcjjUXNrZyZOT8=; b=qoaKDLJKDRDOLrUU1AMfafnGpgw5ntc5sL4OzwAdUD9UBmbl7AExjhkEGTNfY6XeU0 QQz5nKk/lTZnDs1SPLSXvCfySEq8bMWDBtdnYpckG33aRLTmmzae/a/9d/aff78DXQyI ns3VXRWSR/ZycgsZVnPpeuYksYLvN1TxZNuEXIHPslOPQ3Q9FJJXzul+gh+z3j7U+Wjp TjZ/Ccxg4j1GFxgdHsmv/QTrk8z3O7p5C6USfDs/xxrjPUNZV4PNIAO3GRDjo3dSpjti Js/nGX73UByJQlxW/0RpL/88hum1P+lztKC3LfJUnlaKaCzO3gsKC/stEA+rV2pUKnap 2W1g== 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:content-transfer-encoding; bh=ebT1zd4br27smf6EZfBkxJgHdh7UMLcjjUXNrZyZOT8=; b=RQsb2RB/RJ8YrcYJxVr26WEfyxKsi7bd9XWUMLfdA3XhdEo7NUotuAX9fbfRI/58ug 1pJpNZWvreYAbmsh6tFsENFQGtrn++b2XgsZk9m/6y7SxZKgKv9O/AuhGYtRoGN4GWjk rGiVrnYwlmSgVtIM0PkoKxZfhisrMEM44Nf20OPt/3DNMx68IXESFN80lh5UGIx3Tbct AwB7hx4TU6BwDmsUFVaMNZQW126Ik4DqeJuRN/kyI6Sf8WZHSG5W0jU2d+z0pM74jxEo yYqcM+SrnBbH1mePEZW28y2tOy4RqDzdWnsQVZYyzHV4RiJ65PYSXVXd5h8NvaJ7uRwN Yuhg== X-Gm-Message-State: APjAAAVXHpGK/WKjMWiqG30ut4VAZAan0t34UdRUazDDnEyDKpeavrMN x766s3afbLPlddsEa5X6cr7cbF6SJjoh1EeGdoITHg== X-Received: by 2002:a17:906:4b10:: with SMTP id y16mr10098502eju.19.1555951452181; Mon, 22 Apr 2019 09:44:12 -0700 (PDT) MIME-Version: 1.0 References: <20190416170701.50333-1-wvw@google.com> <1555923800.26198.30.camel@intel.com> In-Reply-To: <1555923800.26198.30.camel@intel.com> From: Wei Wang Date: Mon, 22 Apr 2019 09:44:01 -0700 Message-ID: Subject: Re: [PATCH] thermal: core: skip update disabled thermal zones after suspend To: Zhang Rui Cc: Wei Wang , Eduardo Valentin , Daniel Lezcano , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 22, 2019 at 2:03 AM Zhang Rui wrote: > > On =E4=BA=8C, 2019-04-16 at 10:07 -0700, Wei Wang wrote: > > It is unnecessary to update disabled thermal zones post suspend and > > sometimes leads error/warning in bad behaved thermal drivers. > > > a good catch, and in fact, there are more issues about thermal handling > for disabled thermal zones, like we're able to read the temperature of > disabled thermal zones, either via sysfs or via function calls like > thermal_zone_device_update. Thanks Rui for following up. Yes, we noticed the same behavior. Right now, individual thermal driver can still respect set_mode and present value meaningful or return error when thermal zone disabled, and that's what we do locally. Currently, sysfs-api documents "Preventing kernel thermal zone driver actions upon trip points so that user application can take full charge of the thermal management.", so is it intended for some other agents in kernel or user land polling temperature with function call or sysfs respectively? Thanks! -Wei > For this patch, I will take it as it fixes one of the problem. > > thanks, > rui > > > Signed-off-by: Wei Wang > > --- > > drivers/thermal/thermal_core.c | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/drivers/thermal/thermal_core.c > > b/drivers/thermal/thermal_core.c > > index 6590bb5cb688..5baf5cfab999 100644 > > --- a/drivers/thermal/thermal_core.c > > +++ b/drivers/thermal/thermal_core.c > > @@ -1494,6 +1494,7 @@ static int thermal_pm_notify(struct > > notifier_block *nb, > > unsigned long mode, void *_unused) > > { > > struct thermal_zone_device *tz; > > + enum thermal_device_mode tz_mode; > > > > switch (mode) { > > case PM_HIBERNATION_PREPARE: > > @@ -1506,6 +1507,13 @@ static int thermal_pm_notify(struct > > notifier_block *nb, > > case PM_POST_SUSPEND: > > atomic_set(&in_suspend, 0); > > list_for_each_entry(tz, &thermal_tz_list, node) { > > + tz_mode =3D THERMAL_DEVICE_ENABLED; > > + if (tz->ops->get_mode) > > + tz->ops->get_mode(tz, &tz_mode); > > + > > + if (tz_mode =3D=3D THERMAL_DEVICE_DISABLED) > > + continue; > > + > > thermal_zone_device_init(tz); > > thermal_zone_device_update(tz, > > THERMAL_EVENT_UNS > > PECIFIED);