Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4215710ybi; Mon, 3 Jun 2019 07:26:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqxv3hMeArMhKOKpumFEluLYVW/0Z/6GqdPTvBOWZnJ9MoU2pTNFxlV6bMnPC9Q6RmKOdwYU X-Received: by 2002:a63:c508:: with SMTP id f8mr29248212pgd.48.1559571972283; Mon, 03 Jun 2019 07:26:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559571972; cv=none; d=google.com; s=arc-20160816; b=ubbMyunaE7/Q7Kjjj9VTqQRFL0UB2EX+HrETtZtsAI3gIWJ/Jxn134odOrVnbK+Xiz Dqgp/DPC3fRaI212HDy8hesaxoBZQKSzHEGQyi3Kp6R+7WbN+TmShgiwCuGiFF11KcrX JqPaIjNvTCckcNLuT3fXbSW+8v3zjpMxFDkMneMQOy+YiWV5i0vjWkFnd4d1Cu3DwIF2 6ek8FI8hFmWGiKpv78yymEuc63uPvUxvxeVQv9Sy8klsf4ZAHvFPYskBqxRXvab6crHD KxjC86V3s8Kwa65XY70aVO0ETMyCRp1X1TQ5LMXoa0+bfx+/6QPKjeEDWFh//8qmrgDK QllA== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=6DlPEFJQI7TntLl1Y1VE6tB9/B+oV0MS6JM8hiclkAM=; b=qHba7vTao06yyKZFJdOKCBhpsvKqzkLMqZ5OM5vYP5QvhuJE9tKVbsd3jsRJ6S77Ub RO5LdkmQEl33FD3G+J4+RacnjjJ+1coeK5tezUg2pbVI0EZUO1BWMNxRLj7Ef0RsgAWt bRU0Hp6Y+dOvW56kIjHNcI9qk4DMycaS3Kt1tgFXMDguw3dPLKjxCKYYLGKquXx9ERsa mk68J30ptIqeEYvUD3VQl/i1mJfFPqXD+WehHO+e5uK3Q2B7ruMS9jLMhYB97WN57jUj qxcZILMOCHaUCLvNgRQv5oQmqY40aYqKYKj8HvXv0O8XTsYtXR7v3746d1lAJeNGDM88 V7pA== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p13si18885866pgd.347.2019.06.03.07.25.54; Mon, 03 Jun 2019 07:26:12 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729037AbfFCOXc (ORCPT + 99 others); Mon, 3 Jun 2019 10:23:32 -0400 Received: from mga17.intel.com ([192.55.52.151]:31791 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727429AbfFCOXc (ORCPT ); Mon, 3 Jun 2019 10:23:32 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Jun 2019 07:23:32 -0700 X-ExtLoop1: 1 Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.36]) by fmsmga008.fm.intel.com with ESMTP; 03 Jun 2019 07:23:31 -0700 Date: Mon, 3 Jun 2019 07:23:31 -0700 From: Sean Christopherson To: Andy Lutomirski Cc: Jiri Kosina , Andy Lutomirski , "Rafael J. Wysocki" , Josh Poimboeuf , "Rafael J. Wysocki" , Thomas Gleixner , the arch/x86 maintainers , Pavel Machek , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Peter Zijlstra , Linux PM , Linux Kernel Mailing List Subject: Re: [PATCH v4] x86/power: Fix 'nosmt' vs. hibernation triple fault during resume Message-ID: <20190603142330.GA13384@linux.intel.com> References: <20190531051456.fzkvn62qlkf6wqra@treble> <5564116.e9OFvgDRbB@kreacher> <98E57C7E-24E2-4EB8-A14E-FCA80316F812@amacapital.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <98E57C7E-24E2-4EB8-A14E-FCA80316F812@amacapital.net> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 31, 2019 at 02:22:27PM -0700, Andy Lutomirski wrote: > > > On May 31, 2019, at 2:05 PM, Jiri Kosina wrote: > > > >> On Fri, 31 May 2019, Andy Lutomirski wrote: > >> > >> The Intel SDM Vol 3 34.10 says: > >> > >> If the HLT instruction is restarted, the processor will generate a > >> memory access to fetch the HLT instruction (if it is > >> not in the internal cache), and execute a HLT bus transaction. This > >> behavior results in multiple HLT bus transactions > >> for the same HLT instruction. > > > > Which basically means that both hibernation and kexec have been broken in > > this respect for gazillions of years, and seems like noone noticed. Makes > > one wonder what the reason for that might be. > > > > Either SDM is not precise and the refetch actually never happens for real > > (or is always in these cases satisfied from I$ perhaps?), or ... ? > > > > So my patch basically puts things back where they have been for ages > > (while mwait is obviously much worse, as that gets woken up by the write > > to the monitored address, which inevitably does happen during resume), but > > seems like SDM is suggesting that we've been in a grey zone wrt RSM at > > least for all those ages. > > > > So perhaps we really should ditch resume_play_dead() altogether > > eventually, and replace it with sending INIT IPI around instead (and then > > waking the CPUs properly via INIT INIT START). I'd still like to do that > > for 5.3 though, as that'd be slightly bigger surgery, and conservatively > > put things basically back to state they have been up to now for 5.2. > > > > > Seems reasonable to me. I would guess that it mostly works because SMI isn’t > all that common and the window where it matters is short. Or maybe the SDM > is misleading. For P6 and later, i.e. all modern CPUs, Intel processors go straight to halted state and don't fetch/decode the HLT instruction. P5 actually did a fetch, but from what I can tell that behavior wasn't carried forward to KNC, unlike other legacy interrupt crud from P5: [1] https://lkml.kernel.org/r/20190430004504.GH31379@linux.intel.com