lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <ADB156F9-27D6-4484-A2E7-AD0EFF41735B@canonical.com>
Date:   Thu, 26 Jul 2018 15:38:27 +0800
From:   Kai-Heng Feng <kai.heng.feng@...onical.com>
To:     Alan Stern <stern@...land.harvard.edu>
Cc:     arnd@...db.de, gregkh@...uxfoundation.org, ulf.hansson@...aro.org,
        bauer.chen@...ltek.com, ricky_wu@...ltek.com,
        linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org
Subject: Re: [PATCH 4/5] memstick: rtsx_usb_ms: Support runtime power
 management



> On 2018Jul26, at 01:59, Alan Stern <stern@...land.harvard.edu> wrote:
> 
> On Wed, 25 Jul 2018, Kai-Heng Feng wrote:
> 
>> In order to let host's parent device, rtsx_usb, to use USB remote wake
>> up signaling to do card detection, it needs to be suspended. Hence it's
>> necessary to add runtime PM support for the memstick host.
>> 
>> To keep memstick host stays suspended when it's not in use, convert the
>> card detection function from kthread to delayed_work, which can be
>> scheduled when the host is resumed and can be canceled when the host is
>> suspended.
>> 
>> Use an idle function check if there's no card and the power mode is
>> MEMSTICK_POWER_OFF. If both criteria are met, put the device to suspend.
>> 
>> Signed-off-by: Kai-Heng Feng <kai.heng.feng@...onical.com>
> 
> I'm not familiar enough with this driver to comment on specific
> instances, but you should carefully go through the code and make sure
> that you use pm_runtime_get_noresume() and pm_runtime_put_noidle()
> correctly.
> 
> The basic idea is to use these when you know beforehand that the device
> is already at full power (for _get_noresume) and the usage count will
> not go to 0 (for _put_noidle).  If you aren't certain of these
> requirements then you should call pm_runtime_get_sync() and
> pm_runtime_put().

There are two different uses for pm_runtime helpers.

The first use case is to prevent parent device, rtsx_usb, from suspending:
pm_runtime_get_noresume()
rtsx_usb_read_register()
pm_runtime_put_noidle()

The second use case, to manage memstick host itself.
memstick_detect_change() powers the host on if there’s a card in slot, and it powers host off when there’s no card.
Once memstick_detect_change() is done, we can check if the host can be suspended.

So we are sure the timing when the power is on or off.

Kai-Heng

> 
> Alan Stern
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ