Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3797072pxf; Mon, 29 Mar 2021 11:40:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHCy+tPQNvKG7uiICn9K9fR5dzq4s9GocgY3kUujOI6L1HVyt8c2lG4MtpSm7cGPS0TOi5 X-Received: by 2002:aa7:dbd3:: with SMTP id v19mr29682106edt.314.1617043208307; Mon, 29 Mar 2021 11:40:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617043208; cv=none; d=google.com; s=arc-20160816; b=c8dHFdwHYwAFoyQ0lTFrCmu9j3jkTcJ9iYmNKf7lFZXxzMtgytkXHyYDpULgKiQT2G m5vfM0g9hWVFm+YZS+q993zW8TT4kCUG6Bw7oIPid7NSAghNwBV4Du9h2j0/LTQs2Ur2 p95hAA5uiiLQbbtUPh6Trmb3M9nTaEsgxn38+5ODt4IbKJmclNg5X1qMxW5cmkqhe/yf Yq6wtPrNnUhN6NdWSuVV9FPZuj4/Tp47pa4AyG77Wnr1o/dmTnkjW01qsBk+fPU77Myh 09aGe2eglZPXuMuvdL6q0tE+1pduEva8WTvPXGg+wDoEVpZ3VIHg5V8i58AmjxgK9FCO 2Grg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=1DY/5JNwP4LdGdtn/hpVmL+Re5YvZIHBGD6rbDJwrjc=; b=VDtXbn2DOp90GMSjnGMkeMtI0A+l08DJ6sNo9j2chBWNFIMrwKyIeLitvHkBjQj1eR fwzk7fruHL4H0hw+yysDKeBv4hoVnlu1ib0KXWIBxbUJ4wt+iyPGFXrOXYdKBewtnz8p KZ1+9N2NXVk2k98vK5kci/qu2/ahsuvW5ojIbL79hW14/FxmtcWArjy0DhHi6oBGGP1S HJurcDingsB7oi5yWPgjp2OJx5baBY+P9bdygc+/Br9v2t/t1fE1+EMDNJ3+3v+rp8SK eSxH845/tHAKh3Qdj7UHyWzXFivA/nRVtz6QvfTboUM2UtILI9zoT3Z1HxR3EMV9Kmr9 znWA== ARC-Authentication-Results: i=1; mx.google.com; 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 do3si13700955ejc.486.2021.03.29.11.39.45; Mon, 29 Mar 2021 11:40:08 -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; 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 S231660AbhC2SiO (ORCPT + 99 others); Mon, 29 Mar 2021 14:38:14 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:60208 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231479AbhC2Shm (ORCPT ); Mon, 29 Mar 2021 14:37:42 -0400 Received: from localhost (127.0.0.1) (HELO v370.home.net.pl) by /usr/run/smtp (/usr/run/postfix/private/idea_relay_lmtp) via UNIX with SMTP (IdeaSmtpServer 2.0.3) id 291421c0a50beb6e; Mon, 29 Mar 2021 20:37:41 +0200 Received: from kreacher.localnet (89-64-81-131.dynamic.chello.pl [89.64.81.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by v370.home.net.pl (Postfix) with ESMTPSA id 5480F669165; Mon, 29 Mar 2021 20:37:40 +0200 (CEST) From: "Rafael J. Wysocki" To: Linux PM Cc: LKML , Frederic Weisbecker , Peter Zijlstra , Thomas Gleixner , "Zhou Ti (x2019cwm)" Subject: [PATCH v1 0/5] cpuidle: Take possible negative "sleep length" values into account Date: Mon, 29 Mar 2021 20:12:39 +0200 Message-ID: <2764850.e9J7NaK4W3@kreacher> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="UTF-8" X-VADE-SPAMSTATE: clean X-VADE-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduledrudehkedguddvlecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfjqffogffrnfdpggftiffpkfenuceurghilhhouhhtmecuudehtdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkfgggfgtsehtufertddttdejnecuhfhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqnecuggftrfgrthhtvghrnhepvdevgfetueetheekudeuvdduteelvefftdfftdejjeeukeffteeikefgiefghedunecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucfkphepkeelrdeigedrkedurddufedunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepkeelrdeigedrkedurddufedupdhhvghlohepkhhrvggrtghhvghrrdhlohgtrghlnhgvthdpmhgrihhlfhhrohhmpedftfgrfhgrvghlucflrdcuhgihshhotghkihdfuceorhhjfiesrhhjfiihshhotghkihdrnhgvtheqpdhrtghpthhtoheplhhinhhugidqphhmsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtohepfhhrvgguvghrihgtsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehpvghtvghriiesihhnfhhrrgguvggrugdrohhrghdprhgtphhtthhopehtghhlgies lhhinhhuthhrohhnihigrdguvgdprhgtphhtthhopeigvddtudeltgifmhesshhtfhigrdgtrg X-DCC--Metrics: v370.home.net.pl 1024; Body=6 Fuz1=6 Fuz2=6 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi All, As follows from the discussion triggered by the patch at https://lore.kernel.org/lkml/20210311123708.23501-2-frederic@kernel.org/ the cpuidle governors using tick_nohz_get_sleep_length() assume it to always return positive values which is not correct in general. To address this issues, first document the fact that negative values can be returned by tick_nohz_get_sleep_length() (patch [1/5]). Then, in preparation for more substantial changes, change the data type of two fields in struct cpuidle_state to s64 so they can be used in computations involving negative numbers safely (patch [2/5]). Next, adjust the teo governor a bit so that negative "sleep length" values are counted like zero by it (patch [3/5]) and modify it so as to avoid mishandling negative "sleep length" values (patch [4/5]). Finally, make the menu governor take negative "sleep length" values into account properly (patch [5/5]). Please see the changelogs of the patches for details. Thanks!