From owner-svn-src-stable@freebsd.org Thu Feb 1 19:07:22 2018 Return-Path: Delivered-To: svn-src-stable@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 2A979EE6050; Thu, 1 Feb 2018 19:07:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D11527E6E3; Thu, 1 Feb 2018 19:07:21 +0000 (UTC) (envelope-from mav@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 C8376110EB; Thu, 1 Feb 2018 19:07:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w11J7LWQ007899; Thu, 1 Feb 2018 19:07:21 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w11J7L44007895; Thu, 1 Feb 2018 19:07:21 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201802011907.w11J7L44007895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 1 Feb 2018 19:07:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r328703 - in stable/11/sys: cam/nvme dev/nvme X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/11/sys: cam/nvme dev/nvme X-SVN-Commit-Revision: 328703 X-SVN-Commit-Repository: base 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.25 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: Thu, 01 Feb 2018 19:07:22 -0000 Author: mav Date: Thu Feb 1 19:07:21 2018 New Revision: 328703 URL: https://svnweb.freebsd.org/changeset/base/328703 Log: MFC r324644 (by imp): Closer examination shows that nvme and CAM both normally zero-fill allocations (for req and ccb, which ultimately contain the nvme_cmd). As such, we can micro-optimize these routines. Add a comment to this effect, and bzero the ccb used to make the requests for the nda dump rotuine so it more closely matches a ccb allocated with xpt_get_ccb(). Modified: stable/11/sys/cam/nvme/nvme_da.c stable/11/sys/dev/nvme/nvme.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/nvme/nvme_da.c ============================================================================== --- stable/11/sys/cam/nvme/nvme_da.c Thu Feb 1 19:06:42 2018 (r328702) +++ stable/11/sys/cam/nvme/nvme_da.c Thu Feb 1 19:07:21 2018 (r328703) @@ -398,6 +398,8 @@ ndadump(void *arg, void *virtual, vm_offset_t physical return (ENXIO); } + /* xpt_get_ccb returns a zero'd allocation for the ccb, mimic that here */ + memset(&nvmeio, 0, sizeof(nvmeio)); if (length > 0) { xpt_setup_ccb(&ccb.ccb_h, periph->path, CAM_PRIORITY_NORMAL); ccb.ccb_h.ccb_state = NDA_CCB_DUMP; Modified: stable/11/sys/dev/nvme/nvme.h ============================================================================== --- stable/11/sys/dev/nvme/nvme.h Thu Feb 1 19:06:42 2018 (r328702) +++ stable/11/sys/dev/nvme/nvme.h Thu Feb 1 19:07:21 2018 (r328703) @@ -1068,7 +1068,12 @@ uint32_t nvme_ns_get_stripesize(struct nvme_namespace int nvme_ns_bio_process(struct nvme_namespace *ns, struct bio *bp, nvme_cb_fn_t cb_fn); -/* Command building helper functions -- shared with CAM */ +/* + * Command building helper functions -- shared with CAM + * These functions assume allocator zeros out cmd structure + * CAM's xpt_get_ccb and the request allocator for nvme both + * do zero'd allocations. + */ static inline void nvme_ns_flush_cmd(struct nvme_command *cmd, uint32_t nsid) { @@ -1082,17 +1087,10 @@ void nvme_ns_rw_cmd(struct nvme_command *cmd, uint32_t uint64_t lba, uint32_t count) { cmd->opc = rwcmd; - cmd->fuse = 0; - cmd->rsvd1 = 0; cmd->nsid = nsid; - cmd->rsvd2 = 0; - cmd->rsvd3 = 0; cmd->cdw10 = lba & 0xffffffffu; cmd->cdw11 = lba >> 32; cmd->cdw12 = count-1; - cmd->cdw13 = 0; - cmd->cdw14 = 0; - cmd->cdw15 = 0; } static inline