Received: by 10.213.65.68 with SMTP id h4csp1991935imn; Thu, 5 Apr 2018 07:15:31 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+y/OxDeY4DLaezT2m/M/MM8EIFUK0NsG81Ol5Zrcqn3DeF5A8C1d7iUZ2M5i/6t31FaKLj X-Received: by 10.99.117.2 with SMTP id q2mr1655220pgc.248.1522937731310; Thu, 05 Apr 2018 07:15:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522937731; cv=none; d=google.com; s=arc-20160816; b=DPW80+8mJBYbYuXfti6tEf4+XYnaS8pZgMnsTAyBKsXkWHHa1pKb2XRC7VU+CvsDjt F/3cV8NtkP3DsNM8PMgs/aXfAmSI/Au78qxKWCgDKn+n7ABxvN5rPzvuK33MoN8k14zX wdxCnC7jHyw2ZTomjfD5M+38pOeIZ/KGAayc+pPFZ+I8EDa9MfT0PaE54QthUFl1TKg9 1gW6apa0H8miny8qjllcnaJ7pEw/bhiEmX0PEfcFyYLam7z39nYoV3EPlVFI0qvSMPSt JBX/r+455ZnzfV7wP95xAOm8syV4SVddgpm8eU65Mq7NwBSzRyYXHaLSNplSY8V2iwB3 +a1Q== 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:dkim-signature:arc-authentication-results; bh=Bgsz8nv8xKFbID1V54R+DgPyNIhMhNIM1p+UVHyw8Bo=; b=FkF4XPmalB8sEaXqO06ROtySvZEXSbytZ44Du/Zxml0C11ZQ/qA9TD0HEQFDkFHCw/ PfZSFM3F50qphUasP1KmCiGTEwRLigQVDLpKfg3/tlLTEYPi+LDBwymUgHsSPiXoDiCX dNeCtI5rfH5f+LhJpDmj0K+4+tuL2hd/renudNxyljH6TzfnQdyA7Um7jfKLe/5rLwjl 9FkO90rEiXl9n8tprnGlWAab4uGfhjt2Pw5KzWuHQCtYz0aAJX0bqb3zYWzqg7xyo00I bUqaWB8B3dZljte9503nEUcn0qDG1Z5L4ec/I3Td51048cWa2nFbnmlYhhhvUIME03tY YH6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=aeCG8JcT; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l69si6175881pfk.180.2018.04.05.07.15.17; Thu, 05 Apr 2018 07:15:31 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=aeCG8JcT; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751346AbeDEONl (ORCPT + 99 others); Thu, 5 Apr 2018 10:13:41 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:52994 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751165AbeDEONk (ORCPT ); Thu, 5 Apr 2018 10:13:40 -0400 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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Bgsz8nv8xKFbID1V54R+DgPyNIhMhNIM1p+UVHyw8Bo=; b=aeCG8JcTp+heLWAntaHpc7x1g swgyPU3uWqi0xhHPobVqHOh0ZvRl2kyLj6c8GOgaREoXbi0l3AqGAw6bMeyTjj1A1E3oiVn3BfeCm XICmEaBB1ImI3ZZ2hu/OVC/LIuBrwgiEK1g4/Pg7GiwgtaaKKWfm/upeHVj+YabdiZs1yuMVH7iPk g3AxAd/zFm+pE0xXb9XKtQEujgMWTdEgWn+T2VYzAvkMF8RPtvfTcO9nJ8b5bGEFhhbxJa5Apf+xa 9KZQqT/hgDW5yx8v6GMJsHz1XgTAvVz6RF1PQKuQ+4lYugCzpJyENQfLgD6Gf7Omnx3UsTbKrEY5f z/Byt21PQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1f45do-0005Wq-Nx; Thu, 05 Apr 2018 14:13:28 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A67522029F86F; Thu, 5 Apr 2018 16:13:26 +0200 (CEST) Date: Thu, 5 Apr 2018 16:13:26 +0200 From: Peter Zijlstra To: "Rafael J. Wysocki" Cc: "Rafael J. Wysocki" , Linux PM , Frederic Weisbecker , Thomas Gleixner , Paul McKenney , Thomas Ilsche , Doug Smythies , Rik van Riel , Aubrey Li , Mike Galbraith , LKML , Len Brown Subject: Re: [PATCH v9 10/10] cpuidle: menu: Avoid selecting shallow states with stopped tick Message-ID: <20180405141326.GH4129@hirez.programming.kicks-ass.net> References: <1736751.LdhZHb50jq@aspire.rjw.lan> <6542020.eHGLEK9V0J@aspire.rjw.lan> <20180405124757.GQ4082@hirez.programming.kicks-ass.net> <20180405141127.GS4043@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180405141127.GS4043@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 05, 2018 at 04:11:27PM +0200, Peter Zijlstra wrote: > On Thu, Apr 05, 2018 at 03:49:32PM +0200, Rafael J. Wysocki wrote: > > On Thu, Apr 5, 2018 at 2:47 PM, Peter Zijlstra wrote: > > > On Wed, Apr 04, 2018 at 10:50:36AM +0200, Rafael J. Wysocki wrote: > > >> + if (tick_nohz_tick_stopped()) { > > >> + /* > > >> + * If the tick is already stopped, the cost of possible short > > >> + * idle duration misprediction is much higher, because the CPU > > >> + * may be stuck in a shallow idle state for a long time as a > > >> + * result of it. In that case say we might mispredict and try > > >> + * to force the CPU into a state for which we would have stopped > > >> + * the tick, unless the tick timer is going to expire really > > >> + * soon anyway. > > > > > > Wait what; the tick was stopped, therefore it _cannot_ expire soon. > > > > > > *confused* > > > > > > Did you mean s/tick/a/ ? > > > > Yeah, that should be "a timer". > > *phew* ok, that makes a lot more sense ;-) > > My only concern with this is that we can now be overly pessimistic. The > predictor might know that statistically it's very likely a device > interrupt will arrive soon, but because the tick is already disabled, we > don't dare trust it, causing possible excessive latencies. > > Would an alternative be to make @stop_tick be an enum capable of forcing > the tick back on? > > enum tick_action { > NOHZ_TICK_STOP, > NOHZ_TICK_RETAIN, > NOHZ_TICK_START, > }; > > enum tick_action tick_action = NOHZ_TICK_STOP; > > state = cpuidle_select(..., &tick_action); > > switch (tick_action) { > case NOHZ_TICK_STOP: > tick_nohz_stop_tick(); > break; > > case NOHZ_TICK_RETAIN: > tick_nozh_retain_tick(); > break; > > case NOHZ_TICK_START: > tick_nohz_start_tick(); > break; > }; > > > Or something along those lines? To clarify, RETAIN keeps the status quo, if its off, it stays off, if its on it stays on.