From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753285AbcFFVHK (ORCPT ); Mon, 6 Jun 2016 17:07:10 -0400 Received: from terminus.zytor.com ([198.137.202.10]:46452 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751473AbcFFVHG (ORCPT ); Mon, 6 Jun 2016 17:07:06 -0400 Subject: Re: [PATCH][RFC] x86, hotplug: Use zero page for monitor when resuming from hibernation To: Peter Zijlstra , "Chen, Yu C" References: <1465222749-8388-1-git-send-email-yu.c.chen@intel.com> <20160606142506.GE30909@twins.programming.kicks-ass.net> <36DF59CE26D8EE47B0655C516E9CE6402876CB97@shsmsx102.ccr.corp.intel.com> <20160606164033.GD30154@twins.programming.kicks-ass.net> Cc: "x86@kernel.org" , "linux-kernel@vger.kernel.org" , Thomas Gleixner , Ingo Molnar , "linux-pm@vger.kernel.org" , "Rafael J . Wysocki" , Pavel Machek , "Brown, Len" , Borislav Petkov , Zhu Guihua , Juergen Gross From: "H. Peter Anvin" Message-ID: <743a8e5b-abe2-3bc1-bc03-71157b42c9ca@zytor.com> Date: Mon, 6 Jun 2016 14:05:06 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-Version: 1.0 In-Reply-To: <20160606164033.GD30154@twins.programming.kicks-ass.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/06/16 09:40, Peter Zijlstra wrote: > On Mon, Jun 06, 2016 at 03:59:06PM +0000, Chen, Yu C wrote: > >>>> + 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. > > Writing to the zero page would be a major fail. > One implementation of MWAIT is for the waiting processor to claim the line in an exclusive state, which would be highly undesirable for the zero page. I don't actually know if this is done by any real implementation, however. Either way, the problem at hand seems limited to post-hibernation, as for regular CPU offline the page tables will be fully populated, so it seems like it should not be an issue. -hpa