From owner-svn-src-all@freebsd.org Fri May 31 18:29:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6095815C30FB; Fri, 31 May 2019 18:29:13 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 00B8B775C0; Fri, 31 May 2019 18:29:13 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DBA844339; Fri, 31 May 2019 18:29:12 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4VITCd3087246; Fri, 31 May 2019 18:29:12 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4VITCgW087245; Fri, 31 May 2019 18:29:12 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201905311829.x4VITCgW087245@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 31 May 2019 18:29:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r348473 - head/sys/netinet/netdump X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/netinet/netdump X-SVN-Commit-Revision: 348473 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 00B8B775C0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 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: Fri, 31 May 2019 18:29:13 -0000 Author: markj Date: Fri May 31 18:29:12 2019 New Revision: 348473 URL: https://svnweb.freebsd.org/changeset/base/348473 Log: netdump: Buffer pages to avoid calling netdump_send() on each 4KB write. netdump waits for acknowledgement from the server for each write. When dumping page table pages, we perform many small writes, limiting throughput. Use the netdump client's buffer to buffer small contiguous writes before calling netdump_send() to flush the MAXDUMPPGS-sized buffer. This results in a significant reduction in the time taken to complete a netdump. Submitted by: Sam Gwydir Reviewed by: cem MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D20317 Modified: head/sys/netinet/netdump/netdump_client.c Modified: head/sys/netinet/netdump/netdump_client.c ============================================================================== --- head/sys/netinet/netdump/netdump_client.c Fri May 31 18:00:44 2019 (r348472) +++ head/sys/netinet/netdump/netdump_client.c Fri May 31 18:29:12 2019 (r348473) @@ -130,6 +130,9 @@ static struct { union kd_ip ndc_client; union kd_ip ndc_gateway; uint8_t ndc_af; + /* Runtime State */ + off_t nd_tx_off; + size_t nd_buf_len; } nd_conf; #define nd_server nd_conf.ndc_server.in4 #define nd_client nd_conf.ndc_client.in4 @@ -945,6 +948,14 @@ netdump_dumper(void *priv __unused, void *virtual, virtual, (uintmax_t)offset, length); if (virtual == NULL) { + if (nd_conf.nd_buf_len != 0) { + error = netdump_send(NETDUMP_VMCORE, nd_conf.nd_tx_off, nd_buf, + nd_conf.nd_buf_len); + if (error != 0) { + dump_failed = 1; + } + } + if (dump_failed != 0) printf("failed to dump the kernel core\n"); else if (netdump_send(NETDUMP_FINISHED, 0, NULL, 0) != 0) @@ -957,12 +968,22 @@ netdump_dumper(void *priv __unused, void *virtual, if (length > sizeof(nd_buf)) return (ENOSPC); - memmove(nd_buf, virtual, length); - error = netdump_send(NETDUMP_VMCORE, offset, nd_buf, length); - if (error != 0) { - dump_failed = 1; - return (error); + if (nd_conf.nd_buf_len + length > sizeof(nd_buf) || + (nd_conf.nd_buf_len != 0 && nd_conf.nd_tx_off + + nd_conf.nd_buf_len != offset)) { + error = netdump_send(NETDUMP_VMCORE, nd_conf.nd_tx_off, nd_buf, + nd_conf.nd_buf_len); + if (error != 0) { + dump_failed = 1; + return (error); + } + nd_conf.nd_buf_len = 0; + nd_conf.nd_tx_off = offset; } + + memmove(nd_buf + nd_conf.nd_buf_len, virtual, length); + nd_conf.nd_buf_len += length; + return (0); }