Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp698553pxb; Wed, 20 Jan 2021 19:02:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJyKjMBVn58FDL4lvWClhIxtJO10h5PYgokOxgjVJnN3j1TCZ4wlfMjNopDriuibgWPaZ73H X-Received: by 2002:a05:6402:4391:: with SMTP id o17mr9560916edc.196.1611198149424; Wed, 20 Jan 2021 19:02:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611198149; cv=none; d=google.com; s=arc-20160816; b=o94Pw7SR16SxmR8gL9YGVAK47uItB95NtlGM3DiqYMzsl53UE0lEjmeu0qd5xGbo5E VxyIEO5gmZNHDBGQcsQILfhlu2Irl0Ttkv8V+w1fnbovzTjN7bvrigcgleTmaAt5tJpR JZPTi0nw/xVc2ozsN06ZO+6hQObpKXPBN6zAFajV3WsFlz6HbR88Rv/3fBnWg6885RDh m3OSpgXwSB/zU3gelu+rxPgEVAAMbgXx/ZbKUmsluXIxkXmSEzKfdXmju4yFtIViDni7 v/i8ewt6Tc9Oyj9Lg7POr4vQ2d5/ZjmZCQDAZYWneZJjIqeDEIbwww4I4YTy3uEJG46t eT7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject:dkim-signature; bh=H603GUvTsV5/p6cx5WZjf9Jz/sRtn7FJe9+A2fMe4M4=; b=l0+mNb1va9vOYh56YsjiVVjDQc3Zwx2O5Qt3ILpK+tsKO/W3OEQHyNod5sQLG1CZgN CM4T/ZkcEig9TUeE7ozjKc8SUhB29BDEfZsLqzM/TVsW1/XRp/SRbgYJGZ8GmFQcvGK4 FXGOylqetQeRt1KkfHKYhHEv0isKcRcthSo1B+Drl7oJfKCO2QSUj81t+vH6ZqkoQRRc MT2ma3CYee+eAGRFkB5OZv70lUZqGHeEZ4p6qllEbsbMp/AF35hr82WtcyCWVgprldZz oJkaypI+1Jv7rTfCf5bthny72rbkSzALVpIvV5WxN70Qk6Iy0kTFZnyXnJRPeJ4MGdxc duoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=QTXUCVET; 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 c20si1588048edy.440.2021.01.20.19.02.06; Wed, 20 Jan 2021 19:02:29 -0800 (PST) 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=pass header.i=@infradead.org header.s=merlin.20170209 header.b=QTXUCVET; 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 S2388291AbhAUAFm (ORCPT + 99 others); Wed, 20 Jan 2021 19:05:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387935AbhATWOX (ORCPT ); Wed, 20 Jan 2021 17:14:23 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7570EC061795 for ; Wed, 20 Jan 2021 14:11:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:To:Subject:Sender: Reply-To:Cc:Content-ID:Content-Description; bh=H603GUvTsV5/p6cx5WZjf9Jz/sRtn7FJe9+A2fMe4M4=; b=QTXUCVETYXdtGTTiwFBzy1LNYV kZSUcz5bY3bSWDGC59nCN7ExfiSsbKzsSXnUWK268cTII6yizHCI7SFDBnDuXc3GkyofydtN5KXh/ Uv7VOGOwWlavgz/H5dS/vg/jqHXUvh20BM5w5TLUs23FGxAg5y+iKlTlXVVC4Yb8E7OsM5R8O9YiU wZT5VlIt9nXqVPSx7GN1v4JTQzGJX7nS4sXtNt2S4srXyoQl3WzMG2lI4pSlTc2/VCLTI5W32aqUz a38R4vZhMxzgYF9kbOJqul973VwFw4SmJn+YQN7k3AtTiMXuDIXR7PPvdHsMipENaZ4vLzkLhsjbd nlcNqU4A==; Received: from [2601:1c0:6280:3f0::9abc] by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2LhX-0004LV-NU; Wed, 20 Jan 2021 22:11:44 +0000 Subject: Re: [PATCH] fix the issue that the tick_nohz_get_sleep_length() function could return a negative value To: "Zhou Ti (x2019cwm)" , "linux-kernel@vger.kernel.org" References: From: Randy Dunlap Message-ID: <5f43e80a-7f04-65c0-9c24-02c8330d691a@infradead.org> Date: Wed, 20 Jan 2021 14:11:38 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=gbk Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/20/21 10:58 AM, Zhou Ti (x2019cwm) wrote: > Fix the issue that the tick_nohz_get_sleep_length() function could return > a negative value. > > The variable "next_event" has a small possibility to be smaller than the > variable "now" during running. Since both the menu idle governor and the > teo idle governor use u64 to store the return value of the function, this > may result in an extremely large and invalid value. > > One can easily detect the existence of this issue by using printk to > output a warning. > > Signed-off-by: Ti Zhou > --- > --- tip/kernel/time/tick-sched.c.orig 2021-01-20 05:34:25.151325912 -0400 > +++ tip/kernel/time/tick-sched.c 2021-01-20 07:09:15.060980886 -0400 > @@ -1156,6 +1156,9 @@ ktime_t tick_nohz_get_sleep_length(ktime > next_event = min_t(u64, next_event, > hrtimer_next_event_without(&ts->sched_timer)); > > + if (unlikely(next_event < now)) > + next_event = now; > + > return ktime_sub(next_event, now); > } > Hi, You need to send this to some maintainer who can apply/merge it. Just sending it to a mailing list is not sufficient. thanks. -- ~Randy