Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1877468ybt; Mon, 15 Jun 2020 11:43:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwMueTEUoL49miohy+O6eC8xq7+i5YezmqgaRgfk06t0AXR5m920pq27lk8uRy6Ra+Xma33 X-Received: by 2002:a17:906:1c8c:: with SMTP id g12mr26582120ejh.456.1592246630127; Mon, 15 Jun 2020 11:43:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592246630; cv=none; d=google.com; s=arc-20160816; b=DXUlBu2ZYv4CtuyUj2nxei8KUPqX5tZbSTOmIg/dLuuq+RSnW0ZsmZKw44XSKfZz1e xNNQ2cBzqartszfk6ddjx2sAScbkE/0wwITuNHzNzPsPb8u55/wvvKVk0UG1rUBxyyix 0032Ctg87Bx6KpIiZD2Uzfr0NKJkkley0Tj+mUEhHAulVGru6JBnXSw9fel1ot8tM/ES sahomS7CRY4dG3wiYEZ0swOEi9n/IklzZ8EhgqUEQGKjeQ04j0dBnvDX3NcFwT5PrtCZ jLyZU4HF9NEDDdfHOTYJyL1Q45tE5efPe+h1fe8vqHj/QGDmWEPRpT9HEu9Pr27Gatnv Yn/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=zN/Nv/pr9vVaSfZ2zDdo/huhxeODkyXQIX0vAvnL4ec=; b=Mui6bQtJoOs1NJIkySm2dAP4Iiu8rz2J2ZUYMsX12pS5GEMexboIIH0EW0b24nkXIK oR4lc+/ChAcEJ9Yy7fq5w0ggzVkJzZQvwIh0ajPzRxorLMGcoABkzB+S1cuN3RZTfCAx mQtaqkxYWR3eUNF6wb1yGKAGRvOEFQ0S9qX52Uku9BwQ3Mgj54wpgAdQEaeMy3V1XEa0 C7Ao3nCJXWCVq3Y6XQz8Z3um+x1qGvJvnfZ3/UE/KWOOtbzu/1Box9V6Zy7d3iEJMhgy iBJQQVWFJtXqmrIQ97TVUCAe+pL5ELCFzumiwl5kjX6DO2vSV8OZBsveYmy/KJDpC6JB o7Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=IDDUm1JD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m19si9648410ejd.738.2020.06.15.11.43.26; Mon, 15 Jun 2020 11:43:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=IDDUm1JD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731410AbgFOSks (ORCPT + 99 others); Mon, 15 Jun 2020 14:40:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731279AbgFOSkp (ORCPT ); Mon, 15 Jun 2020 14:40:45 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A81E9C061A0E; Mon, 15 Jun 2020 11:40:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=zN/Nv/pr9vVaSfZ2zDdo/huhxeODkyXQIX0vAvnL4ec=; b=IDDUm1JDiDC43AnkAetdgjEzKd Ayvpow2HB0p5VOLLx1Kv1Yc4iHD+J8HRUFy3d+wL13OMzmdTa+bkkdU+pWwM7PwB39hZuuY8qJCdE xh4jT4KFsNmlGK3RPC6E1rasSWhSn3Oy5A0B9AkkmUe5Nlq+FBk5gQrVhbDKsc1Nu2GC8lV2ErIiO FKrKjtSHfOn0oywBlXdtMO5hr1q4SeA4GWxy2s3X1zNIv3fv53gZ3Hu9Pgfapcr9N1j5kd9du+T7a o5XWdld6a0L5Q4KB+l/jybedI35DwVe/k3yxr+zoXbamDjmcOgM3CmPoiOZfbPcV4KT8XtX63AqFh 0StLd1ig==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jku2F-0002py-HS; Mon, 15 Jun 2020 18:40:43 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id D1654306089; Mon, 15 Jun 2020 20:40:41 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id BC6F4201CB85A; Mon, 15 Jun 2020 20:40:41 +0200 (CEST) Date: Mon, 15 Jun 2020 20:40:41 +0200 From: Peter Zijlstra To: Chen Yu Cc: "Rafael J. Wysocki" , Daniel Lezcano , Ingo Molnar , Len Brown , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][RFC] PM / s2idle: Clear _TIF_POLLING_NRFLAG before suspend to idle Message-ID: <20200615184041.GG2531@hirez.programming.kicks-ass.net> References: <20200615173611.15349-1-yu.c.chen@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200615173611.15349-1-yu.c.chen@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 16, 2020 at 01:36:11AM +0800, Chen Yu wrote: > Suspend to idle was found to not work on Goldmont CPU recently. > And the issue was triggered due to: > > 1. On Goldmont the CPU in idle can only be woken up via IPIs, > not POLL mode: > Commit 08e237fa56a1 ("x86/cpu: Add workaround for MONITOR > instruction erratum on Goldmont based CPUs") > 2. When the CPU is entering suspend to idle process, the > _TIF_POLLING_NRFLAG is kept on. > 3. Commit b2a02fc43a1f ("smp: Optimize send_call_function_single_ipi()") > makes use of _TIF_POLLING_NRFLAG to avoid sending IPIs to > idle CPUs. > 4. As a result, some IPIs related functions might not work > well during suspend to idle on Goldmont. For example, one > suspected victim: > tick_unfreeze() -> timekeeping_resume() -> hrtimers_resume() > -> clock_was_set() -> on_each_cpu() might wait forever, > because the IPIs will not be sent to the CPUs which are > sleeping with _TIF_POLLING_NRFLAG set, and Goldmont CPU > could not be woken up by only setting _TIF_NEED_RESCHED > on the monitor address. *sigh*... just what we need. > @@ -186,8 +187,10 @@ int cpuidle_enter_s2idle(struct cpuidle_driver *drv, struct cpuidle_device *dev) > * be frozen safely. > */ > index = find_deepest_state(drv, dev, U64_MAX, 0, true); > - if (index > 0) > + if (index > 0) { > + __current_clr_polling(); > enter_s2idle_proper(drv, dev, index); > + } > > return index; > } So how is that commit 08e237fa56a1 not suffient? That makes mwait_idle_with_hints() DTRT for this 'functionally challenged' piece of hardware. AFAICT intel_enter_s2idle() uses mwait_idle_with_hints(). What am I missing?