From owner-svn-src-all@freebsd.org Tue Dec 19 14:11:42 2017 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 957DBE85554; Tue, 19 Dec 2017 14:11:42 +0000 (UTC) (envelope-from kib@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 5FDE479F27; Tue, 19 Dec 2017 14:11:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBJEBf9p038352; Tue, 19 Dec 2017 14:11:41 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBJEBftt038351; Tue, 19 Dec 2017 14:11:41 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201712191411.vBJEBftt038351@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 19 Dec 2017 14:11:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r326977 - head/sys/dev/mlx5/mlx5_en X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/dev/mlx5/mlx5_en X-SVN-Commit-Revision: 326977 X-SVN-Commit-Repository: base 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.25 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: Tue, 19 Dec 2017 14:11:42 -0000 Author: kib Date: Tue Dec 19 14:11:41 2017 New Revision: 326977 URL: https://svnweb.freebsd.org/changeset/base/326977 Log: mlx5en: Avoid SFENCe on x86 The IA32 memory model guarantees that all writes are seen in the program order. Also, any access to the uncacheable memory flushes the store buffers. As the consequence, SFENCE instruction is (almost) never needed, in particular, it is not needed to ensure the correct order of updates as seen by a PCIe device. Use atomic_thread_fence_rel() instead of wb() to only emit compiler barriers on x86 there. Other architectures get the right barrier instruction as well. Reviewed by: hselasky Sponsored by: Mellanox Technologies MFC after: 1 week Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c ============================================================================== --- head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Tue Dec 19 11:44:24 2017 (r326976) +++ head/sys/dev/mlx5/mlx5_en/mlx5_en_rx.c Tue Dec 19 14:11:41 2017 (r326977) @@ -90,7 +90,7 @@ mlx5e_post_rx_wqes(struct mlx5e_rq *rq) } /* ensure wqes are visible to device before updating doorbell record */ - wmb(); + atomic_thread_fence_rel(); mlx5_wq_ll_update_db_record(&rq->wq); } @@ -436,7 +436,7 @@ wq_ll_pop: mlx5_cqwq_update_db_record(&rq->cq.wq); /* ensure cq space is freed before enabling more cqes */ - wmb(); + atomic_thread_fence_rel(); return (i); }