Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4332630imm; Tue, 11 Sep 2018 10:14:40 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZnYrb2B6+F1CiF2P58YV0ySy5lDYa7jKjoH5504+BzQMFZoGgDSr45jld9W7c20JYOZCwN X-Received: by 2002:a63:a40a:: with SMTP id c10-v6mr29188214pgf.346.1536686080651; Tue, 11 Sep 2018 10:14:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536686080; cv=none; d=google.com; s=arc-20160816; b=pRlWBXr5e5whdAz9Kn1pePIlLm9WRX/O02JtqZ4XzhNrVfcYEd0sg1cayrhFgoWY7/ zXUwKbjbOk/gQdO7INzLLn+4LErm6Oh+kRApSIfLm5I+GoV3uBIVR+evfRUk+aOFvvcw PWoKiXROZRFlwcVBCOLjorDf+zYsT3KGwckFrnnCbzDlTNoUIIOGLUu+zCM1lMQaup7S N5ihux4dBsVGvwtbbonmkePZmeSw6X5ZaSuxB6fmwVERK7tAlIKZ2D3XHOf/RSJ52vnl Lyh8HBBtX7o6ssTuYjZ5225ELHvfFLBHxA9LEg10XUiiI2S2aE1vffAKRNu0AaeuTn8+ qZMg== 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=xiWGLJSGEWUfJJe3jJVh3wt7QVhdndPkjhcgamFriUM=; b=JjnIWnNtOZTb50HDzOKhrXntWvhNmSDn2wZkAeBGgLZrM4VwoMvGGJnqgW6oAh+WSo kaHkiYByIQ69CUq0ysje2xRaNItIYYcLgb3kqxq9eiTEIKauh2eWu7K3tj56jfdK8EOl bP4APBXfYNughMNtOlk+jQKmdVMOaAAQ8sXVVlC1FhCddIaUC3BDveps9ETbnWjB27j7 gC7ALg/tmiwij9V2Vy0lH1qUAkLuy3mGFUKSHoU9emwD5MF5yDakOIRErHN5kj2xnTQ2 v+/ghj7a+Pt+d1AmXCZeYBGYiUjn4QcZvNfyou2iYICyKl6/lSOgSrKacOA3Mw7sy33x MGgg== 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 93-v6si20889694plf.113.2018.09.11.10.14.24; Tue, 11 Sep 2018 10:14:40 -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 S1727781AbeIKWOd (ORCPT + 99 others); Tue, 11 Sep 2018 18:14:33 -0400 Received: from mga17.intel.com ([192.55.52.151]:27760 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726943AbeIKWOd (ORCPT ); Tue, 11 Sep 2018 18:14:33 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Sep 2018 10:14:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,361,1531810800"; d="scan'208";a="89096759" Received: from chenyu-desktop.sh.intel.com ([10.239.160.116]) by fmsmga001.fm.intel.com with ESMTP; 11 Sep 2018 10:14:07 -0700 From: Chen Yu To: Thomas Gleixner , "Rafael J. Wysocki" Cc: Pavel Machek , Rui Zhang , Chen Yu , Zhimin Gu , Len Brown , linux-kernel@vger.kernel.org, x86@kernel.org, linux-pm@vger.kernel.org, Chen Yu Subject: [PATCH 0/4][v2] Fixes hibernation bugs on x86-32 system Date: Wed, 12 Sep 2018 01:19:55 +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 x86-32 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 be overwriten 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 Chen Yu (1): PM / hibernate: Check the success of generating md5 digest before hibernation Zhimin Gu (3): x86, hibernate: Fix nosave_regions setup for hibernation x86, hibernate: Extract the common code of 64/32 bit system x86, hibernate: Backport several fixes from 64bits to 32bits hibernation arch/x86/Kconfig | 2 +- arch/x86/include/asm/suspend_32.h | 4 + arch/x86/kernel/setup.c | 2 +- arch/x86/power/hibernate.c | 263 ++++++++++++++++++++++++++++++ arch/x86/power/hibernate_32.c | 60 ++++--- arch/x86/power/hibernate_64.c | 242 +-------------------------- arch/x86/power/hibernate_asm_32.S | 49 +++++- arch/x86/power/hibernate_asm_64.S | 2 +- 8 files changed, 350 insertions(+), 274 deletions(-) create mode 100644 arch/x86/power/hibernate.c -- 2.17.1