From patchwork Fri Apr 14 12:10:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen Yu X-Patchwork-Id: 13210906 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51F1CC77B70 for ; Fri, 14 Apr 2023 04:14:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229598AbjDNEOZ (ORCPT ); Fri, 14 Apr 2023 00:14:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229540AbjDNEOX (ORCPT ); Fri, 14 Apr 2023 00:14:23 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC9CE210B; Thu, 13 Apr 2023 21:14:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681445660; x=1712981660; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=ilHX1TUJOSQR7mRe4+AEDRbkMzycBg1B0YKXxtFmyHw=; b=LchK71ymk2b8Tpsc5NIIb3YqngpYoKXaArF4MSbA/9ZciMU6OQ3wVexg 0kJs2Cthj2lRUfgIY6en6oKlRH17WC7GdoIF2UfL6b7eCAMQGb7G7tA0T CxKeQoWOtyw9qotKYalk9Ylin0r4XPsF844z+z/ULu27l7W3do7jRakI1 KaByojNSSZvR8/tNC89PjgPPxzX1mNIJk9qQ5b0k5sIWyR+r0XD19LEhg jfrQJN7Re1ST5UUsCS4H1yS3xCCEYZJOAaEwQQ/QNb8f1oUoRWW1GZVfU LkAkk66uGtiA63u1Y/FR2ga246fQvA07uDB9vX8SMdy8x6tuvZrYFXZPZ A==; X-IronPort-AV: E=McAfee;i="6600,9927,10679"; a="343138350" X-IronPort-AV: E=Sophos;i="5.99,195,1677571200"; d="scan'208";a="343138350" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2023 21:14:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10679"; a="683194742" X-IronPort-AV: E=Sophos;i="5.99,195,1677571200"; d="scan'208";a="683194742" Received: from chenyu-dev.sh.intel.com ([10.239.158.170]) by orsmga007.jf.intel.com with ESMTP; 13 Apr 2023 21:14:18 -0700 From: Chen Yu To: "Rafael J. Wysocki" , Len Brown Cc: Ye Bin , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Pavankumar Kondeti , Yifan Li , Chen Yu Subject: [PATCH v3 0/2] Fix test_resume failure by openning swap device non-exclusively Date: Fri, 14 Apr 2023 20:10:11 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org test_resume does not work in current kernel when using swapfile for hibernation. This is because the swap device should be openned non-exclusively in test_resume mode. Patch 1 is a preparation to turn snapshot_test into a global variable. Patch 2 is the fix to open swap device non-exclusively only for test_resume mode. Change since v2: Adjust the initialization of fmode and refine the commit message per Rafael's suggestion. Change since v1: Turn snapshot_test into global variable and do not introduce parameters for swsusp_check() nor load_image_and_restore(). Chen Yu (2): PM: hibernate: Turn snapshot_test into global variable PM: hibernate: Do not get block device exclusively in test_resume mode kernel/power/hibernate.c | 15 ++++++++++++--- kernel/power/power.h | 1 + kernel/power/swap.c | 8 ++++++-- 3 files changed, 19 insertions(+), 5 deletions(-)