Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp17786928ybl; Thu, 2 Jan 2020 12:02:46 -0800 (PST) X-Google-Smtp-Source: APXvYqy6NWZLgvatx+6C0AXRv8zXJPzVB0awtmCjbTxzD4pwqZlw5GGGvuv6GDONM0FIFyOpAtEY X-Received: by 2002:a9d:8f1:: with SMTP id 104mr87802093otf.107.1577995366648; Thu, 02 Jan 2020 12:02:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577995366; cv=none; d=google.com; s=arc-20160816; b=Fe/i70V5cm87NlHgqALKbJC2xnw+DqXrBiJEBn1GouHsG/OSQfbhtBLg2gK4dpZ1JU ThVJgWpOx6/wh/KBLckyEvRhdiUvTa8Dfl9humozkGAimpWGAFh78wWbBsi/+0XbAD57 JBxy5xS01N8+RfRLI8CAXsKKUqeH/ziyW4egBPEMHrXVJPiuh3XjzAISGhC7PizcX2uN /d37vXxR3zz32IB33q8VGhEMFODCMcM24GKBX1qUEtlDpuvdmbyxB8oOEv1A9gea05Fj ZKfZXPKj7Isb0674WVtMJyL4sr+G4joCQMncFPlPFTVALeziy6bk3Qpd0HfCw9jzlGyI KF0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=IWftFaF/7pwaE+hKN0rmHHTDccHnFs4MwoJXhQKr9TA=; b=0shjAKUZUFu/VlBkDl/zlEXysSFwZvFpaUGxpGkPZR7owSRKkGGGuwtiQdLRvxoFgX SaK86idAYUcTiRNrsYyFILR/rDMC/ZQDvCtuoF3aLJvrAWq3K9T7Zt+fqy3Y6it13OK4 Yblae/7hdiT+lvzaPP9AxfE6rc/H80CIpE16hvw/52szq201ERw8sxx/L8ildHJ0X4qG vTFHbo/4s6IU+D7dT7ZySC7TlyztEqFWPOH+ZxdsAQnctQfE2Rn4AhVlfKiO5JUqpjkP OYq8+gcPhXXd+gnMbtSu3IkXZMeaTr34LxbRPXRhdAOhd9SYBOuh+6bkv74J82g8X8Ov PERQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ETFtyUbG; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y8si26173302oih.141.2020.01.02.12.02.34; Thu, 02 Jan 2020 12:02:46 -0800 (PST) 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; dkim=pass header.i=@google.com header.s=20161025 header.b=ETFtyUbG; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728688AbgABUBQ (ORCPT + 99 others); Thu, 2 Jan 2020 15:01:16 -0500 Received: from mail-vs1-f74.google.com ([209.85.217.74]:38274 "EHLO mail-vs1-f74.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728296AbgABUBQ (ORCPT ); Thu, 2 Jan 2020 15:01:16 -0500 Received: by mail-vs1-f74.google.com with SMTP id o185so3788911vsc.5 for ; Thu, 02 Jan 2020 12:01:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=IWftFaF/7pwaE+hKN0rmHHTDccHnFs4MwoJXhQKr9TA=; b=ETFtyUbGasImdWusI7+XxX+jtfzy6TbJUp8B/J87NDJKrN0tpvcu+AhRbowiMtcdgg bgjYmyFMHeiZP1YyPkOJe2abYtU+18pqk98PIqIpdmXhiL+NCzGaUfwooMn7yIw2l2sK XNt0kZnYXtKpSNWS81hh9vYloEblPeBm9UO7rjtiG9Mnbfl6BL6rQonfw28PD19VxaYB AtHFPgoQq9kWjklvzY6rcLgQZVIhOxkgZQILADhE/vJ2AnmTJgZg/Nokpsq0P1dpwgGQ hJ0Kkj0DAet+gYl0w8PbWpXOWeuJ4xr8D2GffvLt2+nHrPQgHnWpO70Z1VvVu5hp/FdP hVzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=IWftFaF/7pwaE+hKN0rmHHTDccHnFs4MwoJXhQKr9TA=; b=AwOfjacVs1QfHbJYL8I5qo0jSIce8AAYkFpZlMA2xLeYofNdo9aKDqLf+RBMrUYhd8 LxApa9pB7JfIKcV8L4Mf4H8HNf8Mn1NDzNS9ce8SxXMNB7BAYkYWwkGYWFqJ3I3uVk4I 8UN2p3HFmLlTQ33FOgx/n6DzeKOD+Gku+TK8+YxjeaaApyDjjqFikqMoajbeWu+aiUwj V1EZ7Wla+E9OdTQYYK6vyI8weuko0EQzMAbrTcvEwelcx9vZ/08ODixiBCEqAgg+eH7K VzJefxSDGCJfNGvHd05YFTDouYj60QFlaQIaeS1uwus9K7hpEQqpjsoNXgYNJKN4FshX OINQ== X-Gm-Message-State: APjAAAUz6dh3fl9BdpZb5r5NohRUVUAxmoeuKvIRSgg4ywVZZ8SbdQyR AgVP5H7KhsFqEFNhNYKuPjdgUVl+yJaMMfo= X-Received: by 2002:a1f:d904:: with SMTP id q4mr43772171vkg.13.1577995274922; Thu, 02 Jan 2020 12:01:14 -0800 (PST) Date: Thu, 2 Jan 2020 12:00:52 -0800 In-Reply-To: <20200102200052.51182-1-semenzato@google.com> Message-Id: <20200102200052.51182-3-semenzato@google.com> Mime-Version: 1.0 References: <20200102200052.51182-1-semenzato@google.com> X-Mailer: git-send-email 2.24.1.735.g03f4e72817-goog Subject: [PATCH v2 2/2] pm: add more logging on hibernation failure From: Luigi Semenzato To: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, rafael@kernel.org, gpike@google.com, Luigi Semenzato Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hibernation fails when the kernel cannot allocate enough memory to copy all pages in use. This patch ensures that the failure reason is clearly logged. Signed-off-by: Luigi Semenzato --- kernel/power/snapshot.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index 26b9168321e7..df498717a97e 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c @@ -1705,16 +1705,20 @@ int hibernate_preallocate_memory(void) ktime_t start, stop; int error; - pr_info("Preallocating image memory... "); + pr_info("Preallocating hibernation image memory\n"); start = ktime_get(); error = memory_bm_create(&orig_bm, GFP_IMAGE, PG_ANY); - if (error) + if (error) { + pr_err("Cannot allocate original bitmap\n"); goto err_out; + } error = memory_bm_create(©_bm, GFP_IMAGE, PG_ANY); - if (error) + if (error) { + pr_err("Cannot allocate copy bitmap\n"); goto err_out; + } alloc_normal = 0; alloc_highmem = 0; @@ -1804,8 +1808,11 @@ int hibernate_preallocate_memory(void) alloc -= pages; pages += pages_highmem; pages_highmem = preallocate_image_highmem(alloc); - if (pages_highmem < alloc) + if (pages_highmem < alloc) { + pr_err("Image allocation is %lu pages short\n", + alloc - pages_highmem); goto err_out; + } pages += pages_highmem; /* * size is the desired number of saveable pages to leave in @@ -1836,13 +1843,12 @@ int hibernate_preallocate_memory(void) out: stop = ktime_get(); - pr_cont("done (allocated %lu pages)\n", pages); + pr_info("Allocated %lu pages for hibernation shapshot\n", pages); swsusp_show_speed(start, stop, pages, "Allocated"); return 0; err_out: - pr_cont("\n"); swsusp_free(); return -ENOMEM; } -- 2.24.1.735.g03f4e72817-goog