Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5688222imm; Mon, 27 Aug 2018 02:26:43 -0700 (PDT) X-Google-Smtp-Source: ANB0VdblJEorQzexY0Vw8rhYx2anRSfilkrJoZR+/BfQOMI7eIfeAgnuXSpjd9/71Yi8WpmlJRu1 X-Received: by 2002:a17:902:82c9:: with SMTP id u9-v6mr12387602plz.138.1535362003164; Mon, 27 Aug 2018 02:26:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535362003; cv=none; d=google.com; s=arc-20160816; b=YSKeeQv3TcBIn4qZ6TM75hrg61lRTJwZQhMe/e7bKDn06wwEUIZl8eYkOVSoOAKKZm r9qv2mRSTsb/xGL750v5HVKgn0ePplCgsByKeD16dE0jqgFVWabAjqkXz1fGgwg6zFS2 cz/tn+9xf60S/5q9yT6r6aX7yeeJeX0xTuYAXVzRgJYSf0XJj5DrtjSsw8So90AjF02n bNXAy/uxf6iMsBC6tZQVt6f9FHxjt3qH2C93bkJ+vLwzkBtksSxi03zvhnlA6EgqNVql 3dQXZ9CVt4hN0kJfj5l90MTrUCyMZJpD/H78UrqPTVMZUVqpJ4eFp7YLYHBCGmfyCOkC Yfsw== 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 :arc-authentication-results; bh=nvjHYn+nMUPG7E65A9XWa/t5LqrtpDGpTmC33wCHSTg=; b=bi2GjFhNedgJY7KnO0YiHNHHi+XiR7Uyn8BkncDoJA1L/Y/YD/ZWE7nLOwOoHWJS01 HsMseHyuENJsWwafgO7GBWagaDc1aOZbpou/8qqBB60jTmznU1YvWSYpN9Os8Y7uVDsW dC+JzNRxU1EfDqkKDK4O8D9BJDczPnBalXUQ4YzRw4rX+rDJEYW7+F4CbE7csTrx0l2B 8H0iebpD6mLNrWTcCZySn9Hu+3yvtJ0Lw+3rRposIhobq1dyPO/jCdgxPqAQBX/qcQ02 bYdQsZzHF6AwYORlH3G9NQ+N8hEmJIu6VTjic1YC2BNfPErmOHClrAhcQdNeWnB1T+At rnig== 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 l30-v6si13707524pgn.238.2018.08.27.02.26.26; Mon, 27 Aug 2018 02:26:43 -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 S1726968AbeH0NLK (ORCPT + 99 others); Mon, 27 Aug 2018 09:11:10 -0400 Received: from mga04.intel.com ([192.55.52.120]:11706 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726802AbeH0NLK (ORCPT ); Mon, 27 Aug 2018 09:11:10 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Aug 2018 02:25:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,294,1531810800"; d="scan'208";a="75876892" Received: from kookoo32-optiplex-9020.sh.intel.com ([10.239.37.4]) by FMSMGA003.fm.intel.com with ESMTP; 27 Aug 2018 02:25:07 -0700 From: Gu Zhimin To: "Rafael J. Wysocki" , Len Brown Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Pavel Machek , Yu Chen , x86@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Zhimin Gu Subject: [PATCH 0/3] Fixes hibernation bugs on x86-32 system Date: Mon, 27 Aug 2018 17:41:18 +0800 Message-Id: X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhimin Gu 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 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 | 253 ++++++++++++++++++++++++++++++++++++++ arch/x86/power/hibernate_32.c | 76 ++++++++---- arch/x86/power/hibernate_64.c | 241 +----------------------------------- arch/x86/power/hibernate_asm_32.S | 49 ++++++-- arch/x86/power/hibernate_asm_64.S | 2 +- 8 files changed, 353 insertions(+), 276 deletions(-) create mode 100644 arch/x86/power/hibernate.c -- 2.7.4