From owner-freebsd-dtrace@FreeBSD.ORG Tue Oct 21 05:24:03 2014 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4D0515A7 for ; Tue, 21 Oct 2014 05:24:03 +0000 (UTC) Received: from mail-pa0-x231.google.com (mail-pa0-x231.google.com [IPv6:2607:f8b0:400e:c03::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 223F7123 for ; Tue, 21 Oct 2014 05:24:03 +0000 (UTC) Received: by mail-pa0-f49.google.com with SMTP id hz1so601404pad.8 for ; Mon, 20 Oct 2014 22:24:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=h7UBiPUCiVvjo0Ug55wENhyFB4Q5vE9wP7neZPGx5Fs=; b=KUV0ayzvF5GwQFdWFKBmaOUgtebgKqLuUWe4PY+OlQ5vd8yJzYlEFw820gptUPqLcs FD8b1nEx/J+3rnqhJSsSKQjGsEGXosdh2yvzwPpFc+BDqvjQT7+hgA3zYw3Dbw5El0zt m87o93jZkagvsPy4oC/YzgBLxuW7iUZ1dK338gsQRHlmnbm6DYDaPvqmuzX7voIvm8Sl LuKUKl3kjMDMnTV+ymQAYjVmSuzKEEEKHo8Z3M7SJY4M88nIAXviPoud3qflX2pZG1q8 iDmudFEjg2xyn1V0H0DNUTgYfZoM4wWkAUemM61XBjG2Qg38n4z6mCeXjYaZmI5fx8PB hBDw== X-Received: by 10.68.211.6 with SMTP id my6mr8814228pbc.125.1413869042704; Mon, 20 Oct 2014 22:24:02 -0700 (PDT) Received: from charmander.picturesperfect.net (c-67-182-131-225.hsd1.wa.comcast.net. [67.182.131.225]) by mx.google.com with ESMTPSA id oq10sm1457653pac.47.2014.10.20.22.24.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Oct 2014 22:24:01 -0700 (PDT) Sender: Mark Johnston Date: Mon, 20 Oct 2014 22:23:56 -0700 From: Mark Johnston To: grenville armitage Subject: Re: dtrace tcps_rto bug? Message-ID: <20141021052356.GA38615@charmander.picturesperfect.net> References: <5445DA64.4060506@swin.edu.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5445DA64.4060506@swin.edu.au> User-Agent: Mutt/1.5.23 (2014-03-12) Cc: freebsd-dtrace@freebsd.org X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2014 05:24:03 -0000 On Tue, Oct 21, 2014 at 03:00:36PM +1100, grenville armitage wrote: > > I'm curious about dtrace's args[3]->tcps_rto calculation. > > Right now /usr/src/cddl/lib/libdtrace/tcp.d defines tcps_rto as: > > typedef struct tcpsinfo { > [..] > uint32_t tcps_rto; /* round-trip timeout, msec */ > [..] > } tcpsinfo_t; > > And then later derives tcps_rto from p->t_rxtcur like so: > > tcps_rto = p == NULL ? -1 : p->t_rxtcur / 1000; /* XXX */ > > I doubt this is right. > > t_rxtcur is the kernel's notion of RTO in ticks (as per netinet/tcp_var.h), so for a kernel where HZ=1000 the preceding calculation would result tcps_rto being the RTO in seconds (not milliseconds, as stated in the struct tcpsinfo definition). And for kernels where HZ != 1000, all bets are off. Right. I'm not sure what I was thinking when I wrote that line. :( > > Inside a dtrace .d file we can use "`hz" to represent the running kernel's current tick rate (kern.hz), so I believe the correct expression for tcps_rto would be: > > tcps_rto = p == NULL ? -1 : (p->t_rxtcur * 1000) / `hz; > > (I've run a few simple tests, and this change seems to produce plausible RTO values in milliseconds when args[3]->tcps_rto is read from inside a tcp:::send probe.) I've committed the change as r273370. Thanks! -Mark