From owner-svn-src-all@FreeBSD.ORG Sat Dec 5 18:57:33 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2496F1065670; Sat, 5 Dec 2009 18:57:33 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 124EA8FC0A; Sat, 5 Dec 2009 18:57:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nB5IvW8m096139; Sat, 5 Dec 2009 18:57:32 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nB5IvW5q096137; Sat, 5 Dec 2009 18:57:32 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200912051857.nB5IvW5q096137@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 5 Dec 2009 18:57:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r200138 - stable/8/sys/opencrypto X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2009 18:57:33 -0000 Author: bz Date: Sat Dec 5 18:57:32 2009 New Revision: 200138 URL: http://svn.freebsd.org/changeset/base/200138 Log: MFC r199885: Add SDT probes for opencrypto:deflate:deflate_gobal:*. They are not nice but they were helpful. Modified: stable/8/sys/opencrypto/deflate.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/opencrypto/deflate.c ============================================================================== --- stable/8/sys/opencrypto/deflate.c Sat Dec 5 18:55:54 2009 (r200137) +++ stable/8/sys/opencrypto/deflate.c Sat Dec 5 18:57:32 2009 (r200138) @@ -35,16 +35,30 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_kdtrace.h" + #include #include #include #include +#include +#include #include #include #include #include +SDT_PROVIDER_DECLARE(opencrypto); +SDT_PROBE_DEFINE2(opencrypto, deflate, deflate_global, entry, + "int", "u_int32_t"); +SDT_PROBE_DEFINE5(opencrypto, deflate, deflate_global, bad, + "int", "int", "int", "int", "int"); +SDT_PROBE_DEFINE5(opencrypto, deflate, deflate_global, iter, + "int", "int", "int", "int", "int"); +SDT_PROBE_DEFINE2(opencrypto, deflate, deflate_global, return, + "int", "u_int32_t"); + int window_inflate = -1 * MAX_WBITS; int window_deflate = -12; @@ -68,6 +82,8 @@ deflate_global(data, size, decomp, out) int error, i = 0, j; struct deflate_buf buf[ZBUF]; + SDT_PROBE2(opencrypto, deflate, deflate_global, entry, decomp, size); + bzero(&zbuf, sizeof(z_stream)); for (j = 0; j < ZBUF; j++) buf[j].flag = 0; @@ -81,8 +97,11 @@ deflate_global(data, size, decomp, out) if (!decomp) { buf[i].out = malloc((u_long) size, M_CRYPTO_DATA, M_NOWAIT); - if (buf[i].out == NULL) + if (buf[i].out == NULL) { + SDT_PROBE3(opencrypto, deflate, deflate_global, bad, + decomp, 0, __LINE__); goto bad; + } buf[i].size = size; buf[i].flag = 1; i++; @@ -96,8 +115,11 @@ deflate_global(data, size, decomp, out) buf[i].out = malloc((u_long) (size * 4), M_CRYPTO_DATA, M_NOWAIT); - if (buf[i].out == NULL) + if (buf[i].out == NULL) { + SDT_PROBE3(opencrypto, deflate, deflate_global, bad, + decomp, 0, __LINE__); goto bad; + } buf[i].size = size * 4; buf[i].flag = 1; i++; @@ -110,36 +132,67 @@ deflate_global(data, size, decomp, out) deflateInit2(&zbuf, Z_DEFAULT_COMPRESSION, Z_METHOD, window_deflate, Z_MEMLEVEL, Z_DEFAULT_STRATEGY); - if (error != Z_OK) + if (error != Z_OK) { + SDT_PROBE3(opencrypto, deflate, deflate_global, bad, + decomp, error, __LINE__); goto bad; + } for (;;) { error = decomp ? inflate(&zbuf, Z_PARTIAL_FLUSH) : deflate(&zbuf, Z_PARTIAL_FLUSH); - if (error != Z_OK && error != Z_STREAM_END) + if (error != Z_OK && error != Z_STREAM_END) { + /* + * Unfortunately we are limited to 5 arguments, + * thus use two probes. + */ + SDT_PROBE5(opencrypto, deflate, deflate_global, bad, + decomp, error, __LINE__, + zbuf.avail_in, zbuf.avail_out); + SDT_PROBE5(opencrypto, deflate, deflate_global, bad, + decomp, error, __LINE__, + zbuf.state->dummy, zbuf.total_out); goto bad; + } else if (zbuf.avail_in == 0 && zbuf.avail_out != 0) goto end; else if (zbuf.avail_out == 0 && i < (ZBUF - 1)) { /* we need more output space, allocate size */ buf[i].out = malloc((u_long) size, M_CRYPTO_DATA, M_NOWAIT); - if (buf[i].out == NULL) + if (buf[i].out == NULL) { + SDT_PROBE3(opencrypto, deflate, deflate_global, + bad, decomp, 0, __LINE__); goto bad; + } zbuf.next_out = buf[i].out; buf[i].size = size; buf[i].flag = 1; zbuf.avail_out = buf[i].size; i++; - } else + } else { + /* + * Unfortunately we are limited to 5 arguments, + * thus, again, use two probes. + */ + SDT_PROBE5(opencrypto, deflate, deflate_global, bad, + decomp, error, __LINE__, + zbuf.avail_in, zbuf.avail_out); + SDT_PROBE5(opencrypto, deflate, deflate_global, bad, + decomp, error, __LINE__, + zbuf.state->dummy, zbuf.total_out); goto bad; + } } end: result = count = zbuf.total_out; *out = malloc((u_long) result, M_CRYPTO_DATA, M_NOWAIT); - if (*out == NULL) + if (*out == NULL) { + SDT_PROBE3(opencrypto, deflate, deflate_global, bad, + decomp, 0, __LINE__); goto bad; + } if (decomp) inflateEnd(&zbuf); else @@ -160,6 +213,7 @@ end: } } *out = output; + SDT_PROBE2(opencrypto, deflate, deflate_global, return, decomp, result); return result; bad: