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] [thread-next>] [day] [month] [year] [list]
Message-ID: <e679e199-3850-80e7-e31c-b3e0eb93aa0c@intel.com>
Date:   Mon, 5 Dec 2022 10:13:35 +0200
From:   Adrian Hunter <adrian.hunter@...el.com>
To:     "Rafael J. Wysocki" <rjw@...ysocki.net>,
        Linux PM <linux-pm@...r.kernel.org>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        Tushar Nimkar <quic_tnimkar@...cinc.com>,
        "Rafael J. Wysocki" <rafael@...nel.org>,
        Nitin Rawat <quic_nitirawa@...cinc.com>,
        Peter Wang <peter.wang@...iatek.com>,
        Alan Stern <stern@...land.harvard.edu>,
        Ulf Hansson <ulf.hansson@...aro.org>
Subject: Re: [PATCH v1 2/2] PM: runtime: Relocate rpm_callback() right after
 __rpm_callback()

On 2/12/22 16:32, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> 
> Because rpm_callback() is a wrapper around __rpm_callback(), and the
> only caller of it after the change eliminating an invocation of it
> from rpm_idle(), move the former next to the latter to make the code
> a bit easier to follow.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>

Reviewed-by: Adrian Hunter <adrian.hunter@...el.com>

> ---
>  drivers/base/power/runtime.c |   64 +++++++++++++++++++++----------------------
>  1 file changed, 32 insertions(+), 32 deletions(-)
> 
> Index: linux-pm/drivers/base/power/runtime.c
> ===================================================================
> --- linux-pm.orig/drivers/base/power/runtime.c
> +++ linux-pm/drivers/base/power/runtime.c
> @@ -422,6 +422,38 @@ fail:
>  }
>  
>  /**
> + * rpm_callback - Run a given runtime PM callback for a given device.
> + * @cb: Runtime PM callback to run.
> + * @dev: Device to run the callback for.
> + */
> +static int rpm_callback(int (*cb)(struct device *), struct device *dev)
> +{
> +	int retval;
> +
> +	if (dev->power.memalloc_noio) {
> +		unsigned int noio_flag;
> +
> +		/*
> +		 * Deadlock might be caused if memory allocation with
> +		 * GFP_KERNEL happens inside runtime_suspend and
> +		 * runtime_resume callbacks of one block device's
> +		 * ancestor or the block device itself. Network
> +		 * device might be thought as part of iSCSI block
> +		 * device, so network device and its ancestor should
> +		 * be marked as memalloc_noio too.
> +		 */
> +		noio_flag = memalloc_noio_save();
> +		retval = __rpm_callback(cb, dev);
> +		memalloc_noio_restore(noio_flag);
> +	} else {
> +		retval = __rpm_callback(cb, dev);
> +	}
> +
> +	dev->power.runtime_error = retval;
> +	return retval != -EACCES ? retval : -EIO;
> +}
> +
> +/**
>   * rpm_idle - Notify device bus type if the device can be suspended.
>   * @dev: Device to notify the bus type about.
>   * @rpmflags: Flag bits.
> @@ -505,38 +537,6 @@ static int rpm_idle(struct device *dev,
>  }
>  
>  /**
> - * rpm_callback - Run a given runtime PM callback for a given device.
> - * @cb: Runtime PM callback to run.
> - * @dev: Device to run the callback for.
> - */
> -static int rpm_callback(int (*cb)(struct device *), struct device *dev)
> -{
> -	int retval;
> -
> -	if (dev->power.memalloc_noio) {
> -		unsigned int noio_flag;
> -
> -		/*
> -		 * Deadlock might be caused if memory allocation with
> -		 * GFP_KERNEL happens inside runtime_suspend and
> -		 * runtime_resume callbacks of one block device's
> -		 * ancestor or the block device itself. Network
> -		 * device might be thought as part of iSCSI block
> -		 * device, so network device and its ancestor should
> -		 * be marked as memalloc_noio too.
> -		 */
> -		noio_flag = memalloc_noio_save();
> -		retval = __rpm_callback(cb, dev);
> -		memalloc_noio_restore(noio_flag);
> -	} else {
> -		retval = __rpm_callback(cb, dev);
> -	}
> -
> -	dev->power.runtime_error = retval;
> -	return retval != -EACCES ? retval : -EIO;
> -}
> -
> -/**
>   * rpm_suspend - Carry out runtime suspend of given device.
>   * @dev: Device to suspend.
>   * @rpmflags: Flag bits.
> 
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ