From patchwork Thu Oct 22 09:28:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ding Tianhong X-Patchwork-Id: 7464101 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8EDC6BEEA4 for ; Thu, 22 Oct 2015 09:43:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B09AA2085C for ; Thu, 22 Oct 2015 09:43:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D27FB20894 for ; Thu, 22 Oct 2015 09:43:17 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZpCK7-0003mI-J0; Thu, 22 Oct 2015 09:38:15 +0000 Received: from szxga01-in.huawei.com ([58.251.152.64]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZpCK2-0003bL-BM for linux-arm-kernel@lists.infradead.org; Thu, 22 Oct 2015 09:38:12 +0000 Received: from 172.24.1.50 (EHLO szxeml426-hub.china.huawei.com) ([172.24.1.50]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id CXL04586; Thu, 22 Oct 2015 17:29:08 +0800 (CST) Received: from [127.0.0.1] (10.177.22.246) by szxeml426-hub.china.huawei.com (10.82.67.181) with Microsoft SMTP Server id 14.3.235.1; Thu, 22 Oct 2015 17:29:00 +0800 Message-ID: <5628AC58.2030509@huawei.com> Date: Thu, 22 Oct 2015 17:28:56 +0800 From: Ding Tianhong User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Thomas Gleixner , Yang Yingliang Subject: Re: Problem about CPU stalling in hrtimer_intterrupts() References: <56288585.40204@huawei.com> In-Reply-To: X-Originating-IP: [10.177.22.246] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151022_023811_820704_73BE9ECB X-CRM114-Status: GOOD ( 14.96 ) X-Spam-Score: -4.2 (----) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Hanjun Guo Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On 2015/10/22 15:43, Thomas Gleixner wrote: > On Thu, 22 Oct 2015, Yang Yingliang wrote: >> I use the kernel-4.1.6 running on arm64. >> My testcase is that it calls clock_settime and clock_adjtime alternately with >> random params on each core. My system has 32 cores. >> >> I found the cpu stalling in hrtimer_intterrupts(). So I added some debug info >> in hrtimer_intterrupts() and found that the while loop runs 1020437660 times >> and takes 98761 jiffies(HZ=250). >> >> Some debug log is here: >> ---start--- >> Jan 01 00:03:32 Linux kernel: i:0 basenow.tv64:4809284991830 >> hrtimer_get_softexpires_tv64(timer):4440120000000 ccpu0 >> timer:ffffffdffdec6138, timer->function:ffffffc000129b84 >> Jan 01 00:03:32 Linux kernel: i:0 basenow.tv64:4809284991830 >> hrtimer_get_softexpires_tv64(timer):4440120000000 ccpu0 > > Something is rearming a timer over and over with expiry time in the > past. > > Thanks, > > tglx > Hi Thomas: This problem could only occur on the system with 32 cores, when I cut the cores to 16, this problem disappeared, so I think there is some parallel problem when the 32 core set clock time together: I try to reproduce the scene: 1.do_settimeofday64 2.update tk time 3.update base time offset 4.update expires_next the 3 and 4 will be called in softirq, but the hrtimer_interrupt may break the order and run before 3, I am not sure whether this could make the problem, do we need to update base time and expires_next in the hrtimer_interrupt? maybe I miss something, thanks for any suggestion. Thanks Ding > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel > > diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 93ef7190..9adab23 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -1254,6 +1254,7 @@ void hrtimer_interrupt(struct clock_event_device *dev) raw_spin_lock(&cpu_base->lock); entry_time = now = hrtimer_update_base(cpu_base); + hrtimer_force_reprogram(cpu_base, 0); retry: cpu_base->in_hrtirq = 1;