Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp407354imm; Wed, 19 Sep 2018 00:31:10 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbnZ2AWLUzzt5zYQ0AfTFWeKkpprM/Kzrk43KS3HyIh4p2fDEiTR1ssabwrSsUr07QvqcmK X-Received: by 2002:a62:2904:: with SMTP id p4-v6mr12546831pfp.128.1537342270407; Wed, 19 Sep 2018 00:31:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537342270; cv=none; d=google.com; s=arc-20160816; b=hMcpZ2DVWuUNzfHbUj9esQKtu5ilpdF/xE8h4m+QnFGSV21c6pJm8yR4QbOtwjW0Sx drsRg9hCLZWHzXVECrVcU4Ms6NouhfI9AvpxATtiszluQQyESQAeqbWDtUFeaQngosqk y9wZkFBUkaG3eXdHDkb2+zUNSMZOmNKtxn73clhMBNSSkrRseETko0ZKhahl8srM7sz6 H5VsiLAWeoEQliKlJeoPyFUR0mRWTtZi23eHdF2xNZ+RCM4aVJeTIKd0SjgujzdrCLJQ bfsVYNrAvBT1c0fPQZHzsqqXfuIj+9e1SiaMm3oN9HC+1NoE2ktAtFkz+YGB2PraeLsH w5hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=DYYhROYbpKdDgaCfn8wd5DbuCXdy5U4fN1YL7885mE8=; b=J2f5NGHBrR3f9UrIr6KmsGtarU366pKT7YXLE6kv4b1QYeUAf9imKdrW+7RRDFOP9G e82Hf8xaF17AR/JRx14OHMfbmhSdOFWVAAu+0cw0xJ6vwSwKFY7V6FJsrNmCkVkFy0RG etoG+OiS9N6Itmba0/a4u898Uz02j2I1Jo93pcxXalyndE3t58yJO7RROlKW5dtUuOnB 3lVGnALAioCrRk0PfF+WjfQhWKX+3BgX4bjv2NnnvZRp8MxNKWw3zdwYXf4jBnfxcqNK Aqa1YLQAJeNdbKrQ7taObbWL73yzJYtYhpJdE1ne+BNgorhYSaX5VC3lP+7pT3kbmzDT Biiw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d6-v6si19518144pgi.506.2018.09.19.00.30.55; Wed, 19 Sep 2018 00:31:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730985AbeISNHQ (ORCPT + 99 others); Wed, 19 Sep 2018 09:07:16 -0400 Received: from mga02.intel.com ([134.134.136.20]:39784 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730787AbeISNHP (ORCPT ); Wed, 19 Sep 2018 09:07:15 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Sep 2018 00:30:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,393,1531810800"; d="scan'208";a="87395401" Received: from chenyu-desktop.sh.intel.com ([10.239.160.116]) by fmsmga002.fm.intel.com with ESMTP; 19 Sep 2018 00:30:23 -0700 From: Chen Yu To: Thomas Gleixner , "Rafael J. Wysocki" Cc: x86@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Pavel Machek , Len Brown , Zhimin Gu , Yu Chen Subject: [PATCH 00/12][RFC v3] Backport several fixes from 64bits to 32bits hibernation Date: Wed, 19 Sep 2018 15:37:01 +0800 Message-Id: X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently there are mainly three bugs in 32bits system when doing hibernation: 1. The page copy code is not running in safe page, which might cause hang during resume. 2. There's no text mapping for the final jump address of the original kernel, which might cause the system jumping into illegal address and causes system hang during resume. 3. The restore kernel switches to its own kernel page table(swapper_pg_dir) rather than the original kernel page table after all the pages been copied back, which might cause invalid virtual-physical mapping issue during resume. To solve these problems: 1. Copy the code core_restore_code to a safe page, to avoid the instruction code been overwritten when image kernel pages are being copied. 2. Set up temporary text mapping for the image kernel's jump address, so that after all the pages have been copied back, the system could jump to this address. 3. Switch to the original kernel page table during resume. Furthermore, MD5 hash check for e820 map is also backported from 64bits system. In order to make this patch set more readable, these fixes are splitted into several sub patches. Chen Yu (1): PM / hibernate: Check the success of generating md5 digest before hibernation Zhimin Gu (11): x86, hibernate: Fix nosave_regions setup for hibernation x86/asm/power: Create stack frames in hibernate_asm_32.S x86, hibernate: Extract the common code of 64/32 bit system x86, hibernate: Enable CONFIG_ARCH_HIBERNATION_HEADER set on 32bit system x86, hibernate: Rename temp_level4_pgt to temp_pgt x86, hibernate: Use temp_pgt as the temporary page table x86, hibernate: Use the page size macro instead of constant value x86, hibernate: Switch to original page table after resumed x86, hibernate: Switch to relocated restore code during resume on 32bit system x86, hibernate: Set up temporary text mapping for 32bit system x86, hibernate: Adjust in_suspend after resumed on 32bit system arch/x86/Kconfig | 2 +- arch/x86/include/asm/suspend.h | 8 + arch/x86/include/asm/suspend_32.h | 4 + arch/x86/kernel/setup.c | 2 +- arch/x86/power/Makefile | 2 +- arch/x86/power/hibernate.c | 249 ++++++++++++++++++++++++++++++ arch/x86/power/hibernate_32.c | 52 +++++-- arch/x86/power/hibernate_64.c | 224 +-------------------------- arch/x86/power/hibernate_asm_32.S | 37 ++++- arch/x86/power/hibernate_asm_64.S | 2 +- 10 files changed, 335 insertions(+), 247 deletions(-) create mode 100644 arch/x86/power/hibernate.c -- 2.17.1