From owner-svn-src-stable@FreeBSD.ORG Sun Nov 3 20:52:14 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 95B3BD27; Sun, 3 Nov 2013 20:52:14 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8173D21FF; Sun, 3 Nov 2013 20:52:14 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rA3KqEWo036404; Sun, 3 Nov 2013 20:52:14 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id rA3KqDjZ036401; Sun, 3 Nov 2013 20:52:13 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201311032052.rA3KqDjZ036401@svn.freebsd.org> From: Jim Harris Date: Sun, 3 Nov 2013 20:52:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r257588 - in stable/9: sbin/nvmecontrol sys/dev/nvme X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 03 Nov 2013 20:52:14 -0000 Author: jimharris Date: Sun Nov 3 20:52:13 2013 New Revision: 257588 URL: http://svnweb.freebsd.org/changeset/base/257588 Log: MFC r256152: Extend some 32-bit fields and variables to 64-bit to prevent overflow when calculating data in nvmecontrol perftest. Sponsored by: Intel Modified: stable/9/sbin/nvmecontrol/perftest.c stable/9/sys/dev/nvme/nvme.h stable/9/sys/dev/nvme/nvme_test.c Directory Properties: stable/9/sbin/nvmecontrol/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sbin/nvmecontrol/perftest.c ============================================================================== --- stable/9/sbin/nvmecontrol/perftest.c Sun Nov 3 20:50:48 2013 (r257587) +++ stable/9/sbin/nvmecontrol/perftest.c Sun Nov 3 20:52:13 2013 (r257588) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -45,7 +46,8 @@ __FBSDID("$FreeBSD$"); static void print_perftest(struct nvme_io_test *io_test, bool perthread) { - uint32_t i, io_completed = 0, iops, mbps; + uint64_t io_completed = 0, iops, mbps; + uint32_t i; for (i = 0; i < io_test->num_threads; i++) io_completed += io_test->io_completed[i]; @@ -53,15 +55,15 @@ print_perftest(struct nvme_io_test *io_t iops = io_completed/io_test->time; mbps = iops * io_test->size / (1024*1024); - printf("Threads: %2d Size: %6d %5s Time: %3d IO/s: %7d MB/s: %4d\n", + printf("Threads: %2d Size: %6d %5s Time: %3d IO/s: %7ju MB/s: %4ju\n", io_test->num_threads, io_test->size, io_test->opc == NVME_OPC_READ ? "READ" : "WRITE", - io_test->time, iops, mbps); + io_test->time, (uintmax_t)iops, (uintmax_t)mbps); if (perthread) for (i = 0; i < io_test->num_threads; i++) - printf("\t%3d: %8d IO/s\n", i, - io_test->io_completed[i]/io_test->time); + printf("\t%3d: %8ju IO/s\n", i, + (uintmax_t)io_test->io_completed[i]/io_test->time); exit(1); } Modified: stable/9/sys/dev/nvme/nvme.h ============================================================================== --- stable/9/sys/dev/nvme/nvme.h Sun Nov 3 20:50:48 2013 (r257587) +++ stable/9/sys/dev/nvme/nvme.h Sun Nov 3 20:52:13 2013 (r257588) @@ -717,7 +717,7 @@ struct nvme_io_test { uint32_t time; /* in seconds */ uint32_t num_threads; uint32_t flags; - uint32_t io_completed[NVME_TEST_MAX_THREADS]; + uint64_t io_completed[NVME_TEST_MAX_THREADS]; }; enum nvme_io_test_flags { Modified: stable/9/sys/dev/nvme/nvme_test.c ============================================================================== --- stable/9/sys/dev/nvme/nvme_test.c Sun Nov 3 20:50:48 2013 (r257587) +++ stable/9/sys/dev/nvme/nvme_test.c Sun Nov 3 20:52:13 2013 (r257588) @@ -53,7 +53,7 @@ struct nvme_io_test_thread { void *buf; uint32_t size; uint32_t time; - uint32_t io_completed; + uint64_t io_completed; }; struct nvme_io_test_internal { @@ -66,7 +66,7 @@ struct nvme_io_test_internal { uint32_t td_active; uint32_t td_idx; uint32_t flags; - uint32_t io_completed[NVME_TEST_MAX_THREADS]; + uint64_t io_completed[NVME_TEST_MAX_THREADS]; }; static void @@ -90,8 +90,8 @@ nvme_ns_bio_test(void *arg) struct cdev *dev; void *buf; struct timeval t; - uint64_t offset; - uint32_t idx, io_completed = 0; + uint64_t io_completed = 0, offset; + uint32_t idx; #if __FreeBSD_version >= 900017 int ref; #endif