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: <1652860121-24092-3-git-send-email-quic_vivekuma@quicinc.com>
Date:   Wed, 18 May 2022 13:18:37 +0530
From:   Vivek Kumar <quic_vivekuma@...cinc.com>
To:     <corbet@....net>, <catalin.marinas@....com>, <will@...nel.org>,
        <tglx@...utronix.de>, <maz@...nel.org>, <axboe@...nel.dk>,
        <rafael@...nel.org>, <akpm@...ux-foundation.org>,
        <linux-doc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-block@...r.kernel.org>, <linux-pm@...r.kernel.org>,
        <linux-mm@...ck.org>
CC:     <len.brown@...el.com>, <pavel@....cz>, <paulmck@...nel.org>,
        <bp@...e.de>, <keescook@...omium.org>, <songmuchun@...edance.com>,
        <rdunlap@...radead.org>, <damien.lemoal@...nsource.wdc.com>,
        <pasha.tatashin@...een.com>, <tabba@...gle.com>, <ardb@...nel.org>,
        <tsoni@...cinc.com>, <quic_psodagud@...cinc.com>,
        <quic_svaddagi@...cinc.com>,
        Vivek Kumar <quic_vivekuma@...cinc.com>,
        Prasanna Kumar <quic_kprasan@...cinc.com>
Subject: [RFC 2/6] PM: Hibernate: Add option to disable disk offset randomization

Add a kernel parameter to disable the disk offset randomization
for SSD devices in which such feature is available at the
firmware level. This is helpful in improving hibernation
resume time.

Signed-off-by: Vivek Kumar <quic_vivekuma@...cinc.com>
Signed-off-by: Prasanna Kumar <quic_kprasan@...cinc.com>
---
 Documentation/admin-guide/kernel-parameters.txt | 11 +++++++++++
 kernel/power/swap.c                             |  9 +++++++++
 2 files changed, 20 insertions(+)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 666ade9..06b4f10 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -5192,6 +5192,17 @@
 			Useful for devices that are detected asynchronously
 			(e.g. USB and MMC devices).
 
+	noswap_randomize
+			Kernel uses random disk offsets to help with wear-levelling
+			of SSD devices, while saving the hibernation snapshot image to
+			disk. Use this parameter to disable this feature for SSD
+			devices in scenarios when, such randomization is addressed at
+			the firmware level and hibenration image is not re-generated
+			frequently.
+			(Useful for improving hibernation resume time as snapshot pages
+			are available in disk serially and can be read in bigger chunks
+			without seeking)
+
 	retain_initrd	[RAM] Keep initrd memory after extraction
 
 	rfkill.default_state=
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 91fffdd..8d5c811 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -44,6 +44,7 @@ u32 swsusp_hardware_signature;
  */
 static bool clean_pages_on_read;
 static bool clean_pages_on_decompress;
+static bool noswap_randomize;
 
 /*
  *	The swap map is a data structure used for keeping track of each page
@@ -1616,3 +1617,11 @@ static int __init swsusp_header_init(void)
 }
 
 core_initcall(swsusp_header_init);
+
+static int __init noswap_randomize_setup(char *str)
+{
+	noswap_randomize = true;
+	return 1;
+}
+
+__setup("noswap_randomize", noswap_randomize_setup);
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ