From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1BFFC4363A for ; Thu, 22 Oct 2020 18:51:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 627D124640 for ; Thu, 22 Oct 2020 18:51:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S369604AbgJVSvA (ORCPT ); Thu, 22 Oct 2020 14:51:00 -0400 Received: from mga14.intel.com ([192.55.52.115]:4042 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2900104AbgJVSvA (ORCPT ); Thu, 22 Oct 2020 14:51:00 -0400 IronPort-SDR: DxJGAI4pPgtfL92gkoEkNTj9FEMrk2A+LUrrOd85pVmMH5qg6B/WtIfldq8rCGQcS1iva0TXH+ 5R9ngU/RuCGA== X-IronPort-AV: E=McAfee;i="6000,8403,9782"; a="166794624" X-IronPort-AV: E=Sophos;i="5.77,404,1596524400"; d="scan'208";a="166794624" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Oct 2020 11:50:59 -0700 IronPort-SDR: SsIR/EaZs7+GXJcbJhLWhCvU/2vnQODdSIAq5PLynYjpFI+R/HD7pjtT4S55ceI7LJewXCrmY1 hM25LrCqvqZg== X-IronPort-AV: E=Sophos;i="5.77,404,1596524400"; d="scan'208";a="302426113" Received: from chenyu-office.sh.intel.com ([10.239.158.173]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Oct 2020 11:50:58 -0700 Date: Fri, 23 Oct 2020 02:53:20 +0800 From: Chen Yu To: Andy Shevchenko Cc: "Rafael J. Wysocki" , Len Brown , Greg Kroah-Hartman , Andy Shevchenko , Linux PM , Linux Kernel Mailing List Subject: Re: [PATCH][v2] PM / sysfs: Expose suspend resume driver flags in sysfs Message-ID: <20201022185320.GA8811@chenyu-office.sh.intel.com> References: <20201022085244.1860-1-yu.c.chen@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Hi Andy, On Thu, Oct 22, 2020 at 04:36:25PM +0300, Andy Shevchenko wrote: > On Thu, Oct 22, 2020 at 12:24 PM Chen Yu wrote: > > > > Currently there are 4 driver flags to control system suspend/resume > > behavior: DPM_FLAG_NO_DIRECT_COMPLETE, DPM_FLAG_SMART_PREPARE, > > DPM_FLAG_SMART_SUSPEND and DPM_FLAG_MAY_SKIP_RESUME. Make these flags > > visible in sysfs as read-only to get a brief understanding of the > > expected behavior of each device during suspend/resume, so as to > > facilitate suspend/resume debugging/tuning. > > > > For example: > > /sys/devices/pci0000:00/0000:00:15.1/power/driver_flags:4 > > (DPM_FLAG_SMART_SUSPEND) > > > > /sys/devices/pci0000:00/0000:00:07.3/power/driver_flags:5 > > (DPM_FLAG_NO_DIRECT_COMPLETE | DPM_FLAG_SMART_SUSPEND) > > ... > > > +What: /sys/devices/.../power/driver_flags > > +Date: October 2020 > > +Contact: Chen Yu > > +Description: > > + The /sys/devices/.../driver_flags attribute contains the driver > > + flags to control system suspend/resume. The flag is a combination > > + of DPM_FLAG_NO_DIRECT_COMPLETE, DPM_FLAG_SMART_PREPARE, > > + DPM_FLAG_SMART_SUSPEND and DPM_FLAG_MAY_SKIP_RESUME, or 0 if the > > + driver has not set any flag. > > > This attribute is read-only. If > > + CONFIG_PM_ADVANCED_DEBUG is not set this attribute is empty. > > Which makes me wonder why we even expose this if the above is not set. > > ... > It will not be exposed if the config is disabled. 'empty' means 'not present' I think. > > +static struct attribute *pm_driver_flags_attrs[] = { > > +#ifdef CONFIG_PM_ADVANCED_DEBUG > > +#ifdef CONFIG_PM_SLEEP > > + &dev_attr_driver_flags.attr, > > +#endif > > +#endif > > > + NULL, > > No comma here, please. I think I commented on this internally. > Sorry I misunderstood your point previously, I can change in next version. But might need to wait for Greg to decide if this item should be exposed or not first. Thanks, Chenyu > > +}; > > -- > With Best Regards, > Andy Shevchenko