From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752963AbcFFP7O (ORCPT ); Mon, 6 Jun 2016 11:59:14 -0400 Received: from mga09.intel.com ([134.134.136.24]:44175 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751828AbcFFP7L convert rfc822-to-8bit (ORCPT ); Mon, 6 Jun 2016 11:59:11 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,427,1459839600"; d="scan'208";a="714726741" From: "Chen, Yu C" To: Peter Zijlstra CC: "x86@kernel.org" , "linux-kernel@vger.kernel.org" , Thomas Gleixner , "Ingo Molnar" , "H . Peter Anvin" , "linux-pm@vger.kernel.org" , "Rafael J . Wysocki" , Pavel Machek , "Brown, Len" , Borislav Petkov , Zhu Guihua , Juergen Gross Subject: RE: [PATCH][RFC] x86, hotplug: Use zero page for monitor when resuming from hibernation Thread-Topic: [PATCH][RFC] x86, hotplug: Use zero page for monitor when resuming from hibernation Thread-Index: AQHRv/1q96T3nzYOZUac1KMGUSYqOZ/b+FoAgACfOjA= Date: Mon, 6 Jun 2016 15:59:06 +0000 Message-ID: <36DF59CE26D8EE47B0655C516E9CE6402876CB97@shsmsx102.ccr.corp.intel.com> References: <1465222749-8388-1-git-send-email-yu.c.chen@intel.com> <20160606142506.GE30909@twins.programming.kicks-ass.net> In-Reply-To: <20160606142506.GE30909@twins.programming.kicks-ass.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzZiOGNiODEtNmI3Ny00NWM5LWIxMTEtMGQ4M2YwMDc5ZGM5IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6InhzSkowdDl3UFllVXZuM1I5WjVOZFlMNFlDYTVwakwrMFA1UVBJcDRYQWM9In0= x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Peter, > -----Original Message----- > From: Peter Zijlstra [mailto:peterz@infradead.org] > Sent: Monday, June 06, 2016 10:25 PM > To: Chen, Yu C > Cc: x86@kernel.org; linux-kernel@vger.kernel.org; Thomas Gleixner; Ingo > Molnar; H . Peter Anvin; linux-pm@vger.kernel.org; Rafael J . Wysocki; Pavel > Machek; Brown, Len; Borislav Petkov; Zhu Guihua; Juergen Gross > Subject: Re: [PATCH][RFC] x86, hotplug: Use zero page for monitor when > resuming from hibernation > > On Mon, Jun 06, 2016 at 10:19:09PM +0800, Chen Yu wrote: > > @@ -1595,8 +1596,21 @@ static inline void mwait_play_dead(void) > > * This should be a memory location in a cache line which is > > * unlikely to be touched by other processors. The actual > > * content is immaterial as it is not actually modified in any way. > > + * > > + * However in hibernation resume process, this address could be > > + * touched by BSP when restoring page frames, if the page table > > + * for this address is not coherent across hibernation(due to > > + * inconsistence of e820 memory map), access from APs might > > + * cause exception. So change the mwait address to zero page, > > + * which is located in .bss, in this way we can avoid illegal > > + * access from APs because page table for kernel mapping > > + * of text/data/bss should keeps unchanged according to > > + * hibernation semantic. > > */ > > - mwait_ptr = ¤t_thread_info()->flags; > > + if (hibernation_in_resume()) > > + mwait_ptr = empty_zero_page; > > + else > > + mwait_ptr = ¤t_thread_info()->flags; > > Why is this conditional? Is there any case in which the zero page is not also > correct? I'm thinking of avoid unnecessary wakeup for normal CPU offline, for example, if one driver uses the zero page and access it.