Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp713171ybi; Fri, 31 May 2019 07:54:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqx9jl/CxHViwuOobM0P8VgrQYOL06DTuKRduRuhF8+0giRqsMCOw0QxChUooBvM2tSK57Vy X-Received: by 2002:a63:5b18:: with SMTP id p24mr9666443pgb.452.1559314442075; Fri, 31 May 2019 07:54:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559314442; cv=none; d=google.com; s=arc-20160816; b=DPHPzU7J0tEcvNqt8IZCx9r0mSTy+cLGijHpJzOpsHUreqCOPBBh5I8WEKjNfIOitd t31t6uNd4VNmAkpQfboeKBTwEI/Ek+NKKmYRYy0lX48MeD82cETbG5Ki6wYns/LCE9Ar icHiXnGFrkUXNdFcXJqhqSWfSJ0ZkE0K/WbN6TOj4CyVwKwFoHBj0RlfAo/bfXDSSX+G hItX+84OCUvZaK2mZrOubxydNw/+tJJQ5ceaT1RD3anO++KQswKg+EFnvlxPKWVFTKhX NOAARxwsUmskz1IUYSxaUkGSJGgNgmKBbL3qwoB22aUKd5rbSnZqvoENS0QTkTShOEfo BTnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=NW5Z4W7Ts4Rl1gZa4KBKsMgD9yEHQWaX32ne2Olq5rw=; b=pnxab06TGGamQtgYJWo0jIkJ5zkV8dnIBiSRHOu63rXOYBcUgk1E+cDvEcaHb1iUeN RRSO3JW0o1iiArliYAb1nx30pOQVzk+cnqwqvf3gDgRN5ChfAq2oeBHtupVhRJnFc3E1 LEmNBvbd5ZdwD76hWl6cX+P/VzARySzqIlmzwNG6Ulruu5oioqZ+FlRx8KZRt/jynZz0 T2Bu4ud9e6CwPMuAoh/XMIXDk1tP22FJRWKi+G2gbCKeFQ+6LjcnTZ3woFBSkoiCh5eD PThAe2RBD6ge7YtZvigPFiF5QeRqmwYD45OH78RPH9DzF/Jv3Rrp+cXEuxcDuvXfbV8Z xNkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yFRwOxGv; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i31si6243539pgl.15.2019.05.31.07.53.44; Fri, 31 May 2019 07:54:02 -0700 (PDT) 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=@kernel.org header.s=default header.b=yFRwOxGv; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726725AbfEaOv2 (ORCPT + 99 others); Fri, 31 May 2019 10:51:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:41590 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726037AbfEaOv2 (ORCPT ); Fri, 31 May 2019 10:51:28 -0400 Received: from pobox.suse.cz (prg-ext-pat.suse.com [213.151.95.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6E75D26B05; Fri, 31 May 2019 14:51:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559314287; bh=791bm7XMFp0foBsIcF2oS0fUFQH8SYTCapQ5fJHir8M=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=yFRwOxGvBGlmhGuP2+vkqqBtPsDlqWg0tpQzAjtqdWOVG0Y4nOG7oEZHTvMmqyR4q z2J+ImwfhOWxQ78VBiLkH0S8trvEYBg2qeT/9rhOgvLCpjR7jAG0+/zrpsGZFGRH2w 14m3+Ni1d4eTHO6rECYj7oodMhErf5+nk6UJ3CWY= Date: Fri, 31 May 2019 16:51:23 +0200 (CEST) From: Jiri Kosina To: Josh Poimboeuf cc: "Rafael J. Wysocki" , Thomas Gleixner , the arch/x86 maintainers , "Rafael J. Wysocki" , Pavel Machek , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Peter Zijlstra , Linux PM , Linux Kernel Mailing List , Andy Lutomirski Subject: Re: [PATCH v4] x86/power: Fix 'nosmt' vs. hibernation triple fault during resume In-Reply-To: <20190531051456.fzkvn62qlkf6wqra@treble> Message-ID: References: <20190530233804.syv4brpe3ndslyvo@treble> <20190531051456.fzkvn62qlkf6wqra@treble> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 31 May 2019, Josh Poimboeuf wrote: > > I personally am quite frequently using differnet combinations of > > resumer/resumee kernels, and I've never been biten by it so far. I'd guess > > I am not the only one. > > Fixmap sort of breaks that invariant. > > Right now there is no backwards compatibility because nosmt resume is > already broken. > > For "future" backwards compatibility we could just define a hard-coded > reserved fixmap page address, adjacent to the vsyscall reserved address. > > Something like this (not yet tested)? Maybe we could also remove the > resume_play_dead() hack? Looking into SDM: ===== A store to the address range armed by the MONITOR instruction, an interrupt, an NMI or SMI, a debug exception, a machine check exception, the BINIT# signal, the INIT# signal, or the RESET# signal will exit the implementation-dependent-optimized state. ===== And mwait doesn't have the 'auto-restart on SMM exit' like hlt does. So I guess that's why I am seeing the triple faults even with your (fixed, see below) patch as well. So I don't think we can safely use this aproach. > > diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h > index 9da8cccdf3fb..1c328624162c 100644 > --- a/arch/x86/include/asm/fixmap.h > +++ b/arch/x86/include/asm/fixmap.h > @@ -80,6 +80,7 @@ enum fixed_addresses { > #ifdef CONFIG_X86_VSYSCALL_EMULATION > VSYSCALL_PAGE = (FIXADDR_TOP - VSYSCALL_ADDR) >> PAGE_SHIFT, > #endif > + FIX_MWAIT = (FIXADDR_TOP - VSYSCALL_ADDR - 1) >> PAGE_SHIFT, > #endif > FIX_DBGP_BASE, > FIX_EARLYCON_MEM_BASE, > diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c > index 73e69aaaa117..9804fbe25d03 100644 > --- a/arch/x86/kernel/smpboot.c > +++ b/arch/x86/kernel/smpboot.c > @@ -108,6 +108,8 @@ int __read_mostly __max_smt_threads = 1; > /* Flag to indicate if a complete sched domain rebuild is required */ > bool x86_topology_update; > > +static char __mwait_page[PAGE_SIZE]; This needs to be __align(PAGE_SIZE) in order for the fixmap to work properly. -- Jiri Kosina SUSE Labs