From owner-freebsd-dtrace@freebsd.org Sat May 20 11:35:35 2017 Return-Path: Delivered-To: freebsd-dtrace@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8E3FD7616E for ; Sat, 20 May 2017 11:35:35 +0000 (UTC) (envelope-from domagoj.stolfa@gmail.com) Received: from mail-wm0-x22e.google.com (mail-wm0-x22e.google.com [IPv6:2a00:1450:400c:c09::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7C4B01A7D for ; Sat, 20 May 2017 11:35:35 +0000 (UTC) (envelope-from domagoj.stolfa@gmail.com) Received: by mail-wm0-x22e.google.com with SMTP id p134so6199914wmg.1 for ; Sat, 20 May 2017 04:35:35 -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=GGcSmUWRXb0LEh2dBCxOGGKKZhbG+5G+aiX4hE/b+Us=; b=rx+yJOUL5H5Ivqz5ki4AiktaPxo1gTvUrarSEdEZd/4vdYXyhByl+j+dmuVPKzmKy0 zWCXUCERbXVu4ujWLe48sPVqwsSfMxbFS6Kv1NjcS9EyBWCO5n1Pe1M70brN1hhXLX7x 8Bw/DBejHm1OFDWUutoD2MNkRvA9sDvMXaqyQwwV24kvpR170kyRHGYUBqPOS3EXzjyR Z/dOTyix1UPFuahFeuDgTvcmeLsfikJSNn/E63AOpOCF6ZnYE3LU2pA1TSavbUj6zrGD bZ7PBccoJA2bTfZ/qS1GAF7f9EbPMdDQmKFwTeoDJhgjaVYY9CRNNWc98QrmgRGuuRzZ 82KA== 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=GGcSmUWRXb0LEh2dBCxOGGKKZhbG+5G+aiX4hE/b+Us=; b=YEHYLVxF+ao1ParKoWTGrwVltZLZcdy+2e6nmFEVuVhyzrD+FVVWKZFzsHS7C4PF8S T+uixpS2NUBFzik0tnYJroo7cho6CEosV6uxjxNwIG7wJ0x9ZkUYB371+8eNzw1Xi2go +dfukulYt0Nh49wy9AAFK/DlsAzm12DBDHwB4JhwGyCDid4lQzJMurZhEevVD62oig2p TVZIWE6sY0njE6xci/7nvV40+nAESGC36dVbu7tVVMR/O4kbgj46ctJySEnp6kxzqW/V eCY1iR/Nl4p7WYII6jDkV07y3kReBfWCwDMFzAxESd6Nd3WGeHTvCYONDayrOx9gTuxJ XAjg== X-Gm-Message-State: AODbwcAj+2jSv4XzfRRFza2nZ6O2Z37sxVmlTr0MpTvLPUhP9zFAhhRW EVQBRKpheoxqvcpu9ac= X-Received: by 10.28.4.203 with SMTP id 194mr8898769wme.118.1495280133828; Sat, 20 May 2017 04:35:33 -0700 (PDT) Received: from wraith (157-197.dsl.iskon.hr. [89.164.157.197]) by smtp.gmail.com with ESMTPSA id m14sm32445152wmi.2.2017.05.20.04.35.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 20 May 2017 04:35:33 -0700 (PDT) Date: Sat, 20 May 2017 13:35:29 +0200 From: Domagoj Stolfa To: Beeblebrox Cc: freebsd-dtrace@freebsd.org Subject: Re: dtrace noob: How is it used? Message-ID: <20170520113529.GA49886@wraith> References: <20170520121029.708bc827@rsbsd> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="LZvS9be/3tNcYl/X" Content-Disposition: inline In-Reply-To: <20170520121029.708bc827@rsbsd> User-Agent: Mutt/1.8.2 (2017-04-18) X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.23 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: Sat, 20 May 2017 11:35:36 -0000 --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello, > Trying to use dtrace on my drm-next kernel that leaks memory to the > extent that all swap space gets filled. > easy enogh: kldload dtraceall >=20 > But which parameters and exactly how am I supposed to capture > afterwards? I assume most useful info would be a) memory leaks per > minute and b) source of leak. Wiki page was not much help for > understanding usage: https://wiki.freebsd.org/DTrace/One-Liners =46rom my understanding, I don't think there are scripts that can explicltl= y tell you that there have been memory leaks somewhere, but FreeBSD, upon unloadin= g a module will tell you that a given module has leaked X bytes of memory. Howe= ver, DTrace on FreeBSD has a dtmalloc provider, which lets you inspect quite a b= it of things based on named memory in the kernel. You could try using that in ord= er to detect which memory hasn't been freed based on the expected code flow in the kernel. To do this, you would have to look at the kernel code of interest, use the = fbt provider in order to instrument the problems you want, and based on that in= spect whether or not a given dtmalloc probe has fired with a given memory region = (if you have access to it). Aside from that, I'm not aware of any other way to go about it. > * /usr/share/dtrace has scirpts, are those sufficient for the problem > or should I add sysutils/DTraceToolkit? > * Which script(s) would provide adequate info for this problem and how > could I log a per minute (or perhaps per event) output from the probes? The DTrace Toolkit is largely written with Solaris (now illumos) in mind, so there is a chance that some scripts in there might not work. --=20 Best regards, Domagoj Stolfa --LZvS9be/3tNcYl/X Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEHQB+y96lmmv+IXofwxT+ikb0YU4FAlkgKf8ACgkQwxT+ikb0 YU5WQQf+LVCPqNDBir/oU/PdWOd8Iz/yXKP39pMOaPQ+PAxBlcjrRrU3sajjn1A9 KOhGYGt377i3m476WDS4bmQ0yTUBVufJBNnYe2QhINjygcC2d9MkFDAV9uZRlFS1 09UiR6tiXWAXMeB9gUoqEGfdEkRzAgShDKjcD4pTzn6nq8IK0TQ8rGdegjyw3/Pf cmebrnBqe9pCswHXaiWcumJqOJ1VbFMkRYqP29TpLMHg7IPYsLv9qanQkb1c/f62 r4la/6+YnNjDuZveLkhyQPRfg/9cr8duIUckP0Z/5ePOXNOMYWBd9rUzF2CPYbNJ vHjDeda5EaaD6KQ4bGgSuOUilmReEQ== =jsB4 -----END PGP SIGNATURE----- --LZvS9be/3tNcYl/X--