Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752019AbbHMDZX (ORCPT ); Wed, 12 Aug 2015 23:25:23 -0400 Received: from smtp.nue.novell.com ([195.135.221.5]:49408 "EHLO smtp.nue.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751495AbbHMDZU (ORCPT ); Wed, 12 Aug 2015 23:25:20 -0400 Date: Thu, 13 Aug 2015 11:25:00 +0800 From: joeyli To: "Chen, Yu C" Cc: "joeyli.kernel@gmail.com" , "matthew.garrett@nebula.com" , "linux-kernel@vger.kernel.org" , "vojtech@suse.cz" , "linux-pm@vger.kernel.org" , "pavel@ucw.cz" , "rjw@rjwysocki.net" , "jkosina@suse.cz" , "mingo@redhat.com" , "hpa@zytor.com" , "linux-efi@vger.kernel.org" , "Brown, Len" , "jwboyer@redhat.com" , "Fleming, Matt" Subject: Re: [PATCH v2 09/16] PM / hibernate: Reserve hibernation key and erase footprints Message-ID: <20150813032500.GG5518@linux-rxt1.site> References: <1439273796-25359-1-git-send-email-jlee@suse.com> <1439273796-25359-10-git-send-email-jlee@suse.com> <1439434143.15722.12.camel@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1439434143.15722.12.camel@localhost> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1598 Lines: 50 Hi Yu, Thanks for your reviewing. On Thu, Aug 13, 2015 at 02:45:32AM +0000, Chen, Yu C wrote: > Hi Chun-yi, > On Tue, 2015-08-11 at 14:16 +0800, Lee, Chun-Yi wrote: > > > +/* A page used to keep hibernation keys */ > > +static struct hibernation_keys *hibernation_keys; > > + > > +void __init parse_hibernation_keys(u64 phys_addr, u32 data_len) > > +{ > > + struct setup_data *hibernation_setup_data; > > + > > + /* Reserve keys memory, will copy and erase in init_hibernation_keys() */ > > + keys_phys_addr = phys_addr + sizeof(struct setup_data); > > + memblock_reserve(keys_phys_addr, sizeof(struct hibernation_keys)); > > + > > + /* clear hibernation_data */ > > + hibernation_setup_data = early_memremap(phys_addr, data_len); > > + if (!hibernation_setup_data) > > + return; > > + > should we invoke memblock_free if early_memremap failed? > > Best Regards, > Yu > > Should not free memblock reservation of key data. Using memblock_reserve is for reserve hibernation key until init_hibernation_keys() copy key data to arbitrary allocated page. Using early_memremap is for cleaning the setup_data header that's used to carry key. That above 2 actions are different purposes. So, even the action of cleaning setup_data failed, it doesn't affect to the action for reserve hibernation key by memblock until copy it. Thanks a lot! Joey Lee -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/