From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750984AbdIKFsZ (ORCPT ); Mon, 11 Sep 2017 01:48:25 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:37370 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750748AbdIKFsX (ORCPT ); Mon, 11 Sep 2017 01:48:23 -0400 X-Google-Smtp-Source: ADKCNb6GWiG43As6SSzzTbpzBDOfu35JZ8HAPInt2FBploSfXc/pQif9Od1WOcF29tNHrzl4JBmv/g== Date: Mon, 11 Sep 2017 07:48:19 +0200 From: Ingo Molnar To: Andy Lutomirski Cc: Jiri Kosina , X86 ML , Borislav Petkov , "linux-kernel@vger.kernel.org" , Linus Torvalds Subject: Re: [PATCH 2/2] x86/hibernate/64: Mask off CR3's PCID bits in the saved CR3 Message-ID: <20170911054819.2dnlrhwc6myf7iog@gmail.com> References: <18ca57090651a6341e97083883f9e814c4f14684.1504847163.git.luto@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Andy Lutomirski wrote: > On Fri, Sep 8, 2017 at 12:59 AM, Jiri Kosina wrote: > > On Thu, 7 Sep 2017, Andy Lutomirski wrote: > > > >> Jiri reported a resume-from-hibernation failure triggered by PCID. > >> The root cause appears to be rather odd. The hibernation asm > >> restores a CR3 value that comes from the image header. If the image > >> kernel has PCID on, it's entirely reasonable for this CR3 value to > >> have one of the low 12 bits set. The restore code restores it with > >> CR4.PCIDE=0, which means that those low 12 bits are accepted by the > >> CPU but are either ignored or interpreted as a caching mode. This > >> is odd, but still works. We blow up later when the image kernel > >> restores CR4, though, since changing CR4.PCIDE with CR3[11:0] != 0 > >> is illegal. Boom! > >> > >> FWIW, it's entirely unclear to me what's supposed to happen if a PAE > >> kernel restores a non-PAE image or vice versa. Ditto for LA57. > > > > I've just performed 15 hibernation cycles with current Linus' tree > > (5969d1bb3082) with these two patches applied on top of it, and I haven't > > encountered any issue (and the warning in switch_mm_irqs_off() didn't > > trigger either). > > > >> Reported-by: Jiri Kosina > >> Fixes: 660da7c9228f ("x86/mm: Enable CR4.PCIDE on supported systems") > >> Signed-off-by: Andy Lutomirski > > > > Tested-by: Jiri Kosina > > > > Ingo, please do *not* apply this patch yet. The code is fine, but the > comment is about to become wrong. I just found a nasty initialization > order issue, and I need to rework a bunch of the way we deal with > PCIDE. Ok, I'll delay everything PCID delayed - once you've gathered it all together please send a full series against Linus's latest collecting all the fixes/cleanups. If you find unexpected complications then there will be a point in time where it might be better to just disable PCID for this release and re-try in v4.15. As the number and complexity of fixes increases so does the risk that we'll introduce some last-minute regression. Thanks, Ingo