From owner-dev-commits-src-main@freebsd.org Fri Jan 8 19:27:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3726A4D40FE; Fri, 8 Jan 2021 19:27:25 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DCCmC68JKz4sQp; Fri, 8 Jan 2021 19:27:23 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id xxPtklugy34axxxPukfxX9; Fri, 08 Jan 2021 12:27:22 -0700 X-Authority-Analysis: v=2.4 cv=LvQsdlRc c=1 sm=1 tr=0 ts=5ff8b21a a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=EmqxpYm9HcoA:10 a=VxmjJ2MpAAAA:8 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=i3rduQodJLL-9NJ98xMA:9 a=CjuIK1q_8ugA:10 a=9oQxGDXC-HAA:10 a=7gXAzLPJhVmCkEl4_tsf:22 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [IPv6:fc00:1:1:1::5b]) by spqr.komquats.com (Postfix) with ESMTPS id ADEB623D; Fri, 8 Jan 2021 11:27:20 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 108JRKxR084004; Fri, 8 Jan 2021 11:27:20 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202101081927.108JRKxR084004@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Jessica Clarke , Chuck Tuffli cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: 6733401935f8 - main - nvmecontrol: add device self-test op and log page In-reply-to: <202101081920.108JKUd2003299@slippy.cwsent.com> References: <202101081729.108HTG7j066884@gitrepo.freebsd.org> <74314BD0-A0F8-481A-93A0-28FB83CB2717@freebsd.org> <202101081920.108JKUd2003299@slippy.cwsent.com> Comments: In-reply-to Cy Schubert message dated "Fri, 08 Jan 2021 11:20:30 -0800." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 08 Jan 2021 11:27:20 -0800 X-CMAE-Envelope: MS4xfLL5ySZymbUxIHy7VmXx6weBIIK4nkGp6avxMuaenOBF+R6Lilo8ipN7njghyl9AZdFOdeSRgWDjz7ValFigKalPjZdx17tIh7saBZHXYkVYNdHdq9Bj WhTbpIe+mLwgRT2rsEZljzM0kiMyz3IuYIW7KMiUFu5WLQ5yAgYZWwvhor/4UFnl1AGehep4kc4ECHc0Dh3B48UtX+v9V2I0dgXoOAp9ath0w1LYMHHCA1Dr SJg/eZ1u7j2OIAo7F5bwjKf9HZz7dV8dcuT/s7JXAaYdTauQBkTn8ssojc58iFIWogecI1EL/sA2FAXNoZmpeNVHLIRW48okKfzlETACL3DJksYRqHgtyeK3 uwJPn5yh X-Rspamd-Queue-Id: 4DCCmC68JKz4sQp X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 64.59.134.12) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [0.65 / 15.00]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; RWL_MAILSPIKE_GOOD(0.00)[64.59.134.12:from]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[4]; NEURAL_HAM_SHORT(-0.65)[-0.654]; RECEIVED_SPAMHAUS_PBL(0.00)[70.67.229.168:received]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[64.59.134.12:from]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; REPLYTO_EQ_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[cschubert.com: no valid DMARC record]; AUTH_NA(1.00)[]; SPAMHAUS_ZRD(0.00)[64.59.134.12:from:127.0.2.255]; RCVD_IN_DNSWL_LOW(-0.10)[64.59.134.12:from]; RCVD_TLS_LAST(0.00)[]; NEURAL_SPAM_LONG(1.00)[1.000]; R_SPF_NA(0.00)[no SPF record]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jan 2021 19:27:25 -0000 In message <202101081920.108JKUd2003299@slippy.cwsent.com>, Cy Schubert writes: > In message <74314BD0-A0F8-481A-93A0-28FB83CB2717@freebsd.org>, Jessica > Clarke w > rites: > > On 8 Jan 2021, at 17:29, Chuck Tuffli wrote: > > > diff --git a/sys/dev/nvme/nvme.h b/sys/dev/nvme/nvme.h > > > index 3c159b1fd0fc..67d02ba73fd8 100644 > > > --- a/sys/dev/nvme/nvme.h > > > +++ b/sys/dev/nvme/nvme.h > > > @@ -1396,6 +1396,28 @@ struct nvme_command_effects_page { > > > _Static_assert(sizeof(struct nvme_command_effects_page) == 4096, > > > "bad size for nvme_command_effects_page"); > > > > > > +struct nvme_device_self_test_page { > > > + uint8_t curr_operation; > > > + uint8_t curr_compl; > > > + uint8_t rsvd2[2]; > > > + struct { > > > + uint8_t status; > > > + uint8_t segment_num; > > > + uint8_t valid_diag_info; > > > + uint8_t rsvd3; > > > + uint64_t poh; > > > + uint32_t nsid; > > > + /* Define as an array to simplify alignment issues */ > > > + uint8_t failing_lba[8]; > > > + uint8_t status_code_type; > > > + uint8_t status_code; > > > + uint8_t vendor_specific[2]; > > > + } __packed result[20]; > > > +} __packed __aligned(4); > > > + > > > +_Static_assert(sizeof(struct nvme_device_self_test_page) == 564, > > > + "bad size for nvme_device_self_test_page"); > > > + > > > struct nvme_res_notification_page { > > > uint64_t log_page_count; > > > uint8_t log_page_type; > > > @@ -2016,4 +2038,21 @@ void nvme_resv_status_ext_swapbytes(struct n > vme_resv > > _status_ext *s __unused, > > > #endif > > > } > > > > > > +static inline void > > > +nvme_device_self_test_swapbytes(struct nvme_device_self_test_page *s __u > nu > > sed) > > > +{ > > > +#if _BYTE_ORDER != _LITTLE_ENDIAN > > > + uint64_t failing_lba; > > > + uint32_t r; > > > + > > > + for (r = 0; r < 20; r++) { > > > + s->result[r].poh = le64toh(s->result[r].poh); > > > + s->result[r].nsid = le32toh(s->result[r].nsid); > > > + /* Unaligned 64-bit loads fail on some architectures */ > > > + memcpy(&failing_lba, s->result[r].failing_lba, sizeof(failing_l > > ba)); > > > + failing_lba = le64toh(failing_lba); > > > + memcpy(s->result[r].failing_lba, &failing_lba, sizeof(failing_l > > ba)); > > > + } > > > +#endif > > > +} > > > #endif /* __NVME_H__ */ > > > > Hi, > > This broke powerpc and powerpc64: > > > > In file included from ioctl.c:33: > > In file included from /home/jrtc27/src/sys/./cam/scsi/scsi_pass.h:35: > > In file included from /home/jrtc27/src/sys/cam/cam_ccb.h:46: > > In file included from /home/jrtc27/src/sys/cam/nvme/nvme_all.h:33: > > /home/jrtc27/src/sys/dev/nvme/nvme.h:2052:3: error: implicitly declaring li > br > > ary function 'memcpy' with type 'void *(void *, const void *, unsigned long > )' > > [-Werror,-Wimplicit-function-declaration] > > memcpy(&failing_lba, s->result[r].failing_lba, sizeof(faili > ng > > _lba)); > > ^ > > /home/jrtc27/src/sys/dev/nvme/nvme.h:2052:3: note: include the header ng > > .h> or explicitly provide a declaration for 'memcpy' > > 1 error generated. > > --- ioctl.o --- > > *** [ioctl.o] Error code 1 > > > > make[7]: stopped in /home/jrtc27/src/lib/libsysdecode > > 1 error > > > > Jess > > > > > > It also broke i386 (not amd64), needing a %jd instead of %ld. The fsck_ffs commit (5cc52631b3b88dfc36d8049dc8bece8573c5f9af) has the same problem with i386. I'll go ahead and fix that one at noon. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few.