Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5569410rwb; Mon, 5 Dec 2022 00:33:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf5xiJF29u9lKk7mHDPYl2xPry4XZPog/QG6QsPYLlXhu78jurciOkUWHZmPMGDpsIB/ln7F X-Received: by 2002:a17:90a:460b:b0:218:8a84:aeca with SMTP id w11-20020a17090a460b00b002188a84aecamr81041728pjg.63.1670229215319; Mon, 05 Dec 2022 00:33:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670229215; cv=none; d=google.com; s=arc-20160816; b=Aq8FGIYu6XnHHTuvGh/5btGjlGsiau4KkNrAlnQ4fiZHqFU++fXUA/kvaLN1R8DzIr gWaxFrD6TVCpxvsxaljK83mBI8ljMLh0T9rGBLFYWNDg2h1STa/iF7x67ai4mN2OmfDy SBxXK32ldmT0SdNjS+KDLFrkCL8/XJvudkCFTthxp3cscukX3mmihAEINTWE0Cd4Tvk9 hbiekEA8WT28z1XGD3/4BQGUihmw5vbgYlSVQF/MGLTCHzO+xFXEHCYndNSl6xEGl9/L ADlSD/JexqBsR4+XkX6WYZMqVgZO7rrB4CyUea6bMPg9BC6cZ4ih1IoPWk7Ndsm1VyAe sPWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=BkxAmQGJUk/dEbSzEClwrDdZXw8I9zreMSKTWGjGrLs=; b=A12co9gMnCVsg6lLE8BBtAzmcPQlAeX+k1cDatvKtdjcYfs+U1s70UVYocU2QFAqhA leo00pKyo7wxbw1PD5ghovDFTWLLdVlc2zgITQElznhuh+olYVVk17Gv9FrOD7P8z3Tx rVJHdmFlvNMkvdQPKkExXyqaoqF/ai37Qbg/XAXPluJGvdJY9428vtH07TqlFi8qDJuS UAVJIuemMTlelzDSjsugH82e8ZotGef9uKwwH4s8LQICttb0cWsuXI8iwvrZ1dXwV8TT Pj2bdVW7yS4akGWG9EjqUiJ5iR/+yWZ5cNKcrHwpGI2d/AhIcUYU43NDaHjm82X/jpCV IO2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="ASrE/PTQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p10-20020a056a000b4a00b005750855ff7dsi4868646pfo.107.2022.12.05.00.33.24; Mon, 05 Dec 2022 00:33:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="ASrE/PTQ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232006AbiLEINz (ORCPT + 82 others); Mon, 5 Dec 2022 03:13:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231976AbiLEINw (ORCPT ); Mon, 5 Dec 2022 03:13:52 -0500 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A24E315A32; Mon, 5 Dec 2022 00:13:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670228024; x=1701764024; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=KBYBt9muVBeTe/8PxUs+35MJ6giaVa/uKEoyV3CXYKM=; b=ASrE/PTQPI5zGOMeekdZrs7MKlyu9gjdpcUkKqrS7sDdmSxQNyy1BM0J WJSAQPQeuquD0PKKhDn5uvs9xWep83Zp91VXi7JwjH691uurL8Mtx8EW6 K1c1F3/NcyYtJdxOn0YTi73zYIT12UjAEHJMQmnsOAcOtzq19hl59VrZk L1MQkyf4lNhgkYpdySTUloTcC2/4CD2vyFZmudb+9fhS4+RjmqaMJ03Rj b0RI7Fwz/8KyLlAiHs0BbpUuWmwDAkxLxxPOVIa8zEH0RGjMv1/LzpDoX qIeoedPHBSa5ENFckhMNIdUWAeN+CxkmZHINSQxGMdidUyQ9m2j3RhXmS w==; X-IronPort-AV: E=McAfee;i="6500,9779,10551"; a="380584487" X-IronPort-AV: E=Sophos;i="5.96,218,1665471600"; d="scan'208";a="380584487" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2022 00:13:43 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10551"; a="787980854" X-IronPort-AV: E=Sophos;i="5.96,218,1665471600"; d="scan'208";a="787980854" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO [10.0.2.15]) ([10.252.55.104]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Dec 2022 00:13:38 -0800 Message-ID: Date: Mon, 5 Dec 2022 10:13:35 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.5.1 Subject: Re: [PATCH v1 2/2] PM: runtime: Relocate rpm_callback() right after __rpm_callback() Content-Language: en-US To: "Rafael J. Wysocki" , Linux PM Cc: LKML , Tushar Nimkar , "Rafael J. Wysocki" , Nitin Rawat , Peter Wang , Alan Stern , Ulf Hansson References: <5627469.DvuYhMxLoT@kreacher> <2264402.ElGaqSPkdT@kreacher> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki In-Reply-To: <2264402.ElGaqSPkdT@kreacher> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/12/22 16:32, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > 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 Reviewed-by: Adrian Hunter > --- > 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. > > >