Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4178475img; Tue, 26 Mar 2019 04:43:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqwqD+botHIIoqh9W6nB6UNkHDVBKrXItHOrI+Til/iH9jFsjThkMKwZvM/kA1sEEXwwEqen X-Received: by 2002:a63:d709:: with SMTP id d9mr11977550pgg.38.1553600588796; Tue, 26 Mar 2019 04:43:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553600588; cv=none; d=google.com; s=arc-20160816; b=U0o73p/yLm+pt+Mf/X5KFfq3Tl0pD028NsiyZTo85SDEiuoppJMk4BLE+Wxwr4R+8B 1OFOg0JbalYUOq0sBGRdXpzYio5ZoqPTGKsfyT3rOgMSHpZ6Fukk/8AGMeGAYS9AmJGA ow/gWmLS5uSV11HwSTYnX5AD5wvxnl+K4oMSchIfSz7bHX96Ue8LKharNNSR4gQqSf5O a9kpux5U5DwbcRZ8D9A3j6EBT/CCKAJmoB0k/ZjHMc9hBmNWDQQdpk6IZOof9YMzx4lF Cc90rsSwmxTewIw6HSKpOm/nRqr+jTb45emHI7r6xBXIkiErOJfQ2feqDNdnAFZLz4kS f7RA== 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:dkim-signature; bh=iThlV3KvC24rOqF3NoyW4PXimOst8xmclrHdJH58cio=; b=Vd2yp2Y6R61czNJXqTqeWkEisbVbD5hkaiYSxYaqh/Kb7Ty/7BO+a2y8KZWYyMJPy4 GRPlCsyiL5s2oCvXjTLlZQAdF96N3H/uaNe4tZu0Ys4+9olFN9vE44ha1q1ic+2chMIL 9bI4fzxY3/hILyQ2pGOzw60MpK8bQQuuTp2/9GHjtoUc1VB+GdvfgfT7tlBmPmwcqjki 2AHQFHPaCwTUGtuUZrq9NXJ8o/SjpkSTfVcmgh8FsOQUtXP9Yi3GzwemmIVhhcvdKA3T HC7LFTd3LFSnEhD5K3E9L4yFasqyjR2r7MN2iSevB1BFJ/Hbdr4bC68ssETRDdMwrzak sRJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=p6Mi4+zG; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v21si15601148pff.44.2019.03.26.04.42.53; Tue, 26 Mar 2019 04:43:08 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=p6Mi4+zG; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731435AbfCZLlv (ORCPT + 99 others); Tue, 26 Mar 2019 07:41:51 -0400 Received: from mail-yw1-f67.google.com ([209.85.161.67]:33247 "EHLO mail-yw1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726248AbfCZLlv (ORCPT ); Tue, 26 Mar 2019 07:41:51 -0400 Received: by mail-yw1-f67.google.com with SMTP id l5so9374049ywa.0 for ; Tue, 26 Mar 2019 04:41:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=iThlV3KvC24rOqF3NoyW4PXimOst8xmclrHdJH58cio=; b=p6Mi4+zGWOZaaGmadWmMlGfhdPbUN8FuxsN7Zkk7HMwZoRDVXN9L1EIYXxdQ/2HF+1 04MqE2KDBfkx9hjGcSbqULrveNMM9O9P/mQQvFJ3f7XZbUOXc75RwsxvZA2a4n4jsWNu YvnlZlZFzkdFN9TeKerm/TQyhZOZk+GccWHM1ce+MyAvJnCpmP2M90Qx27EEfQKejZ9j A2PZBKHBW8niKuMvHaR+dCJOi/1n6syVxjaI+SGoxf340B2pQlfzkUPmqpAaoNCNAlWA gR0oLmZgjV5cNf4GmhCGp53lylVKMeSXF0YUrDtlQw6h5gwF/eF2gqE65XyeatHR03gE Oq9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=iThlV3KvC24rOqF3NoyW4PXimOst8xmclrHdJH58cio=; b=A366eILSeSC/y9wbV4kpduLNo6hKLA4KmYalHXG/OkbiJ5OAjkdbW6rQ2bOuI7BqE9 tq3oMBDy72pQjBA7v7bEnwuRqTEAMiW9odTZWc4wTGlgEMkZ67swib/sOdlyrwY65Db2 Enq1/lplThBhQ6UiSaW+I95FIQXXz/BGYOhF60n4owqqFsQoVoLpuTuMub+OGTiuBEG2 SkLd7CtrhCvUUlWrB98fVb4CA4YYLhH4NSSTZcAAcMM72LlKqem4jEqbcaWI5aHbYz59 S1gJYnf6hgasnmYebLcfcCydErbbboz/SlT5JmhiurddSt/NT8yVg4gtAumCwneIAbl0 hR3w== X-Gm-Message-State: APjAAAVtSyqaKFpyzugeBNI0ejYtN5MKTCvDzyHUIqSES1u6yqRPMD6O OrAvSFVSmtNf0a6yygBs3Uo= X-Received: by 2002:a81:5b04:: with SMTP id p4mr26132713ywb.115.1553600510493; Tue, 26 Mar 2019 04:41:50 -0700 (PDT) Received: from centos-dev.localdomain (pool-173-66-89-81.washdc.fios.verizon.net. [173.66.89.81]) by smtp.gmail.com with ESMTPSA id 205sm4233898yww.27.2019.03.26.04.41.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Mar 2019 04:41:49 -0700 (PDT) Date: Tue, 26 Mar 2019 07:41:32 -0400 From: Ryan Thibodeaux To: luca abeni Cc: Dario Faggioli , Boris Ostrovsky , xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, oleksandr_andrushchenko@epam.com, tglx@linutronix.de, jgross@suse.com, ryan.thibodeaux@starlab.io Subject: Re: [PATCH] x86/xen: Add "xen_timer_slop" command line option Message-ID: <20190326114132.GA85724@centos-dev.localdomain> References: <1553279397-130201-1-git-send-email-ryan.thibodeaux@starlab.io> <52bfeae7c256faec444b69efe58d363ad60c3fc5.camel@suse.com> <20190323114151.5cebf31b@sweethome> <20190325130530.56603806@luca64> <69e40698-f7ae-11c3-e4b7-dda4f1fadcf6@oracle.com> <20190326121256.76ceed71@luca64> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190326121256.76ceed71@luca64> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 26, 2019 at 12:12:56PM +0100, luca abeni wrote: > Hi all, > > On Tue, 26 Mar 2019 10:13:32 +0100 > Dario Faggioli wrote: > > > On Mon, 2019-03-25 at 09:43 -0400, Boris Ostrovsky wrote: > > > On 3/25/19 8:05 AM, luca abeni wrote: > > > > > > > > The picture shows the latencies measured with an unpatched guest > > > > kernel > > > > and with a guest kernel having TIMER_SLOP set to 1000 (arbitrary > > > > small > > > > value :). > > > > All the experiments have been performed booting the hypervisor > > > > with a > > > > small timer_slop (the hypervisor's one) value. So, they show that > > > > decreasing the hypervisor's timer_slop is not enough to measure > > > > low latencies with cyclictest. > > > > > > I have a couple of questions: > > > * Does it make sense to make this a tunable for other clockevent > > > devices > > > as well? > > > > > So, AFAIUI, the thing is as follows. In clockevents_program_event(), > > we keep the delta between now and the next timer event within > > dev->max_delta_ns and dev->min_delta_ns: > > > > delta = min(delta, (int64_t) dev->max_delta_ns); > > delta = max(delta, (int64_t) dev->min_delta_ns); > > > > For Xen (well, for the Xen clock) we have: > > > > .max_delta_ns = 0xffffffff, > > .min_delta_ns = TIMER_SLOP, > > > > which means a guest can't ask for a timer to fire earlier than 100us > [...] > > I know this is not fully related with the current discussion, but in > these days I had a look at the code again, and... > The comment for TIMER_SLOP in arch/x86/xen/time.c says: > /* Xen may fire a timer up to this many ns early */ > > Isn't the comment wrong? shouldn't it be "...many ns late" instead of > "early"? I would say is something else entirely. If you look at "clockevents_program_event()" in kernel/time/clockevents.c, you see that the min_delta_ns value sets the limit or granulariy for the clock's sleep time. Basically, it is the minimum amount of sleep one can set for the next event for the clock in question. - Ryan