Received: by 10.223.164.202 with SMTP id h10csp248112wrb; Mon, 6 Nov 2017 06:03:29 -0800 (PST) X-Google-Smtp-Source: ABhQp+SYqTx33y1msKN51ya457s67HwsakG+WEJ2QwNUHdus7ODIkVB+rSCSKZT7RoOWNkF85NO7 X-Received: by 10.101.91.142 with SMTP id i14mr15621001pgr.313.1509977009823; Mon, 06 Nov 2017 06:03:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1509977009; cv=none; d=google.com; s=arc-20160816; b=WeaEzWMHoyAVBhw0ARpYiFJMNpSgPKeJLIB10IWSYyiPBVIn4nWloiyBh7x78a4jlS 4jyi2xowaQMeQkI+z/+hjezBnLX7PVGRfVVLb+d5ad+1fsF56fmRjuonB/A4ZkFu87vG Q+kYYVGs3AZEZOEwdFta6BUVBTHvETgBJWQuwaH6kDmYTgxrcq50T6t+pMTbF8h1i8TM 3YS8z7zOGfJ3dpYO4ErfuqpZSQQhKiOARRkkNU2VwWdhW4518xjrpLbD6Cff50d6MUId OXDj5JzkOd9IKy5KZOs4pbsW2TkAEXtJqKsgJRyb3VAR/N/7p2+cS9OQzvtJpRlTAaPt +yTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dmarc-filter:arc-authentication-results; bh=9eQjYcEUI+azWL5pbkkImsyGJ1+gkvEx5Sz34CfP7Pk=; b=GCQHHSd025tlOxOmSgDPm8/YCvsE6WqzOBr9O7rCC2hEPpM3HNzV/JgQVpC56bwZTb 15yKpuWCF009MSk2xxRY2J9VJQH9dr8YYbpvnj1B/rOfq4901CaoQLNchqot+w9ttXpE C9lfokJnHWATIV3lvjcjxCzezcXOCTMq5jo9zKgQrxrPSVSefYUYUZ/ZFkb32D2fpnWs /rfaWez+gCW+AxfeuOiWFeS7Y28gZQo1Jc0Jjxg1oNI+DjvJs5sGz6Ysytfl3K1qgh7H kyVlxtqg4z/fAToXXO9kLZkXgXMhJ8pESHK7HP+bnF/19yRFBxEqNfnza1DWjr/lZU69 qdTQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d92si10021847pld.189.2017.11.06.06.02.33; Mon, 06 Nov 2017 06:03: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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932151AbdKFOBp (ORCPT + 98 others); Mon, 6 Nov 2017 09:01:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58740 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752859AbdKFOBo (ORCPT ); Mon, 6 Nov 2017 09:01:44 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EDBB261D1A; Mon, 6 Nov 2017 14:01:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EDBB261D1A Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=lcapitulino@redhat.com Received: from localhost (ovpn-116-61.phx2.redhat.com [10.3.116.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id D5FE260C8D; Mon, 6 Nov 2017 14:01:35 +0000 (UTC) Date: Mon, 6 Nov 2017 09:00:54 -0500 From: Luiz Capitulino To: Nicolai Stange Cc: fweisbec@gmail.com, tglx@linutronix.de, mtosatti@redhat.com, williams@redhat.com, linux-kernel@vger.kernel.org, John Stultz Subject: Re: [nohz_full/apic] multiple timer interrupts a second Message-ID: <20171106090054.1134f4f9@redhat.com> In-Reply-To: <878tfm76cz.fsf@gmail.com> References: <20171103170703.46d72a31@redhat.com> <878tfm76cz.fsf@gmail.com> Organization: Red Hat MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 06 Nov 2017 14:01:44 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 04 Nov 2017 10:14:52 +0100 Nicolai Stange wrote: > Hi Luiz, > > [John Stultz added to CC] > > On Fri, Nov 03 2017, Luiz Capitulino wrote: > > > [CC'ing lkml this time] > > > > I've observed that smp_apic_timer_interrupt() is sometimes called > > two or more times a second on a nohz_full core which has a single > > task taking 100% of the core. In one of the calls, hrtimer_interrupt() > > runs tick_sched_timer(), but in others it doesn't call any handler. > > Here's an example (Linus HEAD f34157878): > > > > <...>-1831 [008] 1060.115578: funcgraph_entry: | smp_apic_timer_interrupt() { > > <...>-1831 [008] 1060.115578: funcgraph_entry: | hrtimer_interrupt() { > > <...>-1831 [008] 1060.115578: hrtimer_expire_entry: hrtimer=0xffff8edfefd12d60 function=tick_sched_timer now=1060079001980 > > <...>-1831 [008] 1060.115578: funcgraph_entry: 1.172 us | tick_sched_timer(); > > <...>-1831 [008] 1060.115580: funcgraph_exit: 1.757 us | } > > <...>-1831 [008] 1060.115580: hrtimer_start: hrtimer=0xffff8edfefd12d60 function=tick_sched_timer expires=1061079000000 softexpires=1061079000000 > > <...>-1831 [008] 1060.115581: funcgraph_exit: 3.026 us | } > > <...>-1831 [008] 1061.115577: funcgraph_entry: | smp_apic_timer_interrupt() { > > <...>-1831 [008] 1061.115577: funcgraph_entry: 0.261 us | hrtimer_interrupt(); <---------- NO handler called > > <...>-1831 [008] 1061.115578: funcgraph_exit: 1.349 us | } > > <...>-1831 [008] 1061.115579: funcgraph_entry: | smp_apic_timer_interrupt() { > > <...>-1831 [008] 1061.115579: funcgraph_entry: | hrtimer_interrupt() { > > <...>-1831 [008] 1061.115579: hrtimer_expire_entry: hrtimer=0xffff8edfefd12d60 function=tick_sched_timer now=1061079001473 > > <...>-1831 [008] 1061.115580: funcgraph_entry: 1.413 us | tick_sched_timer(); > > <...>-1831 [008] 1061.115581: funcgraph_exit: 2.124 us | } > > <...>-1831 [008] 1061.115582: hrtimer_start: hrtimer=0xffff8edfefd12d60 function=tick_sched_timer expires=1062079000000 softexpires=1062079000000 > > <...>-1831 [008] 1061.115582: funcgraph_exit: 3.255 us | } > > > > Is this expected for some reason? > > > > I guess what's happening is that the deadline timer is firing > > earlier than expected. From a few dozen to a few hundreds > > nanoseconds earlier. When this happens, hrtimer_interrupt() > > skips calling the hrtimer handler (since it's early) and the > > apic is programmed to fire in the next microsecond. > > Exactly. > > > > On further research I saw that Nicolai tried to fix a very similar > > problem last year: > > > > commit 1a9e4c564ab174e53ed86def922804a5ddc63e7d > > Author: Nicolai Stange > > Date: Thu Jul 14 17:22:54 2016 +0200 > > > > x86/timers/apic: Fix imprecise timer interrupts by eliminating TSC clockevents frequency roundoff error > > > > I noticed the following bug/misbehavior on certain Intel systems: with a > > single task running on a NOHZ CPU on an Intel Haswell, I recognized > > that I did not only get the one expected local_timer APIC interrupt, but > > two per second at minimum. (!) > > Note that there's also 6731b0d611a1 ("x86/timers/apic: Inform TSC > deadline clockevent device about recalibration"). > > > > Maybe this issue is still present? > > Yes it is. The reason is that NTP frequency adjustments would make it > into the mono clocksource's frequency but not into the > clock_event_device's. > > I sent a series back then [1] addressing this. > > However, in the meanwhile, I changed jobs and thus, got somehow > distracted. My bad :/ > > The result is that this got merged only up to what corresponds to > [10/28] in [1]. > > I'll pick this up again now and try to get the rest accepted for > inclusion. OK. If you get a new version, please include me in the CC so that I can give it a try. > > > Thanks, > > Nicolai > > > [1] last time I sent this series as a whole can be found at > http://lkml.kernel.org/r/20161119160055.12491-2-nicstange@gmail.com > From 1583126360064681502@xxx Sat Nov 04 09:15:49 +0000 2017 X-GM-THRID: 1583080882010256173 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread