Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6536208ybi; Wed, 29 May 2019 09:12:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqzm0jL+F14SYt22l/MaSoD6nRpAgayyw62I89WTJn7r7xrMYjNAZqX2TDIxY8724SExThV9 X-Received: by 2002:a17:902:988a:: with SMTP id s10mr9445801plp.304.1559146345796; Wed, 29 May 2019 09:12:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559146345; cv=none; d=google.com; s=arc-20160816; b=rOE2BlAg1tkRwo0+qMXonyU61p9LKlPad1tSXPhNhWL6T1rmX/hgcwejAU5JQSXs8m hjKFgGls95Jku4hIwIKK6PAK0EGW3Mar71eCZuF7ruzz8yBeyHdT+t8KA5yAF116UJ7/ hLIfl1xJyqRXzI7VdB+4RXXc8MZk7pcznFTfip89KzzH3nT6vi1wjOxnJcQnZhqPXIqW +HSJWL4vw9pekIpImZd66ZA7bI2bW2X/DQJliTViCEx/CGV+xb8tEpHBkO/SVN57waqO 8maLbn+ntU8/9NyjfojDsI/+dpTOpGvbq/Cm1zZf027Hvxegz7ul+zu3C1RKC8QFXbiW dKxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=0LXAsDGY2b7x32Pj6kGL6bdRtPXJ7c65AjKX5tX957o=; b=mQ07izZw7R3w+TGWNG/Pv3aT5vKxm+r/vtamR+6a2frsBN2l2Lau0gbt5mI5rySa6t 7bt6p7B+VcpDTEAo18kYY0RIhaD/S7NTFnZSs6TsOCMfgi/bJCv4z+XmLYJEEsN7AW1U GM3yt7c/JKoMBGhqwuNPyEQsVf14XalrGdyWC/OKS+wQNlcZhID9JQSL/eh9dOYwTJgJ jig6aMU6TrYSuTjZwtO6c5S57fn25+L4gyBc+eWC8BlKkk+q8HYzDEtnJgjgFxz7bwd7 bBUxpCqjn9t182h9sLJogyRD29g9KG5EMKoHMw+357PPAk2QRivdtGgPE2UWx4udgRHj ejQA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a10si15598pla.60.2019.05.29.09.12.07; Wed, 29 May 2019 09:12:25 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727129AbfE2QKk (ORCPT + 99 others); Wed, 29 May 2019 12:10:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58631 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726062AbfE2QKk (ORCPT ); Wed, 29 May 2019 12:10:40 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A594E30B97AA; Wed, 29 May 2019 16:10:34 +0000 (UTC) Received: from treble (ovpn-123-24.rdu2.redhat.com [10.10.123.24]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 56CDF17A8F; Wed, 29 May 2019 16:10:30 +0000 (UTC) Date: Wed, 29 May 2019 11:10:28 -0500 From: Josh Poimboeuf To: Jiri Kosina Cc: "Rafael J. Wysocki" , Pavel Machek , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Peter Zijlstra , x86@kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] x86/power: Fix 'nosmt' vs. hibernation triple fault during resume Message-ID: <20190529161028.a6kpywzpjazgql5u@treble> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Wed, 29 May 2019 16:10:39 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 29, 2019 at 12:32:02PM +0200, Jiri Kosina wrote: > From: Jiri Kosina > > As explained in > > 0cc3cd21657b ("cpu/hotplug: Boot HT siblings at least once") > > we always, no matter what, have to bring up x86 HT siblings during boot at > least once in order to avoid first MCE bringing the system to its knees. > > That means that whenever 'nosmt' is supplied on the kernel command-line, > all the HT siblings are as a result sitting in mwait or cpudile after > going through the online-offline cycle at least once. > > This causes a serious issue though when a kernel, which saw 'nosmt' on its > commandline, is going to perform resume from hibernation: if the resume > from the hibernated image is successful, cr3 is flipped in order to point > to the address space of the kernel that is being resumed, which in turn > means that all the HT siblings are all of a sudden mwaiting on address > which is no longer valid. > > That results in triple fault shortly after cr3 is switched, and machine > reboots. > > Fix this by always waking up all the SMT siblings before initiating the > 'restore from hibernation' process; this guarantees that all the HT > siblings will be properly carried over to the resumed kernel waiting in > resume_play_dead(), and acted upon accordingly afterwards, based on the > target kernel configuration. hibernation_restore() is called by user space at runtime, via ioctl or sysfs. So I think this still doesn't fix the case where you've disabled CPUs at runtime via sysfs, and then resumed from hibernation. Or are we declaring that this is not a supported scenario? Would it be possible for mwait_play_dead() to instead just monitor a fixmap address which doesn't change for kaslr? Is there are reason why maxcpus= doesn't do the CR4.MCE booted_once dance? -- Josh