From owner-freebsd-bugs@FreeBSD.ORG Mon Aug 17 09:50:05 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ECA97106568D for ; Mon, 17 Aug 2009 09:50:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id C9B438FC57 for ; Mon, 17 Aug 2009 09:50:04 +0000 (UTC) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H9o4rR004268 for ; Mon, 17 Aug 2009 09:50:04 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n7H9o4Ip004267; Mon, 17 Aug 2009 09:50:04 GMT (envelope-from gnats) Resent-Date: Mon, 17 Aug 2009 09:50:04 GMT Resent-Message-Id: <200908170950.n7H9o4Ip004267@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Peter Vereshagin Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1780B106568E for ; Mon, 17 Aug 2009 09:45:39 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id E0ABA8FC16 for ; Mon, 17 Aug 2009 09:45:38 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n7H9jcqM083456 for ; Mon, 17 Aug 2009 09:45:38 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id n7H9jc7F083455; Mon, 17 Aug 2009 09:45:38 GMT (envelope-from nobody) Message-Id: <200908170945.n7H9jc7F083455@www.freebsd.org> Date: Mon, 17 Aug 2009 09:45:38 GMT From: Peter Vereshagin To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/137869: cc --fast-math leads to nan% CPU consumption in ps and top X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Aug 2009 09:50:05 -0000 >Number: 137869 >Category: bin >Synopsis: cc --fast-math leads to nan% CPU consumption in ps and top >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Aug 17 09:50:04 UTC 2009 >Closed-Date: >Last-Modified: >Originator: Peter Vereshagin >Release: RELENG_7_2 as of early August, 2009 >Organization: Private >Environment: FreeBSD somehost 7.2-RELEASE-p3 FreeBSD 7.2-RELEASE-p3 #2: Mon Aug 3 12:36:59 MSD 2009 root@somehost:/var/src/sys/i386/compile/MKERN i386 >Description: I built and installed world and kernel with this optimisations in my make.conf: === CPUTYPE=pentium4 CFLAGS=-O2 -pipe -funit-at-a-time -fpeel-loops -ftracer -funswitch-loops -mmmx -msse -msse2 -march=pentium4 -mtune=pentium4 -ffast-math CFLAGS+=-g COPTFLAGS=-O2 -pipe -funit-at-a-time -fpeel-loops -ftracer -funswitch-loops -mmmx -msse -msse2 -march=pentium4 -mtune=pentium4 -ffast-math CXXFLAGS+=-fconserve-space === Every little thing was great till I noticed the top and the ps -u show the nan% in the CPU% column. The workaround was to disable -ffast-math in make.conf and === cd /usr/src/usr.bin/top make clean all install cd /usr/src/bin/ps make clean all install === Indeed I disabled all the optimizations first and rebuilt-reinstalled world first. Then on portupgrade I noticed few of my ports failed to compile with -ffast-math, at least the postgresql-client. Thus I rebuilt and reinstalled my world and kernel with every of those optimizations turned on and recompiled top and ps only without fast-math. So this works fine now but I guess it should be better to do something with ps and top in particular, because the whole rest of the world is quite patient to the fast-math. >How-To-Repeat: compile top and ps with -ffast-math option for the gcc. >Fix: There should be warnings on the buildworld process about -ffast-math if it is not compatible with it, so world either should work with this gcc feature or shouldn't at all. It obfuscates a lot about where the trouble is, it's possible to be located in the kernel, the debugging of the kernel is not appropriate for production use, where gcc optimizations are high demand. >Release-Note: >Audit-Trail: >Unformatted: