Message ID | cover.1700048610.git.quic_nprakash@quicinc.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp2498395vqg; Wed, 15 Nov 2023 04:23:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IHJIWoJPIqn5l6tFcVpmEcz8mZFIAfLODXKNrsEfeLfDwd1ipHYImWRPOtP9z0zyWlshGOl X-Received: by 2002:a17:902:74c3:b0:1cd:f94b:1823 with SMTP id f3-20020a17090274c300b001cdf94b1823mr4806010plt.64.1700051034862; Wed, 15 Nov 2023 04:23:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700051034; cv=none; d=google.com; s=arc-20160816; b=j03N+XNsUNMQgr9g1Gej21ixwW8q35W3/moASat28ZLoUmGQ5M9iSRUVRA/8jgZHya dJRuqsEL1/IIH6epIPf9hzDJoQ4CRHszNjsmNy1Dc4Nv1iNdUJl6Wb5+NTzaJSJvzCxb CaXOt2W9I3iVTLTc2cb/ZCJ8d771ecBUD2gNSDTzD8GuQ0eabzxNJy7JXniK0//63qVi /V4slyoVamjjkb7RyQV9OAclqK+LBTMQL/jSFCy6/MrgMXR2/1uFEDa0MkdAZLHoEngP Vm9eyAAXRTiD+W5dVVkdfo0ShRYMYYSAzj+x/of6P38D60h37VoIEjiu/KAwI+hu8yTg UKGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=lwJo36FxXJ4olmKQ64Cg9Xz4VwhSuoUcQGoRfsXDE9w=; fh=PhCH9IcXwvLURIDlYe4bSrjR/X6emC/3deCa6q9YO60=; b=kymmrDp9MFIz3BSNyl20wmxxZRVZycSnRjMmk1CTo1Pi2ImGvn7JH9QN7yyfex7qNa +3nqe52/h3/5Fhp8hjBZDsOhHBXVhulUk89MpG3wnXpenrsa8Tjx5BO4Cf3mjGTFDoVT SqEfKR3Y6RefAMLqAxMj3rokPhRzQPei5HhAulNqdhq1336wqpQCMrf7WKNT8Z/gljvO WSCsoly29VcPpzDPW/jOiDUTguyM+D45UlU4TdWxVQIjXpYLeISLC78gqgAJ7oJ+HvOh Hh9lZeKZoKheRd04l7B00gJk/Dsz32UN9D4jPwII6VS4hvKsj/WIUSrf4Tn0WDpJvnjN 2nfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Mgp+LLly; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id y23-20020a170902b49700b001c413905d87si9808653plr.49.2023.11.15.04.23.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 04:23:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Mgp+LLly; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id EF8E28024B1A; Wed, 15 Nov 2023 04:23:46 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343708AbjKOMXQ (ORCPT <rfc822;heyuhang3455@gmail.com> + 28 others); Wed, 15 Nov 2023 07:23:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234680AbjKOMXO (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 15 Nov 2023 07:23:14 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FA99C7; Wed, 15 Nov 2023 04:23:11 -0800 (PST) Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AF9N1pL002619; Wed, 15 Nov 2023 12:22:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=qcppdkim1; bh=lwJo36FxXJ4olmKQ64Cg9Xz4VwhSuoUcQGoRfsXDE9w=; b=Mgp+LLly7Xixb1a6+qIRZDCh8UALocCQM9IGCUeNZ4rXHEWoUExNcxMcvUlYfxerTHTI XK76ExWfjVuKylc/6alk8LM2WjUiZq0rLLdkYGxwnvXpniwPJ3apmf/z9/ps04HqIFOG yxPpzlnO6UVNH8QuNuY5ljO/LPHZd9CnkXNYo6aTo0ZtD/6yRx+CUHjXD8bcZxsKw5Gq T1tbOSbZcQKW4nXQsv9tzeS6kRjlUNjGofPSjP/abq8+0kN40V+HJm3lNJO0XY8dl1qi bwdT8fNg6ZVkg3jdiUDb7bNAv4pJRKgST1yffg+8AEn5oNA3hdiT9qH4UE0OhoPz4cW2 NQ== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3ucuac0f9k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 12:22:52 +0000 Received: from nalasex01b.na.qualcomm.com (nalasex01b.na.qualcomm.com [10.47.209.197]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 3AFCMoar031221 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Nov 2023 12:22:50 GMT Received: from hu-nprakash-blr.qualcomm.com (10.80.80.8) by nalasex01b.na.qualcomm.com (10.47.209.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.39; Wed, 15 Nov 2023 04:22:45 -0800 From: Nikhil V <quic_nprakash@quicinc.com> To: Pavel Machek <pavel@ucw.cz>, Len Brown <len.brown@intel.com>, "Rafael J. Wysocki" <rafael@kernel.org> CC: Nikhil V <quic_nprakash@quicinc.com>, Jonathan Corbet <corbet@lwn.net>, Randy Dunlap <rdunlap@infradead.org>, Peter Zijlstra <peterz@infradead.org>, "Steven Rostedt (Google)" <rostedt@goodmis.org>, Tejun Heo <tj@kernel.org>, "Paul E. McKenney" <paulmck@kernel.org>, Catalin Marinas <catalin.marinas@arm.com>, <linux-pm@vger.kernel.org>, <linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <quic_pkondeti@quicinc.com>, <quic_kprasan@quicinc.com>, <quic_mpilaniy@quicinc.com>, <quic_shrekk@quicinc.com>, <mpleshivenkov@google.com>, <ericyin@google.com> Subject: [PATCH RESEND v2 0/4] PM: hibernate: LZ4 compression support Date: Wed, 15 Nov 2023 17:52:06 +0530 Message-ID: <cover.1700048610.git.quic_nprakash@quicinc.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01b.na.qualcomm.com (10.47.209.197) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: eFVMwHeGwvUzHjWNMCDVoD16NeGX7UQk X-Proofpoint-GUID: eFVMwHeGwvUzHjWNMCDVoD16NeGX7UQk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-15_11,2023-11-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxlogscore=999 spamscore=0 malwarescore=0 mlxscore=0 bulkscore=0 clxscore=1011 adultscore=0 lowpriorityscore=0 impostorscore=0 priorityscore=1501 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311060000 definitions=main-2311150095 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 15 Nov 2023 04:23:47 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782632714107049316 X-GMAIL-MSGID: 1782632714107049316 |
Series |
PM: hibernate: LZ4 compression support
|
|
Message
Nikhil V
Nov. 15, 2023, 12:22 p.m. UTC
This patch series covers the following: 1. Renaming lzo* to generic names, except for lzo_xxx() APIs. This is used in the next patch where we move to crypto based APIs for compression. There are no functional changes introduced by this approach. 2. Replace LZO library calls with crypto generic APIs Currently for hibernation, LZO is the only compression algorithm available and uses the existing LZO library calls. However, there is no flexibility to switch to other algorithms which provides better results. The main idea is that different compression algorithms have different characteristics and hibernation may benefit when it uses alternate algorithms. By moving to crypto based APIs, it lays a foundation to use other compression algorithms for hibernation. 3. LZ4 compression Extend the support for LZ4 compression to be used with hibernation. The main idea is that different compression algorithms have different characteristics and hibernation may benefit when it uses any of these algorithms: a default algorithm, having higher compression rate but is slower(compression/decompression) and a secondary algorithm, that is faster(compression/decompression) but has lower compression rate. LZ4 algorithm has better decompression speeds over LZO. This reduces the hibernation image restore time. As per test results: LZO LZ4 Size before Compression(bytes) 682696704 682393600 Size after Compression(bytes) 146502402 155993547 Decompression Rate 335.02 MB/s 501.05 MB/s Restore time 4.4s 3.8s LZO is the default compression algorithm used for hibernation. Enable CONFIG_HIBERNATION_DEF_COMP_LZ4 to set the default compressor as LZ4. Compression Benchmarks: https://github.com/lz4/lz4 4. Support to select compression algorithm Currently the default compression algorithm is selected based on Kconfig. Introduce a kernel command line parameter "hib_compression" to override this behaviour. Users can set "hib_compression" command line parameter to specify the algorithm. Usage: LZO: hib_compression=lzo LZ4: hib_compression=lz4 LZO is the default compression algorithm used with hibernation. Changes in v2: - Fixed build issues reported by kernel test robot for ARCH=sh, [1]. [1] https://lore.kernel.org/oe-kbuild-all/202310171226.pLUPeuC7-lkp@intel.com/ Nikhil V (4): PM: hibernate: Rename lzo* to make it generic PM: hibernate: Move to crypto APIs for LZO compression PM: hibernate: Add support for LZ4 compression for hibernation PM: hibernate: Support to select compression algorithm .../admin-guide/kernel-parameters.txt | 6 + kernel/power/Kconfig | 26 ++- kernel/power/hibernate.c | 85 +++++++- kernel/power/power.h | 19 ++ kernel/power/swap.c | 189 +++++++++++------- 5 files changed, 251 insertions(+), 74 deletions(-) base-commit: b85ea95d086471afb4ad062012a4d73cd328fa86
Comments
On 11/15/2023 5:52 PM, Nikhil V wrote: > This patch series covers the following: > 1. Renaming lzo* to generic names, except for lzo_xxx() APIs. This is > used in the next patch where we move to crypto based APIs for > compression. There are no functional changes introduced by this > approach. > > > 2. Replace LZO library calls with crypto generic APIs > > Currently for hibernation, LZO is the only compression algorithm > available and uses the existing LZO library calls. However, there > is no flexibility to switch to other algorithms which provides better > results. The main idea is that different compression algorithms have > different characteristics and hibernation may benefit when it uses > alternate algorithms. > > By moving to crypto based APIs, it lays a foundation to use other > compression algorithms for hibernation. > > > 3. LZ4 compression > > Extend the support for LZ4 compression to be used with hibernation. > The main idea is that different compression algorithms have different > characteristics and hibernation may benefit when it uses any of these > algorithms: a default algorithm, having higher compression rate but is > slower(compression/decompression) and a secondary algorithm, that is > faster(compression/decompression) but has lower compression rate. > > LZ4 algorithm has better decompression speeds over LZO. This reduces > the hibernation image restore time. > As per test results: > LZO LZ4 > Size before Compression(bytes) 682696704 682393600 > Size after Compression(bytes) 146502402 155993547 > Decompression Rate 335.02 MB/s 501.05 MB/s > Restore time 4.4s 3.8s > > LZO is the default compression algorithm used for hibernation. Enable > CONFIG_HIBERNATION_DEF_COMP_LZ4 to set the default compressor as LZ4. > > Compression Benchmarks: https://github.com/lz4/lz4 > > > 4. Support to select compression algorithm > > Currently the default compression algorithm is selected based on > Kconfig. Introduce a kernel command line parameter "hib_compression" to > override this behaviour. > > Users can set "hib_compression" command line parameter to specify > the algorithm. > Usage: > LZO: hib_compression=lzo > LZ4: hib_compression=lz4 > LZO is the default compression algorithm used with hibernation. > > > Changes in v2: > - Fixed build issues reported by kernel test robot for ARCH=sh, [1]. > [1] https://lore.kernel.org/oe-kbuild-all/202310171226.pLUPeuC7-lkp@intel.com/ > > Nikhil V (4): > PM: hibernate: Rename lzo* to make it generic > PM: hibernate: Move to crypto APIs for LZO compression > PM: hibernate: Add support for LZ4 compression for hibernation > PM: hibernate: Support to select compression algorithm > > .../admin-guide/kernel-parameters.txt | 6 + > kernel/power/Kconfig | 26 ++- > kernel/power/hibernate.c | 85 +++++++- > kernel/power/power.h | 19 ++ > kernel/power/swap.c | 189 +++++++++++------- > 5 files changed, 251 insertions(+), 74 deletions(-) > > > base-commit: b85ea95d086471afb4ad062012a4d73cd328fa86 Hi @Rafael/@Pavel/@Len, Could you please let me know if you have any concerns on this approach? FYI: We have tested this on QEMU and its working fine. Logs(suspend): [ 75.242227] PM: Using 3 thread(s) for lz4 compression [ 75.243043] PM: Compressing and saving image data (17495 pages)... [ 75.243917] PM: Image saving progress: 0% [ 75.261727] PM: Image saving progress: 10% [ 75.277968] PM: Image saving progress: 20% [ 75.290927] PM: Image saving progress: 30% [ 75.305186] PM: Image saving progress: 40% [ 75.318252] PM: Image saving progress: 50% [ 75.330310] PM: Image saving progress: 60% [ 75.345906] PM: Image saving progress: 70% [ 75.359054] PM: Image saving progress: 80% [ 75.372176] PM: Image saving progress: 90% [ 75.388411] PM: Image saving progress: 100% [ 75.389775] PM: Image saving done [ 75.390397] PM: hibernation: Wrote 69980 kbytes in 0.14 seconds (499.85 MB/s) [ 75.391591] PM: Image size after compression: 28242 kbytes [ 75.393089] PM: S| [ 75.399784] sd 0:0:0:0: [sda] Synchronizing SCSI cache [ 75.439170] sd 0:0:0:0: [sda] Stopping disk [ 75.501461] ACPI: PM: Preparing to enter system sleep state S5 [ 75.502766] reboot: Power down Logs(resume): [ 1.063248] PM: hibernation: resume from hibernation [ 1.072868] Freezing user space processes [ 1.073707] Freezing user space processes completed (elapsed 0.000 seconds) [ 1.075192] OOM killer disabled. [ 1.075837] Freezing remaining freezable tasks [ 1.078010] Freezing remaining freezable tasks completed (elapsed 0.001 seconds) [ 1.087489] PM: Using 3 thread(s) for lz4 decompression [ 1.088570] PM: Loading and decompressing image data (17495 pages)... [ 1.125549] PM: Image loading progress: 0% [ 1.190380] PM: Image loading progress: 10% [ 1.204963] PM: Image loading progress: 20% [ 1.218988] PM: Image loading progress: 30% [ 1.233697] PM: Image loading progress: 40% [ 1.248658] PM: Image loading progress: 50% [ 1.262910] PM: Image loading progress: 60% [ 1.276966] PM: Image loading progress: 70% [ 1.290517] PM: Image loading progress: 80% [ 1.305427] PM: Image loading progress: 90% [ 1.320666] PM: Image loading progress: 100% [ 1.321866] PM: Image loading done [ 1.322599] PM: hibernation: Read 69980 kbytes in 0.23 seconds (304.26 MB/s) [ 1.324795] printk: Suspending console(s) (use no_console_suspend to debug) [ 74.943801] ata1.00: Entering standby power mode Thanks, Nikhil V
Hi, On Wed, Nov 29, 2023 at 11:20 AM Nikhil V <quic_nprakash@quicinc.com> wrote: > > > On 11/15/2023 5:52 PM, Nikhil V wrote: > > This patch series covers the following: > > 1. Renaming lzo* to generic names, except for lzo_xxx() APIs. This is > > used in the next patch where we move to crypto based APIs for > > compression. There are no functional changes introduced by this > > approach. > > > > > > 2. Replace LZO library calls with crypto generic APIs > > > > Currently for hibernation, LZO is the only compression algorithm > > available and uses the existing LZO library calls. However, there > > is no flexibility to switch to other algorithms which provides better > > results. The main idea is that different compression algorithms have > > different characteristics and hibernation may benefit when it uses > > alternate algorithms. > > > > By moving to crypto based APIs, it lays a foundation to use other > > compression algorithms for hibernation. > > > > > > 3. LZ4 compression > > > > Extend the support for LZ4 compression to be used with hibernation. > > The main idea is that different compression algorithms have different > > characteristics and hibernation may benefit when it uses any of these > > algorithms: a default algorithm, having higher compression rate but is > > slower(compression/decompression) and a secondary algorithm, that is > > faster(compression/decompression) but has lower compression rate. > > > > LZ4 algorithm has better decompression speeds over LZO. This reduces > > the hibernation image restore time. > > As per test results: > > LZO LZ4 > > Size before Compression(bytes) 682696704 682393600 > > Size after Compression(bytes) 146502402 155993547 > > Decompression Rate 335.02 MB/s 501.05 MB/s > > Restore time 4.4s 3.8s > > > > LZO is the default compression algorithm used for hibernation. Enable > > CONFIG_HIBERNATION_DEF_COMP_LZ4 to set the default compressor as LZ4. > > > > Compression Benchmarks: https://github.com/lz4/lz4 > > > > > > 4. Support to select compression algorithm > > > > Currently the default compression algorithm is selected based on > > Kconfig. Introduce a kernel command line parameter "hib_compression" to > > override this behaviour. > > > > Users can set "hib_compression" command line parameter to specify > > the algorithm. > > Usage: > > LZO: hib_compression=lzo > > LZ4: hib_compression=lz4 > > LZO is the default compression algorithm used with hibernation. > > > > > > Changes in v2: > > - Fixed build issues reported by kernel test robot for ARCH=sh, [1]. > > [1] https://lore.kernel.org/oe-kbuild-all/202310171226.pLUPeuC7-lkp@intel.com/ > > > > Nikhil V (4): > > PM: hibernate: Rename lzo* to make it generic > > PM: hibernate: Move to crypto APIs for LZO compression > > PM: hibernate: Add support for LZ4 compression for hibernation > > PM: hibernate: Support to select compression algorithm > > > > .../admin-guide/kernel-parameters.txt | 6 + > > kernel/power/Kconfig | 26 ++- > > kernel/power/hibernate.c | 85 +++++++- > > kernel/power/power.h | 19 ++ > > kernel/power/swap.c | 189 +++++++++++------- > > 5 files changed, 251 insertions(+), 74 deletions(-) > > > > > > base-commit: b85ea95d086471afb4ad062012a4d73cd328fa86 > > Hi @Rafael/@Pavel/@Len, > > Could you please let me know if you have any concerns on this approach? Not really a concern, but that is a significant change that I would rather make early in the cycle, which means after the 6.8 merge window. No need to resend unless there is something to address in which case I'll let you know. Thanks! > FYI: We have tested this on QEMU and its working fine. > > Logs(suspend): > [ 75.242227] PM: Using 3 thread(s) for lz4 compression > [ 75.243043] PM: Compressing and saving image data (17495 pages)... > [ 75.243917] PM: Image saving progress: 0% > [ 75.261727] PM: Image saving progress: 10% > [ 75.277968] PM: Image saving progress: 20% > [ 75.290927] PM: Image saving progress: 30% > [ 75.305186] PM: Image saving progress: 40% > [ 75.318252] PM: Image saving progress: 50% > [ 75.330310] PM: Image saving progress: 60% > [ 75.345906] PM: Image saving progress: 70% > [ 75.359054] PM: Image saving progress: 80% > [ 75.372176] PM: Image saving progress: 90% > [ 75.388411] PM: Image saving progress: 100% > [ 75.389775] PM: Image saving done > [ 75.390397] PM: hibernation: Wrote 69980 kbytes in 0.14 seconds > (499.85 MB/s) > [ 75.391591] PM: Image size after compression: 28242 kbytes > [ 75.393089] PM: S| > [ 75.399784] sd 0:0:0:0: [sda] Synchronizing SCSI cache > [ 75.439170] sd 0:0:0:0: [sda] Stopping disk > [ 75.501461] ACPI: PM: Preparing to enter system sleep state S5 > [ 75.502766] reboot: Power down > > > > Logs(resume): > [ 1.063248] PM: hibernation: resume from hibernation > [ 1.072868] Freezing user space processes > [ 1.073707] Freezing user space processes completed (elapsed 0.000 > seconds) > [ 1.075192] OOM killer disabled. > [ 1.075837] Freezing remaining freezable tasks > [ 1.078010] Freezing remaining freezable tasks completed (elapsed > 0.001 seconds) > [ 1.087489] PM: Using 3 thread(s) for lz4 decompression > [ 1.088570] PM: Loading and decompressing image data (17495 pages)... > [ 1.125549] PM: Image loading progress: 0% > [ 1.190380] PM: Image loading progress: 10% > [ 1.204963] PM: Image loading progress: 20% > [ 1.218988] PM: Image loading progress: 30% > [ 1.233697] PM: Image loading progress: 40% > [ 1.248658] PM: Image loading progress: 50% > [ 1.262910] PM: Image loading progress: 60% > [ 1.276966] PM: Image loading progress: 70% > [ 1.290517] PM: Image loading progress: 80% > [ 1.305427] PM: Image loading progress: 90% > [ 1.320666] PM: Image loading progress: 100% > [ 1.321866] PM: Image loading done > [ 1.322599] PM: hibernation: Read 69980 kbytes in 0.23 seconds > (304.26 MB/s) > [ 1.324795] printk: Suspending console(s) (use no_console_suspend to > debug) > [ 74.943801] ata1.00: Entering standby power mode > > > Thanks, > Nikhil V
On 12/12/2023 6:14 PM, Rafael J. Wysocki wrote: > Hi, > > On Wed, Nov 29, 2023 at 11:20 AM Nikhil V <quic_nprakash@quicinc.com> wrote: >> >> >> On 11/15/2023 5:52 PM, Nikhil V wrote: >>> This patch series covers the following: >>> 1. Renaming lzo* to generic names, except for lzo_xxx() APIs. This is >>> used in the next patch where we move to crypto based APIs for >>> compression. There are no functional changes introduced by this >>> approach. >>> >>> >>> 2. Replace LZO library calls with crypto generic APIs >>> >>> Currently for hibernation, LZO is the only compression algorithm >>> available and uses the existing LZO library calls. However, there >>> is no flexibility to switch to other algorithms which provides better >>> results. The main idea is that different compression algorithms have >>> different characteristics and hibernation may benefit when it uses >>> alternate algorithms. >>> >>> By moving to crypto based APIs, it lays a foundation to use other >>> compression algorithms for hibernation. >>> >>> >>> 3. LZ4 compression >>> >>> Extend the support for LZ4 compression to be used with hibernation. >>> The main idea is that different compression algorithms have different >>> characteristics and hibernation may benefit when it uses any of these >>> algorithms: a default algorithm, having higher compression rate but is >>> slower(compression/decompression) and a secondary algorithm, that is >>> faster(compression/decompression) but has lower compression rate. >>> >>> LZ4 algorithm has better decompression speeds over LZO. This reduces >>> the hibernation image restore time. >>> As per test results: >>> LZO LZ4 >>> Size before Compression(bytes) 682696704 682393600 >>> Size after Compression(bytes) 146502402 155993547 >>> Decompression Rate 335.02 MB/s 501.05 MB/s >>> Restore time 4.4s 3.8s >>> >>> LZO is the default compression algorithm used for hibernation. Enable >>> CONFIG_HIBERNATION_DEF_COMP_LZ4 to set the default compressor as LZ4. >>> >>> Compression Benchmarks: https://github.com/lz4/lz4 >>> >>> >>> 4. Support to select compression algorithm >>> >>> Currently the default compression algorithm is selected based on >>> Kconfig. Introduce a kernel command line parameter "hib_compression" to >>> override this behaviour. >>> >>> Users can set "hib_compression" command line parameter to specify >>> the algorithm. >>> Usage: >>> LZO: hib_compression=lzo >>> LZ4: hib_compression=lz4 >>> LZO is the default compression algorithm used with hibernation. >>> >>> >>> Changes in v2: >>> - Fixed build issues reported by kernel test robot for ARCH=sh, [1]. >>> [1] https://lore.kernel.org/oe-kbuild-all/202310171226.pLUPeuC7-lkp@intel.com/ >>> >>> Nikhil V (4): >>> PM: hibernate: Rename lzo* to make it generic >>> PM: hibernate: Move to crypto APIs for LZO compression >>> PM: hibernate: Add support for LZ4 compression for hibernation >>> PM: hibernate: Support to select compression algorithm >>> >>> .../admin-guide/kernel-parameters.txt | 6 + >>> kernel/power/Kconfig | 26 ++- >>> kernel/power/hibernate.c | 85 +++++++- >>> kernel/power/power.h | 19 ++ >>> kernel/power/swap.c | 189 +++++++++++------- >>> 5 files changed, 251 insertions(+), 74 deletions(-) >>> >>> >>> base-commit: b85ea95d086471afb4ad062012a4d73cd328fa86 >> >> Hi @Rafael/@Pavel/@Len, >> >> Could you please let me know if you have any concerns on this approach? > > Not really a concern, but that is a significant change that I would > rather make early in the cycle, which means after the 6.8 merge > window. > > No need to resend unless there is something to address in which case > I'll let you know. > > Thanks! > >> FYI: We have tested this on QEMU and its working fine. >> >> Logs(suspend): >> [ 75.242227] PM: Using 3 thread(s) for lz4 compression >> [ 75.243043] PM: Compressing and saving image data (17495 pages)... >> [ 75.243917] PM: Image saving progress: 0% >> [ 75.261727] PM: Image saving progress: 10% >> [ 75.277968] PM: Image saving progress: 20% >> [ 75.290927] PM: Image saving progress: 30% >> [ 75.305186] PM: Image saving progress: 40% >> [ 75.318252] PM: Image saving progress: 50% >> [ 75.330310] PM: Image saving progress: 60% >> [ 75.345906] PM: Image saving progress: 70% >> [ 75.359054] PM: Image saving progress: 80% >> [ 75.372176] PM: Image saving progress: 90% >> [ 75.388411] PM: Image saving progress: 100% >> [ 75.389775] PM: Image saving done >> [ 75.390397] PM: hibernation: Wrote 69980 kbytes in 0.14 seconds >> (499.85 MB/s) >> [ 75.391591] PM: Image size after compression: 28242 kbytes >> [ 75.393089] PM: S| >> [ 75.399784] sd 0:0:0:0: [sda] Synchronizing SCSI cache >> [ 75.439170] sd 0:0:0:0: [sda] Stopping disk >> [ 75.501461] ACPI: PM: Preparing to enter system sleep state S5 >> [ 75.502766] reboot: Power down >> >> >> >> Logs(resume): >> [ 1.063248] PM: hibernation: resume from hibernation >> [ 1.072868] Freezing user space processes >> [ 1.073707] Freezing user space processes completed (elapsed 0.000 >> seconds) >> [ 1.075192] OOM killer disabled. >> [ 1.075837] Freezing remaining freezable tasks >> [ 1.078010] Freezing remaining freezable tasks completed (elapsed >> 0.001 seconds) >> [ 1.087489] PM: Using 3 thread(s) for lz4 decompression >> [ 1.088570] PM: Loading and decompressing image data (17495 pages)... >> [ 1.125549] PM: Image loading progress: 0% >> [ 1.190380] PM: Image loading progress: 10% >> [ 1.204963] PM: Image loading progress: 20% >> [ 1.218988] PM: Image loading progress: 30% >> [ 1.233697] PM: Image loading progress: 40% >> [ 1.248658] PM: Image loading progress: 50% >> [ 1.262910] PM: Image loading progress: 60% >> [ 1.276966] PM: Image loading progress: 70% >> [ 1.290517] PM: Image loading progress: 80% >> [ 1.305427] PM: Image loading progress: 90% >> [ 1.320666] PM: Image loading progress: 100% >> [ 1.321866] PM: Image loading done >> [ 1.322599] PM: hibernation: Read 69980 kbytes in 0.23 seconds >> (304.26 MB/s) >> [ 1.324795] printk: Suspending console(s) (use no_console_suspend to >> debug) >> [ 74.943801] ata1.00: Entering standby power mode >> >> >> Thanks, >> Nikhil V Hi @Rafael We have picked this patch series on 6.8-rc1 and tested the functionality on QEMU. Its working fine. However, while applying the patches we could see minor conflicts. Could you please let me know if we need to push a new version after resolving these conflicts? Thanks, Nikhil V
On Mon, Jan 22, 2024 at 1:14 PM Nikhil V <quic_nprakash@quicinc.com> wrote: > > > > On 12/12/2023 6:14 PM, Rafael J. Wysocki wrote: > > Hi, > > > > On Wed, Nov 29, 2023 at 11:20 AM Nikhil V <quic_nprakash@quicinc.com> wrote: > >> > >> > >> On 11/15/2023 5:52 PM, Nikhil V wrote: > >>> This patch series covers the following: > >>> 1. Renaming lzo* to generic names, except for lzo_xxx() APIs. This is > >>> used in the next patch where we move to crypto based APIs for > >>> compression. There are no functional changes introduced by this > >>> approach. > >>> > >>> > >>> 2. Replace LZO library calls with crypto generic APIs > >>> > >>> Currently for hibernation, LZO is the only compression algorithm > >>> available and uses the existing LZO library calls. However, there > >>> is no flexibility to switch to other algorithms which provides better > >>> results. The main idea is that different compression algorithms have > >>> different characteristics and hibernation may benefit when it uses > >>> alternate algorithms. > >>> > >>> By moving to crypto based APIs, it lays a foundation to use other > >>> compression algorithms for hibernation. > >>> > >>> > >>> 3. LZ4 compression > >>> > >>> Extend the support for LZ4 compression to be used with hibernation. > >>> The main idea is that different compression algorithms have different > >>> characteristics and hibernation may benefit when it uses any of these > >>> algorithms: a default algorithm, having higher compression rate but is > >>> slower(compression/decompression) and a secondary algorithm, that is > >>> faster(compression/decompression) but has lower compression rate. > >>> > >>> LZ4 algorithm has better decompression speeds over LZO. This reduces > >>> the hibernation image restore time. > >>> As per test results: > >>> LZO LZ4 > >>> Size before Compression(bytes) 682696704 682393600 > >>> Size after Compression(bytes) 146502402 155993547 > >>> Decompression Rate 335.02 MB/s 501.05 MB/s > >>> Restore time 4.4s 3.8s > >>> > >>> LZO is the default compression algorithm used for hibernation. Enable > >>> CONFIG_HIBERNATION_DEF_COMP_LZ4 to set the default compressor as LZ4. > >>> > >>> Compression Benchmarks: https://github.com/lz4/lz4 > >>> > >>> > >>> 4. Support to select compression algorithm > >>> > >>> Currently the default compression algorithm is selected based on > >>> Kconfig. Introduce a kernel command line parameter "hib_compression" to > >>> override this behaviour. > >>> > >>> Users can set "hib_compression" command line parameter to specify > >>> the algorithm. > >>> Usage: > >>> LZO: hib_compression=lzo > >>> LZ4: hib_compression=lz4 > >>> LZO is the default compression algorithm used with hibernation. > >>> > >>> > >>> Changes in v2: > >>> - Fixed build issues reported by kernel test robot for ARCH=sh, [1]. > >>> [1] https://lore.kernel.org/oe-kbuild-all/202310171226.pLUPeuC7-lkp@intel.com/ > >>> > >>> Nikhil V (4): > >>> PM: hibernate: Rename lzo* to make it generic > >>> PM: hibernate: Move to crypto APIs for LZO compression > >>> PM: hibernate: Add support for LZ4 compression for hibernation > >>> PM: hibernate: Support to select compression algorithm > >>> > >>> .../admin-guide/kernel-parameters.txt | 6 + > >>> kernel/power/Kconfig | 26 ++- > >>> kernel/power/hibernate.c | 85 +++++++- > >>> kernel/power/power.h | 19 ++ > >>> kernel/power/swap.c | 189 +++++++++++------- > >>> 5 files changed, 251 insertions(+), 74 deletions(-) > >>> > >>> > >>> base-commit: b85ea95d086471afb4ad062012a4d73cd328fa86 > >> > >> Hi @Rafael/@Pavel/@Len, > >> > >> Could you please let me know if you have any concerns on this approach? > > > > Not really a concern, but that is a significant change that I would > > rather make early in the cycle, which means after the 6.8 merge > > window. > > > > No need to resend unless there is something to address in which case > > I'll let you know. > > > > Thanks! > > > >> FYI: We have tested this on QEMU and its working fine. > >> > >> Logs(suspend): > >> [ 75.242227] PM: Using 3 thread(s) for lz4 compression > >> [ 75.243043] PM: Compressing and saving image data (17495 pages)... > >> [ 75.243917] PM: Image saving progress: 0% > >> [ 75.261727] PM: Image saving progress: 10% > >> [ 75.277968] PM: Image saving progress: 20% > >> [ 75.290927] PM: Image saving progress: 30% > >> [ 75.305186] PM: Image saving progress: 40% > >> [ 75.318252] PM: Image saving progress: 50% > >> [ 75.330310] PM: Image saving progress: 60% > >> [ 75.345906] PM: Image saving progress: 70% > >> [ 75.359054] PM: Image saving progress: 80% > >> [ 75.372176] PM: Image saving progress: 90% > >> [ 75.388411] PM: Image saving progress: 100% > >> [ 75.389775] PM: Image saving done > >> [ 75.390397] PM: hibernation: Wrote 69980 kbytes in 0.14 seconds > >> (499.85 MB/s) > >> [ 75.391591] PM: Image size after compression: 28242 kbytes > >> [ 75.393089] PM: S| > >> [ 75.399784] sd 0:0:0:0: [sda] Synchronizing SCSI cache > >> [ 75.439170] sd 0:0:0:0: [sda] Stopping disk > >> [ 75.501461] ACPI: PM: Preparing to enter system sleep state S5 > >> [ 75.502766] reboot: Power down > >> > >> > >> > >> Logs(resume): > >> [ 1.063248] PM: hibernation: resume from hibernation > >> [ 1.072868] Freezing user space processes > >> [ 1.073707] Freezing user space processes completed (elapsed 0.000 > >> seconds) > >> [ 1.075192] OOM killer disabled. > >> [ 1.075837] Freezing remaining freezable tasks > >> [ 1.078010] Freezing remaining freezable tasks completed (elapsed > >> 0.001 seconds) > >> [ 1.087489] PM: Using 3 thread(s) for lz4 decompression > >> [ 1.088570] PM: Loading and decompressing image data (17495 pages).. > >> [ 1.125549] PM: Image loading progress: 0% > >> [ 1.190380] PM: Image loading progress: 10% > >> [ 1.204963] PM: Image loading progress: 20% > >> [ 1.218988] PM: Image loading progress: 30% > >> [ 1.233697] PM: Image loading progress: 40% > >> [ 1.248658] PM: Image loading progress: 50% > >> [ 1.262910] PM: Image loading progress: 60% > >> [ 1.276966] PM: Image loading progress: 70% > >> [ 1.290517] PM: Image loading progress: 80% > >> [ 1.305427] PM: Image loading progress: 90% > >> [ 1.320666] PM: Image loading progress: 100% > >> [ 1.321866] PM: Image loading done > >> [ 1.322599] PM: hibernation: Read 69980 kbytes in 0.23 seconds > >> (304.26 MB/s) > >> [ 1.324795] printk: Suspending console(s) (use no_console_suspend to > >> debug) > >> [ 74.943801] ata1.00: Entering standby power mode > >> > >> > >> Thanks, > >> Nikhil V > > > Hi @Rafael > > We have picked this patch series on 6.8-rc1 and tested the functionality > on QEMU. Its working fine. However, while applying the patches we could > see minor conflicts. Could you please let me know if we need to push a > new version after resolving these conflicts? It will help. I can resolve the conflicts, but I may make mistakes in the process. Thanks!
On 1/22/2024 5:46 PM, Rafael J. Wysocki wrote: > On Mon, Jan 22, 2024 at 1:14 PM Nikhil V <quic_nprakash@quicinc.com> wrote: >> >> >> >> On 12/12/2023 6:14 PM, Rafael J. Wysocki wrote: >>> Hi, >>> >>> On Wed, Nov 29, 2023 at 11:20 AM Nikhil V <quic_nprakash@quicinc.com> wrote: >>>> >>>> >>>> On 11/15/2023 5:52 PM, Nikhil V wrote: >>>>> This patch series covers the following: >>>>> 1. Renaming lzo* to generic names, except for lzo_xxx() APIs. This is >>>>> used in the next patch where we move to crypto based APIs for >>>>> compression. There are no functional changes introduced by this >>>>> approach. >>>>> >>>>> >>>>> 2. Replace LZO library calls with crypto generic APIs >>>>> >>>>> Currently for hibernation, LZO is the only compression algorithm >>>>> available and uses the existing LZO library calls. However, there >>>>> is no flexibility to switch to other algorithms which provides better >>>>> results. The main idea is that different compression algorithms have >>>>> different characteristics and hibernation may benefit when it uses >>>>> alternate algorithms. >>>>> >>>>> By moving to crypto based APIs, it lays a foundation to use other >>>>> compression algorithms for hibernation. >>>>> >>>>> >>>>> 3. LZ4 compression >>>>> >>>>> Extend the support for LZ4 compression to be used with hibernation. >>>>> The main idea is that different compression algorithms have different >>>>> characteristics and hibernation may benefit when it uses any of these >>>>> algorithms: a default algorithm, having higher compression rate but is >>>>> slower(compression/decompression) and a secondary algorithm, that is >>>>> faster(compression/decompression) but has lower compression rate. >>>>> >>>>> LZ4 algorithm has better decompression speeds over LZO. This reduces >>>>> the hibernation image restore time. >>>>> As per test results: >>>>> LZO LZ4 >>>>> Size before Compression(bytes) 682696704 682393600 >>>>> Size after Compression(bytes) 146502402 155993547 >>>>> Decompression Rate 335.02 MB/s 501.05 MB/s >>>>> Restore time 4.4s 3.8s >>>>> >>>>> LZO is the default compression algorithm used for hibernation. Enable >>>>> CONFIG_HIBERNATION_DEF_COMP_LZ4 to set the default compressor as LZ4. >>>>> >>>>> Compression Benchmarks: https://github.com/lz4/lz4 >>>>> >>>>> >>>>> 4. Support to select compression algorithm >>>>> >>>>> Currently the default compression algorithm is selected based on >>>>> Kconfig. Introduce a kernel command line parameter "hib_compression" to >>>>> override this behaviour. >>>>> >>>>> Users can set "hib_compression" command line parameter to specify >>>>> the algorithm. >>>>> Usage: >>>>> LZO: hib_compression=lzo >>>>> LZ4: hib_compression=lz4 >>>>> LZO is the default compression algorithm used with hibernation. >>>>> >>>>> >>>>> Changes in v2: >>>>> - Fixed build issues reported by kernel test robot for ARCH=sh, [1]. >>>>> [1] https://lore.kernel.org/oe-kbuild-all/202310171226.pLUPeuC7-lkp@intel.com/ >>>>> >>>>> Nikhil V (4): >>>>> PM: hibernate: Rename lzo* to make it generic >>>>> PM: hibernate: Move to crypto APIs for LZO compression >>>>> PM: hibernate: Add support for LZ4 compression for hibernation >>>>> PM: hibernate: Support to select compression algorithm >>>>> >>>>> .../admin-guide/kernel-parameters.txt | 6 + >>>>> kernel/power/Kconfig | 26 ++- >>>>> kernel/power/hibernate.c | 85 +++++++- >>>>> kernel/power/power.h | 19 ++ >>>>> kernel/power/swap.c | 189 +++++++++++------- >>>>> 5 files changed, 251 insertions(+), 74 deletions(-) >>>>> >>>>> >>>>> base-commit: b85ea95d086471afb4ad062012a4d73cd328fa86 >>>> >>>> Hi @Rafael/@Pavel/@Len, >>>> >>>> Could you please let me know if you have any concerns on this approach? >>> >>> Not really a concern, but that is a significant change that I would >>> rather make early in the cycle, which means after the 6.8 merge >>> window. >>> >>> No need to resend unless there is something to address in which case >>> I'll let you know. >>> >>> Thanks! >>> >>>> FYI: We have tested this on QEMU and its working fine. >>>> >>>> Logs(suspend): >>>> [ 75.242227] PM: Using 3 thread(s) for lz4 compression >>>> [ 75.243043] PM: Compressing and saving image data (17495 pages)... >>>> [ 75.243917] PM: Image saving progress: 0% >>>> [ 75.261727] PM: Image saving progress: 10% >>>> [ 75.277968] PM: Image saving progress: 20% >>>> [ 75.290927] PM: Image saving progress: 30% >>>> [ 75.305186] PM: Image saving progress: 40% >>>> [ 75.318252] PM: Image saving progress: 50% >>>> [ 75.330310] PM: Image saving progress: 60% >>>> [ 75.345906] PM: Image saving progress: 70% >>>> [ 75.359054] PM: Image saving progress: 80% >>>> [ 75.372176] PM: Image saving progress: 90% >>>> [ 75.388411] PM: Image saving progress: 100% >>>> [ 75.389775] PM: Image saving done >>>> [ 75.390397] PM: hibernation: Wrote 69980 kbytes in 0.14 seconds >>>> (499.85 MB/s) >>>> [ 75.391591] PM: Image size after compression: 28242 kbytes >>>> [ 75.393089] PM: S| >>>> [ 75.399784] sd 0:0:0:0: [sda] Synchronizing SCSI cache >>>> [ 75.439170] sd 0:0:0:0: [sda] Stopping disk >>>> [ 75.501461] ACPI: PM: Preparing to enter system sleep state S5 >>>> [ 75.502766] reboot: Power down >>>> >>>> >>>> >>>> Logs(resume): >>>> [ 1.063248] PM: hibernation: resume from hibernation >>>> [ 1.072868] Freezing user space processes >>>> [ 1.073707] Freezing user space processes completed (elapsed 0.000 >>>> seconds) >>>> [ 1.075192] OOM killer disabled. >>>> [ 1.075837] Freezing remaining freezable tasks >>>> [ 1.078010] Freezing remaining freezable tasks completed (elapsed >>>> 0.001 seconds) >>>> [ 1.087489] PM: Using 3 thread(s) for lz4 decompression >>>> [ 1.088570] PM: Loading and decompressing image data (17495 pages)... >>>> [ 1.125549] PM: Image loading progress: 0% >>>> [ 1.190380] PM: Image loading progress: 10% >>>> [ 1.204963] PM: Image loading progress: 20% >>>> [ 1.218988] PM: Image loading progress: 30% >>>> [ 1.233697] PM: Image loading progress: 40% >>>> [ 1.248658] PM: Image loading progress: 50% >>>> [ 1.262910] PM: Image loading progress: 60% >>>> [ 1.276966] PM: Image loading progress: 70% >>>> [ 1.290517] PM: Image loading progress: 80% >>>> [ 1.305427] PM: Image loading progress: 90% >>>> [ 1.320666] PM: Image loading progress: 100% >>>> [ 1.321866] PM: Image loading done >>>> [ 1.322599] PM: hibernation: Read 69980 kbytes in 0.23 seconds >>>> (304.26 MB/s) >>>> [ 1.324795] printk: Suspending console(s) (use no_console_suspend to >>>> debug) >>>> [ 74.943801] ata1.00: Entering standby power mode >>>> >>>> >>>> Thanks, >>>> Nikhil V >> >> >> Hi @Rafael >> >> We have picked this patch series on 6.8-rc1 and tested the functionality >> on QEMU. Its working fine. However, while applying the patches we could >> see minor conflicts. Could you please let me know if we need to push a >> new version after resolving these conflicts? > > It will help. > > I can resolve the conflicts, but I may make mistakes in the process. > > Thanks! Thanks for the response. Will push a new version after resolving the conflicts. Thanks, Nikhil V