Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3659342imm; Mon, 2 Jul 2018 03:17:28 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeYX0JlapxBatsZl5vPPIM9yHzxWBUT5K+LaufBpMAA2NUvzi9ceivGzhZpvkoFdyjf1Okf X-Received: by 2002:a62:4695:: with SMTP id o21-v6mr18967980pfi.176.1530526648724; Mon, 02 Jul 2018 03:17:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530526648; cv=none; d=google.com; s=arc-20160816; b=SnAR4H2VYvUQciZy6KXMYN1qnAsmPNIK3SKOn33kuvTkGV4azaiw6qkLpoeOA8wKNq uABYRMPUKMsAUdM4PsDH2HUMvprojqzkYGXOo2HufzN7V7toP8kC6OgLU1xg50aWNtq3 +h/F93qWjwkvUXp3pH6jSj7LSAyE2l6nfMMjjNb6CMf5nay68Qgf6Wt1AsFv1Fdd7o+c hTMY+Lr+AURaFkW3J1cdEROKngUJABJ6TebrGznuSy0/ebBnse+cWYV7BdappuYltNZk R9eL/NaY7h2o5fHkmPVFEEm0TovgeNWXXIxP5ua7pL1ffNnO4ezQeREaLy0avVW1myPc 6shg== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=1CEod+XMFMmLpMKFW4MZqhXwSnPDE558uUTzXTvN63k=; b=IjVfv1iLNj/HIbPErIjrKD2l0ZopCfTKVpkUWCceixrAUF7Mj21fuHzjPVqoCggFe0 3mfPI0dgXcGBU6PKnG9/krAyjuAMk2aFmQ/AYOzPbEfsXWrX2l/h0YNOjunD2mrUiJNg qNYwUY3agrRA3RD0hN15cublrHVJ4dhX/HS/GWArT91yDkPfbzc1oO7/BtBHxDrRMThs Up/cCJyXS1giODcsqjEMHRCGcXDNOKkYWwPxkcR0ejmoNcT0bK7wnN42IcMp9aVTlMCk cEl6OFXvTzoeAlEc9xVL84upIVIFjjFjTeK3hGVsHvgti1HfiarJhNtBsXRVz5OTvHcX 32+g== 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 f185-v6si5580094pgc.625.2018.07.02.03.17.14; Mon, 02 Jul 2018 03:17:28 -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 S965300AbeGBKO1 (ORCPT + 99 others); Mon, 2 Jul 2018 06:14:27 -0400 Received: from Chamillionaire.breakpoint.cc ([146.0.238.67]:59538 "EHLO Chamillionaire.breakpoint.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965036AbeGBKOY (ORCPT ); Mon, 2 Jul 2018 06:14:24 -0400 Received: from bigeasy by Chamillionaire.breakpoint.cc with local (Exim 4.89) (envelope-from ) id 1fZvqf-0003T1-IW; Mon, 02 Jul 2018 12:14:21 +0200 Date: Mon, 2 Jul 2018 12:14:21 +0200 From: Sebastian Andrzej Siewior To: gengdongjiu Cc: 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: <20180702101420.rskzwqrdyws5fl6m@breakpoint.cc> References: <12e6da4e-7681-771f-38d3-3c1abf943c24@huawei.com> <43d78927-3955-acde-a2d1-d2b82932a7a6@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <43d78927-3955-acde-a2d1-d2b82932a7a6@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 17:34:34 [+0800], gengdongjiu wrote: > The Linux kernel version is v4.1.46, and the preempt_rt patch is > patch-4.1.46-rt52.patch. 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. > 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. > I think this is why hrtimer is run as a thread, I tried to set > hrtimer.irqsafe to 1, but the timer still seemed not right. Could anyone > give some advise? Thanks. By setting irqsafe to 1 you ensure taht the timer will fire from the timer interrupt and before doing so you should ensure that the timer is indeed IRQ safe. Depending on what you do it is possible that the timer fires early but the application notices it later (the scheduler will first handle RT tasks according to their priorities followed by non RT tasks). Sebastian