Merge branches 'pm-sleep', 'powercap' and 'pm-tools'
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 26 Oct 2023 13:16:03 +0000 (15:16 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 26 Oct 2023 13:16:03 +0000 (15:16 +0200)
Merge updates related to system sleep handling, one power capping update
and one PM utility update for 6.7-rc1:

 - Use __get_safe_page() rather than touching the list in hibernation
   snapshot code (Brian Geffon).

 - Fix symbol export for _SIMPLE_ variants of _PM_OPS() (Raag Jadav).

 - Clean up sync_read handling in snapshot_write_next() (Brian Geffon).

 - Fix kerneldoc comments for swsusp_check() and swsusp_close() to
   better match code (Christoph Hellwig).

 - Downgrade BIOS locked limits pr_warn() in the Intel RAPL power
   capping driver to pr_debug() (Ville Syrjälä).

 - Change the minimum python version for the intel_pstate_tracer utility
   from 2.7 to 3.6 (Doug Smythies).

* pm-sleep:
  PM: hibernate: fix the kerneldoc comment for swsusp_check() and swsusp_close()
  PM: hibernate: Clean up sync_read handling in snapshot_write_next()
  PM: sleep: Fix symbol export for _SIMPLE_ variants of _PM_OPS()
  PM: hibernate: Use __get_safe_page() rather than touching the list

* powercap:
  powercap: intel_rapl: Downgrade BIOS locked limits pr_warn() to pr_debug()

* pm-tools:
  tools/power/x86/intel_pstate_tracer: python minimum version

drivers/powercap/intel_rapl_common.c
include/linux/pm.h
kernel/power/snapshot.c
kernel/power/swap.c
tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py

index 40a2cc649c79b4cb6961cc2382b98b0b942efffb..2feed036c1cd415ef98a7ea3437ebd5bc7429b10 100644 (file)
@@ -892,7 +892,7 @@ static int rapl_write_pl_data(struct rapl_domain *rd, int pl,
                return -EINVAL;
 
        if (rd->rpl[pl].locked) {
-               pr_warn("%s:%s:%s locked by BIOS\n", rd->rp->name, rd->name, pl_names[pl]);
+               pr_debug("%s:%s:%s locked by BIOS\n", rd->rp->name, rd->name, pl_names[pl]);
                return -EACCES;
        }
 
index 4c9f571609c83fe1c3111e524b5656e5265f9332..92a4f69de0e803f9b6edc6eba8a6d6d173265de5 100644 (file)
@@ -374,24 +374,39 @@ const struct dev_pm_ops name = { \
        RUNTIME_PM_OPS(runtime_suspend_fn, runtime_resume_fn, idle_fn) \
 }
 
-#ifdef CONFIG_PM
-#define _EXPORT_DEV_PM_OPS(name, license, ns)                          \
+#define _EXPORT_PM_OPS(name, license, ns)                              \
        const struct dev_pm_ops name;                                   \
        __EXPORT_SYMBOL(name, license, ns);                             \
        const struct dev_pm_ops name
-#define EXPORT_PM_FN_GPL(name)         EXPORT_SYMBOL_GPL(name)
-#define EXPORT_PM_FN_NS_GPL(name, ns)  EXPORT_SYMBOL_NS_GPL(name, ns)
-#else
-#define _EXPORT_DEV_PM_OPS(name, license, ns)                          \
+
+#define _DISCARD_PM_OPS(name, license, ns)                             \
        static __maybe_unused const struct dev_pm_ops __static_##name
+
+#ifdef CONFIG_PM
+#define _EXPORT_DEV_PM_OPS(name, license, ns)          _EXPORT_PM_OPS(name, license, ns)
+#define EXPORT_PM_FN_GPL(name)                         EXPORT_SYMBOL_GPL(name)
+#define EXPORT_PM_FN_NS_GPL(name, ns)                  EXPORT_SYMBOL_NS_GPL(name, ns)
+#else
+#define _EXPORT_DEV_PM_OPS(name, license, ns)          _DISCARD_PM_OPS(name, license, ns)
 #define EXPORT_PM_FN_GPL(name)
 #define EXPORT_PM_FN_NS_GPL(name, ns)
 #endif
 
-#define EXPORT_DEV_PM_OPS(name) _EXPORT_DEV_PM_OPS(name, "", "")
-#define EXPORT_GPL_DEV_PM_OPS(name) _EXPORT_DEV_PM_OPS(name, "GPL", "")
-#define EXPORT_NS_DEV_PM_OPS(name, ns) _EXPORT_DEV_PM_OPS(name, "", #ns)
-#define EXPORT_NS_GPL_DEV_PM_OPS(name, ns) _EXPORT_DEV_PM_OPS(name, "GPL", #ns)
+#ifdef CONFIG_PM_SLEEP
+#define _EXPORT_DEV_SLEEP_PM_OPS(name, license, ns)    _EXPORT_PM_OPS(name, license, ns)
+#else
+#define _EXPORT_DEV_SLEEP_PM_OPS(name, license, ns)    _DISCARD_PM_OPS(name, license, ns)
+#endif
+
+#define EXPORT_DEV_PM_OPS(name)                                _EXPORT_DEV_PM_OPS(name, "", "")
+#define EXPORT_GPL_DEV_PM_OPS(name)                    _EXPORT_DEV_PM_OPS(name, "GPL", "")
+#define EXPORT_NS_DEV_PM_OPS(name, ns)                 _EXPORT_DEV_PM_OPS(name, "", #ns)
+#define EXPORT_NS_GPL_DEV_PM_OPS(name, ns)             _EXPORT_DEV_PM_OPS(name, "GPL", #ns)
+
+#define EXPORT_DEV_SLEEP_PM_OPS(name)                  _EXPORT_DEV_SLEEP_PM_OPS(name, "", "")
+#define EXPORT_GPL_DEV_SLEEP_PM_OPS(name)              _EXPORT_DEV_SLEEP_PM_OPS(name, "GPL", "")
+#define EXPORT_NS_DEV_SLEEP_PM_OPS(name, ns)           _EXPORT_DEV_SLEEP_PM_OPS(name, "", #ns)
+#define EXPORT_NS_GPL_DEV_SLEEP_PM_OPS(name, ns)       _EXPORT_DEV_SLEEP_PM_OPS(name, "GPL", #ns)
 
 /*
  * Use this if you want to use the same suspend and resume callbacks for suspend
@@ -404,19 +419,19 @@ const struct dev_pm_ops name = { \
        _DEFINE_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL)
 
 #define EXPORT_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
-       EXPORT_DEV_PM_OPS(name) = { \
+       EXPORT_DEV_SLEEP_PM_OPS(name) = { \
                SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
        }
 #define EXPORT_GPL_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \
-       EXPORT_GPL_DEV_PM_OPS(name) = { \
+       EXPORT_GPL_DEV_SLEEP_PM_OPS(name) = { \
                SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
        }
 #define EXPORT_NS_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn, ns)   \
-       EXPORT_NS_DEV_PM_OPS(name, ns) = { \
+       EXPORT_NS_DEV_SLEEP_PM_OPS(name, ns) = { \
                SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
        }
 #define EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn, ns)       \
-       EXPORT_NS_GPL_DEV_PM_OPS(name, ns) = { \
+       EXPORT_NS_GPL_DEV_SLEEP_PM_OPS(name, ns) = { \
                SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
        }
 
index 0f12e0a97e432e312f971bb9dae07639ffe1428b..50a15408c3fcadc19d1cf15e40afb2acb43e4007 100644 (file)
@@ -2545,8 +2545,9 @@ static void *get_highmem_page_buffer(struct page *page,
                pbe->copy_page = tmp;
        } else {
                /* Copy of the page will be stored in normal memory */
-               kaddr = safe_pages_list;
-               safe_pages_list = safe_pages_list->next;
+               kaddr = __get_safe_page(ca->gfp_mask);
+               if (!kaddr)
+                       return ERR_PTR(-ENOMEM);
                pbe->copy_page = virt_to_page(kaddr);
        }
        pbe->next = highmem_pblist;
@@ -2750,8 +2751,9 @@ static void *get_buffer(struct memory_bitmap *bm, struct chain_allocator *ca)
                return ERR_PTR(-ENOMEM);
        }
        pbe->orig_address = page_address(page);
-       pbe->address = safe_pages_list;
-       safe_pages_list = safe_pages_list->next;
+       pbe->address = __get_safe_page(ca->gfp_mask);
+       if (!pbe->address)
+               return ERR_PTR(-ENOMEM);
        pbe->next = restore_pblist;
        restore_pblist = pbe;
        return pbe->address;
@@ -2783,8 +2785,6 @@ next:
        if (handle->cur > 1 && handle->cur > nr_meta_pages + nr_copy_pages + nr_zero_pages)
                return 0;
 
-       handle->sync_read = 1;
-
        if (!handle->cur) {
                if (!buffer)
                        /* This makes the buffer be freed by swsusp_free() */
@@ -2827,7 +2827,6 @@ next:
                        memory_bm_position_reset(&zero_bm);
                        restore_pblist = NULL;
                        handle->buffer = get_buffer(&orig_bm, &ca);
-                       handle->sync_read = 0;
                        if (IS_ERR(handle->buffer))
                                return PTR_ERR(handle->buffer);
                }
@@ -2837,9 +2836,8 @@ next:
                handle->buffer = get_buffer(&orig_bm, &ca);
                if (IS_ERR(handle->buffer))
                        return PTR_ERR(handle->buffer);
-               if (handle->buffer != buffer)
-                       handle->sync_read = 0;
        }
+       handle->sync_read = (handle->buffer == buffer);
        handle->cur++;
 
        /* Zero pages were not included in the image, memset it and move on. */
index 74edbce2320bae543c522b97301ec9719725cfa1..a64af0a552f9661a6b20a9b05dac41813262586f 100644 (file)
@@ -1513,7 +1513,7 @@ end:
 static void *swsusp_holder;
 
 /**
- * swsusp_check - Check for swsusp signature in the resume device
+ * swsusp_check - Open the resume device and check for the swsusp signature.
  * @exclusive: Open the resume device exclusively.
  */
 
@@ -1564,7 +1564,7 @@ put:
 }
 
 /**
- * swsusp_close - close swap device.
+ * swsusp_close - close resume device.
  * @exclusive: Close the resume device which is exclusively opened.
  */
 
index ec3323100e1aa575e3ec4951168665d26bf22775..38cfbdcdedb723ef6a845a7cadfe0ee767f1fb2b 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 # SPDX-License-Identifier: GPL-2.0-only
 # -*- coding: utf-8 -*-
 #
@@ -11,11 +11,11 @@ then this utility enables and collects trace data for a user specified interval
 and generates performance plots.
 
 Prerequisites:
-    Python version 2.7.x or higher
+    Python version 3.6.x or higher
     gnuplot 5.0 or higher
-    gnuplot-py 1.8 or higher
+    python3-gnuplot 1.8 or higher
     (Most of the distributions have these required packages. They may be called
-     gnuplot-py, phython-gnuplot or phython3-gnuplot, gnuplot-nox, ... )
+     gnuplot-py, python-gnuplot or python3-gnuplot, gnuplot-nox, ... )
 
     HWP (Hardware P-States are disabled)
     Kernel config for Linux trace is enabled
@@ -23,7 +23,7 @@ Prerequisites:
     see print_help(): for Usage and Output details
 
 """
-from __future__ import print_function
+
 from datetime import datetime
 import subprocess
 import os
@@ -562,7 +562,7 @@ if __name__ == "__main__":
 
     # Temporary (or perhaps not)
     cur_version = sys.version_info
-    print('python version (should be >= 2.7):')
+    print('python version (should be >= 3.6):')
     print(cur_version)
 
     # Left as "cleanup" for potential future re-run ability.