From owner-freebsd-current@FreeBSD.ORG Mon Dec 16 16:47:28 2013 Return-Path: Delivered-To: current@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 ESMTPS id 140D5C7D for ; Mon, 16 Dec 2013 16:47:28 +0000 (UTC) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.59.238]) by mx1.freebsd.org (Postfix) with ESMTP id CCFF411BE for ; Mon, 16 Dec 2013 16:47:27 +0000 (UTC) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 2744F7300A; Mon, 16 Dec 2013 17:50:14 +0100 (CET) Date: Mon, 16 Dec 2013 17:50:14 +0100 From: Luigi Rizzo To: current@freebsd.org Subject: RFC can we use __builtin_prefetch() directly in our kernel sources ? Message-ID: <20131216165014.GA15126@onelab2.iet.unipi.it> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Dec 2013 16:47:28 -0000 Is it ok in kernel code to use __builtin_prefetch() and assume that all supported compilers will do the right thing for all architectures ? I am asking is because I need to use prefetch() in a small number of places in my netmap code, and nothing in our kernel sources uses __builtin_prefetch() directly. In the (very few, mostly 10G drivers) cases where prefetch() is used the drivers redefine the function themselves as some inline asm() or an empty #define prefetch(x) This also happens in many places in the linux kernel, for what matters (relevant because hte netmap kernel code also needs to compile there). Anyways, so far in the netmap code i have followed the established practice but my (re)definition of prefetch() in netmap_kern.h clashes with some in the individual drivers, so I'd rather find a better way. thanks luigi