From owner-svn-src-all@freebsd.org Fri Oct 28 23:53:39 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75B04C25D8F; Fri, 28 Oct 2016 23:53:39 +0000 (UTC) (envelope-from cem@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 mx1.freebsd.org (Postfix) with ESMTPS id 1ECD13CA; Fri, 28 Oct 2016 23:53:39 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u9SNrc2Z094401; Fri, 28 Oct 2016 23:53:38 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u9SNrcwP094399; Fri, 28 Oct 2016 23:53:38 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201610282353.u9SNrcwP094399@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Fri, 28 Oct 2016 23:53:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r308070 - head/sys/dev/ioat X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 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, 28 Oct 2016 23:53:39 -0000 Author: cem Date: Fri Oct 28 23:53:37 2016 New Revision: 308070 URL: https://svnweb.freebsd.org/changeset/base/308070 Log: ioat(4): Use memory completion rather than device register The CHANSTS register is a split 64-bit register on CBDMA units before hardware v3.3. If a torn read happens during ioat_process_events(), software cannot know when to stop completing descriptors correctly. So, just use the device-pushed main memory channel status instead. Remove the ioat_get_active() seatbelt as well. It does nothing if the completion address is valid. Sponsored by: Dell EMC Isilon Modified: head/sys/dev/ioat/ioat.c head/sys/dev/ioat/ioat_internal.h Modified: head/sys/dev/ioat/ioat.c ============================================================================== --- head/sys/dev/ioat/ioat.c Fri Oct 28 23:53:36 2016 (r308069) +++ head/sys/dev/ioat/ioat.c Fri Oct 28 23:53:37 2016 (r308070) @@ -677,7 +677,7 @@ ioat_process_events(struct ioat_softc *i } completed = 0; - comp_update = ioat_get_chansts(ioat); + comp_update = *ioat->comp_update; status = comp_update & IOAT_CHANSTS_COMPLETED_DESCRIPTOR_MASK; if (status == ioat->last_seen) { @@ -691,7 +691,7 @@ ioat_process_events(struct ioat_softc *i __func__, ioat->chan_idx, comp_update, ioat->last_seen); desc = ioat_get_ring_entry(ioat, ioat->tail - 1); - while (desc->hw_desc_bus_addr != status && ioat_get_active(ioat) > 0) { + while (desc->hw_desc_bus_addr != status) { desc = ioat_get_ring_entry(ioat, ioat->tail); dmadesc = &desc->bus_dmadesc; CTR5(KTR_IOAT, "channel=%u completing desc idx %u (%p) ok cb %p(%p)", Modified: head/sys/dev/ioat/ioat_internal.h ============================================================================== --- head/sys/dev/ioat/ioat_internal.h Fri Oct 28 23:53:36 2016 (r308069) +++ head/sys/dev/ioat/ioat_internal.h Fri Oct 28 23:53:37 2016 (r308070) @@ -523,6 +523,15 @@ struct ioat_softc { void ioat_test_attach(void); void ioat_test_detach(void); +/* + * XXX DO NOT USE this routine for obtaining the current completed descriptor. + * + * The double_4 read on ioat<3.3 appears to result in torn reads. And v3.2 + * hardware is still commonplace (Broadwell Xeon has it). Instead, use the + * device-pushed *comp_update. + * + * It is safe to use ioat_get_chansts() for the low status bits. + */ static inline uint64_t ioat_get_chansts(struct ioat_softc *ioat) {