Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp350238imm; Mon, 2 Jul 2018 12:41:19 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJiRweFBPZUmX4H+KBCwy18hWJ4Kmk/RwutHMmaYONdoyouH+Rwi6Y/X4uwK8GwJp8+W0BK X-Received: by 2002:a63:a543:: with SMTP id r3-v6mr22918351pgu.336.1530560479274; Mon, 02 Jul 2018 12:41:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530560479; cv=none; d=google.com; s=arc-20160816; b=WhZ4XyYJcl1Y1s8SEivLkVikVyuMnqANvaGJgncKRSQQyvaGtXd7eUmsaSO4DhTUK2 w8GuGKwTMCdG5aEwi45XwvnbNKKRn+6ScVFx+t82KmV1g4yxWVPBEvcEZ0BhhFdl9GTH Qr3HlWjgJCjCldXmvCSzSt8nK/IGSAl2wILHiMHho7J0J5WlqQV6TFNDMzWDObpCpa5y itJvPfWS8ygyTWz+3WedurM3wfmQcwuJ97n2iz9qeue6qNH4sFxPa7PoRusDIxFjHVaQ FBe2wEkfyrLLEgl3w6ErkfaPG4Q+wGOv+tzsmQxJgTUamSoHOip07wlrGCI9al+jrAkT b2Qw== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=LJIDCYY9KxvKfEFwvQEIMYC3fxlzYsFfoKTyUTCAbVQ=; b=0T0JUDxquUzmVoZmfBjspdup6x7XTN14/kucCq4ryhof10/M94w0dp9BI9lYr36buZ FJ0Vpbhx2KE3OokbgPPAmdRWS8O3nax+3d7F3cqj1lHbQjFYTpOHsEz3/qSJ8BvVMIAG vHT223+sSg9XEcpvWCmhk23OZRpCrEZY4jAme9NHY+GXUV4RlLsYx6erK+AyD3riBrt6 D7sMg6MXg42/ll3S1d0VZ1s2sss0xJHY8ybsbt2xqAGzNahmaYO6Mnh0oEPIlh85Jtku prLFUrX1sgKdWulE1Akwxw3rI0o8gElzLXeer1EuBKPXodrtD3uWB7c6Pwgv2HrUaM4o qzog== 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 d10-v6si4147839pfg.258.2018.07.02.12.41.04; Mon, 02 Jul 2018 12:41:19 -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; 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 S1753105AbeGBTiv convert rfc822-to-8bit (ORCPT + 99 others); Mon, 2 Jul 2018 15:38:51 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:40624 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752533AbeGBTiu (ORCPT ); Mon, 2 Jul 2018 15:38:50 -0400 Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1fa4es-0001lb-BC; Mon, 02 Jul 2018 21:38:46 +0200 Date: Mon, 2 Jul 2018 21:38:46 +0200 From: Sebastian Andrzej Siewior To: gengdongjiu Cc: "Ouyangzhaowei (Charles)" , Thomas Gleixner , linux-rt-users@vger.kernel.org, linux-kernel@vger.kernel.org, anna-maria@linutronix.de, john.stultz@linaro.org, Hangaohuai , "zhangjianwei (D)" , yangchuanlong@huawei.com, "Zhangbin (EulerOS)" , liupeifeng3@huawei.com Subject: Re: hrtimer become inaccurate with RT patch Message-ID: <20180702193845.6n3jrei35zdtfb7z@linutronix.de> References: <12e6da4e-7681-771f-38d3-3c1abf943c24@huawei.com> <43d78927-3955-acde-a2d1-d2b82932a7a6@huawei.com> <20180702101420.rskzwqrdyws5fl6m@breakpoint.cc> <75928d33-ade0-3bc7-33df-43abf5442c32@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: <75928d33-ade0-3bc7-33df-43abf5442c32@huawei.com> User-Agent: NeoMutt/20180512 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-07-02 19:19:07 [+0800], gengdongjiu wrote: > Hi Sebastian , Hi gengdongjiu, > > the 4.1 series is no longer supported (neither RT wise nor non-RT, > > https://www.kernel.org/category/releases.html). I suggest to move away. > > If you notice this problem now it is hardly a long running project. > yes, I Know, but we found the latest RT 4.14 series also has the same problem, > so this is common issue. This does not change what I wrote regarding the v4.1 series. Also you could have mention v4.14 instead v4.1 if you really tested on v4.14. > >> process will not be interrupt. But if the hrtimer is also runs in > >> process context the timer is useless when it's inaccurate. so I want to > >> consult you whether this is expected behavior? whether is reasonable to move the timer IRQ > >> handling to a thread? > > > > This depends on your expectations. The timer is defined not to fire > > before the programmed time. So it fires as soon as possible _after_ the > > programmed time. > It is reasonable that the timer is defined not to fire before the programmed time. > but we found it fires long _after_ the programmed time. For example, we define it to > fire after 2s, but it will fire after 5s, so it is very later than the expectations. under normal circumstances I would expect to have a few µs delay due to wakeup of the softirq thread. Not seconds. This is either broken HW or a long running RT thread which blocks the expected execution. > I think the reason may be > that the timer handler thread is preempted by another higher priority thread. so from for this issue, > the timer handler should be in IRQ context instead of the process context or increase the timer handler thread priority, right? speculating on what is going on and acting based on speculation is one way to handle situation. You could also enable tracing to see - when does the timer fire - when does the thread wake up - when does is timer's function start / complete and then you know what *really* causes the delay. The hrtimer and sched tracepoints should provide enough information. Based on that you can figure out if it is wise the toggle the irqsave flag or change something else so that the system does not run ~3sec RT secs without a break. Sebastian