Received: by 10.223.176.5 with SMTP id f5csp238441wra; Thu, 1 Feb 2018 19:21:29 -0800 (PST) X-Google-Smtp-Source: AH8x227qMH8WNLmkSo4q/Y4p1msBQoB0UHDcjCaayH5/XwNmmf/TXpUQKDu0nlGQq3DoW/alGe5J X-Received: by 2002:a17:902:6186:: with SMTP id u6-v6mr33000809plj.390.1517541689433; Thu, 01 Feb 2018 19:21:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517541689; cv=none; d=google.com; s=arc-20160816; b=NCW3wKo53mgL3Ju2lbtIQ4+WmlCUPr6RJAG48eFErL1rvk4UYeBfppPC3HSIVTvtSt 7H2f9qHFN3o9RmIQ6TD7SneAPqPrSNwItWRKIRB/WlCU5My+tXaXrtA0Dy2QKjS/8LYD AppxEaNJCFN9wDpOq7wRdRrqreO/uFtgF7/KQrqThAWBeTNoKOD/Ix6htUfyehJ/Z6xa WPoncOXA7RqTRTQJdjgwyIcEgeeMXszPDJrZ4FhBusXiUBvt7ZBHZ7Rlk8SAQ5C3ilwU El9pqRbRtosTIvx5L6Udki1iYQWi05kd3COeMkf0zEef1heIN7KfpedwSKNRWo+1sDZH HCtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=POxMW/h0sfs3xJ3MOsmqXXGe1bIqhGP6nxc5CvIKxb4=; b=DWLMKBWwwrrfGn2UsFr0M8meYz/2+Ly9IPXPGnhOACwlbmD1eHAZ+a8glm06NWvMxk eLk3PlQ9ImzpwarKlzeYdDrrxJOeE5UDkvC4tqhmoVqGqD52z4y8QdwvjlUUlYOpzR7G Pi/DL4wkrbwhluQniKwbLN6Bt8ih7QcpHjYnCaSzHwBFyVQq6IDhgYppLOXqW7U3Izod BN3JJr9EjFvqurj1o/0uBt8h98T9yKdvBuP00DIO8lUZSd1UL9whGi0T1vwj9EkaBhAr SgzjHdap/D752wlMKHZfbpmNqg8oeBPMLRzlJkhe+cQ40Aei4BBd7ViBk+2YM32M+OHE pT7A== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r14si729368pgq.535.2018.02.01.19.21.08; Thu, 01 Feb 2018 19:21:29 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751796AbeBBDS3 (ORCPT + 99 others); Thu, 1 Feb 2018 22:18:29 -0500 Received: from [210.13.100.6] ([210.13.100.6]:41769 "EHLO mail2012.asrmicro.com" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751730AbeBBDS0 (ORCPT ); Thu, 1 Feb 2018 22:18:26 -0500 X-Greylist: delayed 904 seconds by postgrey-1.27 at vger.kernel.org; Thu, 01 Feb 2018 22:18:25 EST Received: from localhost (10.1.50.16) by mail2012.asrmicro.com (10.1.24.123) with Microsoft SMTP Server (TLS) id 15.0.847.32; Fri, 2 Feb 2018 11:03:15 +0800 From: Qiao Zhou To: , , , CC: Qiao Zhou Subject: [PATCH] tick/broadcast: set next event of bc to KTIME_MAX Date: Fri, 2 Feb 2018 11:02:47 +0800 Message-ID: <1517540567-23599-1-git-send-email-qiaozhou@asrmicro.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.1.50.16] X-ClientProxiedBy: mail2012.asrmicro.com (10.1.24.123) To mail2012.asrmicro.com (10.1.24.123) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In tick_handle_oneshot_broadcast, it doesn't reprogram tick-broadcast when no more event to set. In hardware it's true, but the next event value on broadcast device is expired, which will be used in idle broadcast enter. It may cause no more timer set in system in below case. nte_l: next_timer_event on local timer nte_b: next_timer_event on broadcast timer time: in ms, assume HZ = 128 core0 core1 broadcast timer 990: nte_l = 1004 nte_l = 1004 nte_b = 1000 enter idle enter idle nte_b = 1000 ----------------------------------------------------------- 996: non-timer interrupt wake up both core0 & core1 ----------------------------------------------------------- 996: core0/1 exit idle, clear broadcast oneshot mask, set local timer next event(nte_l = 996 + 8 = 1004) 1000:broadcast interrupt comes, one shot mask is 0. do not program broadcast next time event.(nte_b = 1000) 1002:core0/1 enter idle, shut down local timer. since nte_l is larger than nte_b, do not program broadcast timer. 1004:no more timer interrupt, not report rcu quiescent state completion. no new timer is set in tick_nohz_idle_enter when core0/1 enter/exit idle. at last system will crash. tick_program_event(dev->next_event, 1) is not guaranteed to generate local timer interrupt when exiting idle. When local timer is shutdown, we need to compare local next event to updated broadcast next event. So when there is no broadcast next event to set on hardware, we need to set software next_event to KTIME_MAX. Signed-off-by: Qiao Zhou --- kernel/time/tick-broadcast.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index b398c2e..7648326 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -661,6 +661,14 @@ static void tick_handle_oneshot_broadcast(struct clock_event_device *dev) */ if (next_event != KTIME_MAX) tick_broadcast_set_event(dev, next_cpu, next_event); + else + /* + * not program broadcast timer, but set the value to show that + * the next event is not set, which is used in + * __tick_broadcast_oneshot_control in idle tick_broadcast + * enter/exit control flow. + */ + dev->next_event.tv64 = KTIME_MAX; raw_spin_unlock(&tick_broadcast_lock); -- 2.7.4